@libxai/board 1.9.35 → 1.9.36
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 +28 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +28 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,selectionStore,BoardStore}from'@libxai/core';export{Board as BoardModel,BoardStore,Card as CardModel,Column as ColumnModel,DependencyEngine,Store}from'@libxai/core';import {createContext,memo,useRef,useState,forwardRef,useContext,useCallback,useEffect,useMemo,useImperativeHandle,useLayoutEffect,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import
|
|
2
|
-
`)}async function
|
|
3
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}async function _u(e,t,r
|
|
4
|
-
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let r=qu(t[0]),a=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let l=qu(t[o]||"");if(l.length>r.length){s.push(`Line ${o+1}: Too many columns`);continue}if(r.length-l.length>3){s.push(`Line ${o+1}: Column count mismatch (expected ${r.length}, got ${l.length})`);continue}for(;l.length<r.length;)l.push("");let i={};r.forEach((m,f)=>{i[m]=l[f]||"";});let u=i.Column||"Unnamed";n.has(u)||n.set(u,{id:`col-${n.size+1}`,title:u,position:n.size+1,cardIds:[]});let p=n.get(u),d={id:i["Card ID"]||`card-${o}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:p.id,position:p.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};a.push(d),p.cardIds.push(d.id);}catch(l){s.push(`Line ${o+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return a.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:a.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 qu(e){let t=[],r="",a=false;for(let n=0;n<e.length;n++){let s=e[n],o=e[n+1];s==='"'&&a&&o==='"'?(r+='"',n++):s==='"'?a=!a:s===","&&!a?(t.push(r),r=""):r+=s;}return t.push(r),t}function Yu(e,t){switch(t){case "json":return Vb(e);case "csv":return jb(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Xu(e){return new Promise((t,r)=>{let a=new FileReader;a.onload=n=>{n.target?.result?t(n.target.result):r(new Error("Failed to read file"));},a.onerror=()=>r(new Error("Failed to read file")),a.readAsText(e);})}var ic=createContext(null);function Ju(){return useContext(ic)}var Qu=createContext(null);function Zu({children:e,themeName:t}){return jsx(Qu.Provider,{value:{themeName:t},children:e})}function Ni(){return useContext(Qu)}function ir({children:e,container:t}){let[r,a]=useState(false),n=Ju(),s=Ni();if(useEffect(()=>(a(true),()=>a(false)),[]),!r)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:l,themeName:c}=n,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return createPortal(jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:i,children:e}),o)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),o):createPortal(e,o)}var np={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Zb="#BDC3C7",eh=({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 To({priority:e,onChange:t,className:r}){let[a,n]=useState(false),[s,o]=useState({top:0,left:0}),l=useRef(null),c=useRef(null),i=()=>{if(!c.current)return;let m=c.current.getBoundingClientRect(),f=window.innerHeight,v=window.innerWidth,h=160,b=220,y=4,x=m.right-h;x<10&&(x=m.left),x+h>v-10&&(x=v-h-10);let w=f-m.bottom,k=m.top,M;w>=b+y?M=m.bottom+y:k>=b+y?M=m.top-b-y:M=w>=k?m.bottom+y:Math.max(10,m.top-b-y),o({top:M,left:x}),n(true);};useEffect(()=>{let m=f=>{l.current&&!l.current.contains(f.target)&&!c.current?.contains(f.target)&&n(false);};if(a)return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[a]),useEffect(()=>{let m=f=>{f.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[a]);let u=m=>{t(m),n(false);},p=e?np[e]:null,d=p?.color||Zb;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:c,onClick:()=>a?n(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${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"})})}),a&&jsx(ir,{children:jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(np).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(eh,{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 th=[{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 Ps({startDate:e,endDate:t,onChange:r,className:a}){let[n,s]=useState(false),[o,l]=useState({top:0,left:0}),c=useRef(null),i=useRef(null),d=(Ni()?.themeName||"dark")==="dark",m=()=>{if(!i.current)return;let x=i.current.getBoundingClientRect(),w=window.innerHeight,k=window.innerWidth,M=320,I=380,C=4,N=x.left;N+M>k-10&&(N=k-M-10),N<10&&(N=10);let P=w-x.bottom,T=x.top,V;P>=I+C?V=x.bottom+C:T>=I+C?V=x.top-I-C:V=P>=T?x.bottom+C:Math.max(10,x.top-I-C),l({top:V,left:N}),s(true);};useEffect(()=>{let x=w=>{c.current&&!c.current.contains(w.target)&&!i.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,k=N=>{let P=N.getFullYear(),T=String(N.getMonth()+1).padStart(2,"0"),V=String(N.getDate()).padStart(2,"0");return `${P}-${T}-${V}`},M=k(w),I=new Date(w);I.setDate(I.getDate()+x);let C=k(I);r(M,C),s(false);},v=()=>{if(!e||!t)return "Set date";let x=I=>{if(I instanceof Date)return I;if(typeof I!="string"||!I.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=I.split("-").map(Number);if(C.length!==3||C.some(V=>isNaN(V)))return null;let N=C[0],P=C[1],T=C[2];return N===void 0||P===void 0||T===void 0?null:new Date(N,P-1,T)},w=x(e),k=x(t);if(!w||!k||isNaN(w.getTime())||isNaN(k.getTime()))return "Set date";let M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${M[w.getMonth()]} ${w.getDate()} \u2013 ${M[k.getMonth()]} ${k.getDate()}`},h=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 ${a||""}`,children:[jsxs("button",{ref:i,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:h?`${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(ir,{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:th.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=>r(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=>r(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:()=>{r(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 Do({assignedUsers:e=[],availableUsers:t,onChange:r,className:a,maxVisibleAvatars:n=3}){let[s,o]=useState(false),[l,c]=useState(""),[i,u]=useState({top:0,left:0}),p=useRef(null),d=useRef(null),m=()=>{if(!d.current)return;let y=d.current.getBoundingClientRect(),x=window.innerHeight,w=window.innerWidth,k=300,M=380,I=4,C=y.right-k;C<10&&(C=y.left),C+k>w-10&&(C=w-k-10);let N=x-y.bottom,P=y.top,T;N>=M+I?T=y.bottom+I:P>=M+I?T=y.top-M-I:T=N>=P?y.bottom+I:Math.max(10,y.top-M-I),u({top:T,left:C}),o(true);};useEffect(()=>{let y=x=>{p.current&&!p.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);r(x?e.filter(w=>w.id!==y.id):[...e,y]);},v=t.filter(y=>y.name.toLowerCase().includes(l.toLowerCase())),h=e.slice(0,n),b=e.length-n;return jsxs("div",{className:`relative ${a||""}`,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:[h.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)),b>0&&jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsx(ir,{children:jsxs("div",{ref:p,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:l,onChange: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:()=>{r([]),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 Di(e,t,r){let a=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(u=>{if(typeof u=="string")return u;let p=u;return p.taskId||p.targetId||""}).filter(Boolean);a.set(c.id,i);}});let n=a.get(r)||[];a.set(r,[...n,t]);let s=new Set,o=new Set,l=c=>{if(!s.has(c)){s.add(c),o.add(c);let i=a.get(c)||[];for(let u of i){if(!s.has(u)&&l(u))return true;if(o.has(u))return true}}return o.delete(c),false};return l(r)}function Ls({currentCardId:e,dependencies:t=[],availableTasks:r,onChange:a,className:n,validateCircular:s=true,onCircularDependencyError:o}){let[l,c]=useState(false),[i,u]=useState(""),[p,d]=useState(t.length>0),[m,f]=useState({top:0,left:0}),[v,h]=useState(null),b=useRef(null),y=useRef(null),x=()=>{if(!y.current)return;let C=y.current.getBoundingClientRect(),N=window.innerHeight,P=window.innerWidth,T=300,V=p?380:120,O=4,X=C.right-T;X<10&&(X=C.left),X+T>P-10&&(X=P-T-10);let F=N-C.bottom,Fe=C.top,U;F>=V+O?U=C.bottom+O:Fe>=V+O?U=C.top-V-O:U=F>=Fe?C.bottom+O:Math.max(10,C.top-V-O),f({top:U,left:X}),c(true);};useEffect(()=>{if(!l||!y.current)return;let C=y.current.getBoundingClientRect(),N=window.innerHeight,P=window.innerWidth,T=300,V=p?380:120,O=4,X=C.right-T;X<10&&(X=C.left),X+T>P-10&&(X=P-T-10);let F=N-C.bottom,Fe=C.top,U;F>=V+O?U=C.bottom+O:Fe>=V+O?U=C.top-V-O:U=F>=Fe?C.bottom+O:Math.max(10,C.top-V-O),f({top:U,left:X});},[p,l]),useEffect(()=>{let C=N=>{b.current&&!b.current.contains(N.target)&&!y.current?.contains(N.target)&&(c(false),u(""));};if(l)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[l]),useEffect(()=>{let C=N=>{N.key==="Escape"&&(c(false),u(""));};if(l)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[l]);let w=C=>{let N=t.includes(C),P=r.find(T=>T.id===C);if(h(null),N){let T=t.filter(V=>V!==C);a(T),T.length===0&&d(false);}else {if(s&&Di(r,C,e)){let V=`Cannot add "${P?.title||C}" as dependency - would create circular reference`;h(V),o?.(C,P?.title||C),setTimeout(()=>h(null),3e3);return}a([...t,C]),d(true);}},k=()=>{let C=!p;d(C),C||a([]);},M=r.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(i.toLowerCase())||C.id.toLowerCase().includes(i.toLowerCase())),I=t.length>0?"#00E5CC":"#BDC3C7";return jsxs("div",{className:`relative ${n||""}`,children:[jsxs("button",{ref:y,onClick:()=>l?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:I,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:I},children:t.length})]}),l&&jsx(ir,{children:jsxs("div",{ref:b,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:i,onChange:C=>u(C.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children: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(C=>{let N=t.includes(C.id);return jsxs("button",{onClick:()=>w(C.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:P=>{P.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:P=>{P.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background: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:C.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:C.id})]})]},C.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{a([]),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 An=memo(({card:e,render:t,onClick:r,isSelected:a,disableDrag:n,className:s,onUpdate:o,availableUsers:l=[],allCards:c=[]})=>{let{attributes:i,listeners:u,setNodeRef:p,transform:d,transition:m,isDragging:f}=useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),v={transform:wi.Transform.toString(d),transition:m};if(t)return jsx("div",{ref:p,style:v,...i,...u,onClick:()=>r?.(e),children:t(e)});let h=l.filter(w=>e.assignedUserIds?.includes(w.id)),b=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:p,style:x,className:g("asakaa-card",f&&"asakaa-card-dragging",a&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:w=>{w.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||r?.(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,k)=>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:M=>{M.currentTarget.style.display="none";}}),k===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:b?"line-through":"none",opacity:b?.6:1},children:e.title}),e.description&&jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsx("div",{onClick:w=>w.stopPropagation(),className:"priority-selector",children:jsx(To,{priority:e.priority,onChange:w=>o?.(e.id,{priority:w})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsx(Ps,{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,k)=>o?.(e.id,{startDate:w,endDate:k})})}),l.length>0&&jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsx(Do,{assignedUsers:h,availableUsers:l,onChange:w=>o?.(e.id,{assignedUserIds:w.map(k=>k.id)})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsx(Ls,{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(r=>r.id))===JSON.stringify(t.card.attachments?.map(r=>r.id)));An.displayName="Card";var Si={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"}},gp=({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 fp({status:e="todo",onChange:t,className:r,customStatuses:a=[]}){let[n,s]=useState(false),[o,l]=useState({top:0,left:0}),c=useRef(null),i=useRef(null),u=[...Object.entries(Si).map(([h,b])=>({id:h,label:b.label,color:b.color,icon:b.icon})),...a.filter(h=>!Object.keys(Si).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],p=()=>{let h=Si[e];if(h)return {...h,id:e};let b=a.find(y=>y.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...Si.todo,id:"todo"}},d=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),b=window.innerHeight,y=window.innerWidth,x=180,w=280,k=4,M=h.right-x;M<10&&(M=h.left),M+x>y-10&&(M=y-x-10);let I=b-h.bottom,C=h.top,N;I>=w+k?N=h.bottom+k:C>=w+k?N=h.top-w-k:N=I>=C?h.bottom+k:Math.max(10,h.top-w-k),l({top:N,left:M}),s(true);};useEffect(()=>{let h=b=>{c.current&&!c.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(n)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[n]),useEffect(()=>{let h=b=>{b.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[n]);let m=h=>{t(h),s(false);},f=p(),v=f.color;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:i,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(gp,{icon:f.icon,color:v})}),n&&jsx(ir,{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:u.map(h=>jsxs("button",{onClick:()=>m(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:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsx(gp,{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 bp={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 hp({columnTitle:e,onRename:t,onDelete:r,isDeletable:a=false,className:n,locale:s="en"}){let o=bp[s]||bp.en,[l,c]=useState(false),[i,u]=useState(false),[p,d]=useState(e),[m,f]=useState({top:0,left:0}),v=useRef(null),h=useRef(null),b=useRef(null);useEffect(()=>{if(l&&h.current){let k=h.current.getBoundingClientRect();f({top:k.bottom+window.scrollY+8,left:k.left+window.scrollX});}},[l]),useEffect(()=>{let k=M=>{v.current&&!v.current.contains(M.target)&&!h.current?.contains(M.target)&&(c(false),u(false));};if(l)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),useEffect(()=>{let k=M=>{M.key==="Escape"&&(c(false),u(false),d(e));};if(l)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l,e]),useEffect(()=>{i&&b.current&&(b.current.focus(),b.current.select());},[i]);let y=()=>{u(true),d(e);},x=()=>{let k=p.trim();k&&k!==e&&t(k),u(false),c(false),d(e);},w=k=>{k.key==="Enter"?x():k.key==="Escape"&&(u(false),d(e));};return jsxs("div",{className:`relative ${n||""}`,children:[jsx("button",{ref:h,onClick:()=>c(!l),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:o.columnOptions,"aria-label":o.columnOptions,children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),l&&jsx(ir,{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:i?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:o.renameColumn}),jsx("input",{ref:b,type:"text",value:p,onChange:k=>d(k.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})]}),a&&r&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{r(),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 Qo=memo(({column:e,cards:t,renderColumn:r,renderCard:a,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:l,availableUsers:c,allCards:i,enableVirtualization:u,cardHeight:p=120,isCollapsed:d,onToggleCollapse:m,onColumnRename:f,onColumnDelete:v,isDeletable:h=false,className:b,renderMetrics:y,locale:x})=>{let{setNodeRef:w,isOver:k}=useDroppable({id:e.id,data:{type:"column",column:e}}),M=useRef(null),I=u??zu(t.length),C=useVirtualizer({count:t.length,getScrollElement:()=>M.current,estimateSize:()=>p,enabled:I}),N=t.filter(X=>!X.metadata?.isContainer).length;if(r)return jsx("div",{ref:w,className:b,children:r(e,t)});let T=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let X=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:X}:X>=80?{state:"warning",percentage:X}:X>=60?{state:"approaching",percentage:X}:{state:"ok",percentage:X}})(),V=T.state==="exceeded",O=()=>"asakaa-column-count";return jsxs("div",{ref:w,className:g("asakaa-column",k&&"ring-2 ring-asakaa-accent-blue",V&&"ring-2 ring-asakaa-accent-red",b),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(O()),children:[N,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&T.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${T.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[T.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"})]}),T.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"})]}),T.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"})}),T.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(hp,{columnTitle:e.title,onRename:X=>f?.(e.id,X),onDelete:v?()=>v(e.id):void 0,isDeletable:h,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:M,className:"asakaa-column-cards",style:{maxHeight:I?"600px":void 0},children:jsx(SortableContext,{items:t.map(X=>X.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"})}):I?jsx("div",{style:{height:`${C.getTotalSize()}px`,position:"relative"},children:C.getVirtualItems().map(X=>{let F=t[X.index];return F?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${X.start}px)`},children:jsx(An,{card:F,render:a,onClick:o,onUpdate:l,availableUsers:c,allCards:i})},F.id):null})}):t.map(X=>jsx(An,{card:X,render:a,onClick:o,onUpdate:l,availableUsers:c,allCards:i},X.id))})})]})});Qo.displayName="Column";function pc({title:e,onSave:t,className:r}){let[a,n]=useState(false),[s,o]=useState(e),l=useRef(null);useEffect(()=>{a&&l.current&&(l.current.focus(),l.current.select());},[a]);let c=()=>{let u=s.trim();u&&u!==e?t(u):o(e),n(false);},i=u=>{u.key==="Enter"?c():u.key==="Escape"&&(o(e),n(false));};return a?jsx("input",{ref:l,type:"text",value:s,onChange:u=>o(u.target.value),onBlur:c,onKeyDown:i,className:g("asakaa-column-title bg-transparent border-b-2 border-[#00E5CC]","outline-none px-1 -ml-1",r),maxLength:50}):jsx("h2",{className:g("asakaa-column-title cursor-pointer",r),onClick:()=>n(true),title:"Click to edit",children:e})}function wh(e,t){let r=e.slice(0,t),a=r.lastIndexOf("@");if(a===-1)return null;let n=r[a-1];if(a>0&&n&&!/\s/.test(n))return null;let s=r.slice(a+1);return /\s/.test(s)?null:{start:a,end:t,query:s.toLowerCase()}}function Cp(e,t){let r=[],a=/@(\S+)/g,n;for(;(n=a.exec(e))!==null;){let s=n[1]?.toLowerCase()??"";if(!s)continue;let o=t.find(l=>{let c=l.name.toLowerCase(),i=c.replace(/\s+/g,""),u=c.split(/\s+/);return !!(i===s||c===s||u.some(p=>p===s))});o&&!r.includes(o.id)&&r.push(o.id);}return r}function kh(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Ch(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Th=["\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 Tp({value:e,onChange:t,onSubmit:r,users:a,placeholder:n,disabled:s=false,isSubmitting:o=false,theme:l="dark",locale:c="es",currentUser:i,enableEmoji:u=true,enableAttachments:p=true,pendingFiles:d=[],onFilesSelect:m,onRemoveFile:f,maxFileSizeMB:v=10}){let h=l==="dark",[b,y]=useState(false),[x,w]=useState([]),[k,M]=useState(0),[I,C]=useState(null),[N,P]=useState(false),T=useRef(null),V=useRef(null),O=useRef(null),X$1=useRef(null),F=useCallback((ce,Le)=>{let J=wh(ce,Le);if(C(J),J){let Pe=a.filter(Ee=>Ee.name.toLowerCase().includes(J.query)||Ee.email&&Ee.email.toLowerCase().includes(J.query)).slice(0,5);w(Pe),y(Pe.length>0),M(0);}else y(false),w([]);},[a]),Fe=ce=>{let Le=ce.target.value;if(t(Le),F(Le,ce.target.selectionStart||0),T.current){T.current.style.height="24px";let J=T.current.scrollHeight,Pe=280,Ee=Math.min(J,Pe);T.current.style.height=`${Ee}px`,T.current.style.overflowY=J>Pe?"auto":"hidden";}},U=()=>{T.current&&F(e,T.current.selectionStart||0);},De=useCallback(ce=>{if(!I||!T.current)return;let Le=e.slice(0,I.start),J=e.slice(I.end),Pe=`@${ce.name.replace(/\s+/g,"")} `,Ee=Le+Pe+J;t(Ee),y(false),C(null),setTimeout(()=>{if(T.current){let $e=I.start+Pe.length;T.current.selectionStart=$e,T.current.selectionEnd=$e,T.current.focus();}},0);},[I,e,t]),B=ce=>{if(b&&x.length>0)switch(ce.key){case "ArrowDown":ce.preventDefault(),M(Le=>Le<x.length-1?Le+1:0);break;case "ArrowUp":ce.preventDefault(),M(Le=>Le>0?Le-1:x.length-1);break;case "Enter":{ce.preventDefault();let Le=x[k];Le&&De(Le);break}case "Tab":{ce.preventDefault();let Le=x[k];Le&&De(Le);break}case "Escape":ce.preventDefault(),y(false);break}else ce.key==="Enter"&&!ce.shiftKey&&(ce.preventDefault(),r());};useEffect(()=>{let ce=Le=>{V.current&&!V.current.contains(Le.target)&&T.current&&!T.current.contains(Le.target)&&y(false),X$1.current&&!X$1.current.contains(Le.target)&&P(false);};return document.addEventListener("mousedown",ce),()=>document.removeEventListener("mousedown",ce)},[]);let z=useCallback(ce=>{if(!T.current)return;let Le=T.current.selectionStart||e.length,J=e.slice(0,Le)+ce+e.slice(Le);t(J),P(false),setTimeout(()=>{if(T.current){let Pe=Le+ce.length;T.current.selectionStart=Pe,T.current.selectionEnd=Pe,T.current.focus();}},0);},[e,t]),Me=useCallback(ce=>{if(!m||!ce.target.files)return;let Le=Array.from(ce.target.files),J=v*1024*1024,Pe=Le.filter(Ee=>Ee.size>J?(console.warn(`File ${Ee.name} exceeds max size of ${v}MB`),false):true);Pe.length>0&&m(Pe),ce.target.value="";},[m,v]),Ue=useCallback(ce=>ce.type.startsWith("image/")?Image:ce.type.includes("pdf")||ce.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(b&&V.current){let ce=V.current.children[k];ce&&ce.scrollIntoView({block:"nearest"});}},[k,b]),jsxs("div",{className:"flex flex-col gap-2",children:[d.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:d.map(ce=>{let Le=Ue(ce.file),J=ce.file.type.startsWith("image/");return jsxs("div",{className:g("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",h?"bg-white/10":"bg-gray-100"),children:[J&&ce.preview?jsx("img",{src:ce.preview,alt:ce.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(Le,{className:g("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:g("text-xs truncate",h?"text-white":"text-gray-900"),children:ce.file.name}),jsx("p",{className:g("text-xs",h?"text-[#6B7280]":"text-gray-400"),children:Ch(ce.file.size)})]}),f&&jsx("button",{onClick:()=>f(ce.id),className:g("p-0.5 rounded-full transition-colors",h?"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"})})]},ce.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[i&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:g("flex-1 relative min-w-0"),children:[jsxs("div",{className:g("flex items-end gap-1 px-2 py-2 rounded-lg",h?"bg-white/5":"bg-white border border-gray-200"),children:[u&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>P(!N),disabled:s||o,className:g("p-1 rounded transition-colors flex-shrink-0",h?"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:X$1,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",h?"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:Th.map(ce=>jsx("button",{type:"button",onClick:()=>z(ce),className:g("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",h?"hover:bg-white/10":"hover:bg-gray-100"),children:ce},ce))})})})]}),p&&m&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>O.current?.click(),disabled:s||o,className:g("p-1.5 rounded transition-colors",h?"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:O,type:"file",multiple:true,onChange:Me,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:T,value:e,onChange:Fe,onSelect:U,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",h?"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:r,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]":h?"text-[#6B7280]":"text-gray-400",o&&"opacity-50 cursor-not-allowed"),children:o?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]}),jsx(AnimatePresence,{children:b&&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",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:x.map((ce,Le)=>jsxs("button",{type:"button",onClick:()=>De(ce),className:g("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",Le===k?h?"bg-white/10":"bg-gray-100":h?"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:ce.color||"#8B5CF6"},children:kh(ce.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:g("text-sm font-medium truncate",h?"text-white":"text-gray-900"),children:ce.name}),ce.email&&jsx("p",{className:g("text-xs truncate",h?"text-[#6B7280]":"text-gray-500"),children:ce.email})]})]},ce.id))})})]})]})]})}function Np({content:e,theme:t="dark"}){let r=t==="dark",a=[],n=/@(\S+)/g,s=0,o;for(;(o=n.exec(e))!==null;)o.index>s&&a.push({type:"text",value:e.slice(s,o.index)}),a.push({type:"mention",value:o[0]}),s=o.index+o[0].length;return s<e.length&&a.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:a.map((l,c)=>l.type==="mention"?jsx("span",{className:g("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",r?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:l.value},c):jsx("span",{children:l.value},c))})}var Li=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Zo({selectedTags:e,availableTags:t,onChange:r,onCreateTag:a,theme:n,disabled:s=false,compact:o=true}){let[l,c]=useState(false),[i,u]=useState(""),[p,d]=useState(false),[m,f]=useState(Li[10]||"#00E5CC"),[v,h]=useState({top:0,left:0}),b=useRef(null),y=useRef(null),x=useRef(null),w=useRef(null),k=t.filter(T=>T.name.toLowerCase().includes(i.toLowerCase())),M=t.some(T=>T.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(l&&y.current){let T=y.current.getBoundingClientRect();h({top:T.bottom+6,left:T.left});}},[l]),useEffect(()=>{let T=V=>{let O=V.target,X=b.current?.contains(O),F=x.current?.contains(O);!X&&!F&&(c(false),u(""),d(false));};if(l)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[l]),useEffect(()=>{l&&w.current&&w.current.focus();},[l]);let I=T=>{let V=e.some(O=>O.id===T.id);r(V?e.filter(O=>O.id!==T.id):[...e,T]);},C=async()=>{if(!(!a||!i.trim())){d(true);try{let T=await a(i.trim(),m);T&&(r([...e,T]),u(""),f(Li[Math.floor(Math.random()*Li.length)]||"#00E5CC"));}finally{d(false);}}},N=(T,V)=>{V.stopPropagation(),r(e.filter(O=>O.id!==T));},P={backgroundColor:`${n.textTertiary}15`,border:`1px solid ${n.borderLight}`,color:n.textSecondary};return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{ref:y,type:"button",onClick:()=>!s&&c(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:P,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(T=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${T.color}20`,color:T.color},children:T.name},T.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:n.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:n.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref: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:i,onChange:T=>u(T.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:T=>{T.key==="Enter"&&i.trim()&&!M&&a&&C();}})}),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(T=>jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${T.color}20`,color:T.color},onClick:V=>N(T.id,V),children:[T.name,jsx(X,{className:"w-3 h-3"})]},T.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:k.length>0?k.map(T=>{let V=e.some(O=>O.id===T.id);return jsxs("button",{type:"button",onClick:()=>I(T),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:V?`${T.color}15`:"transparent",color:n.textPrimary},onMouseEnter:O=>{V||(O.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:O=>{V||(O.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:T.color}}),jsx("span",{className:"flex-1 text-left",children:T.name}),V&&jsx(Check,{className:"w-4 h-4",style:{color:T.color}})]},T.id)}):i.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!M&&a&&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:Li.map(T=>jsx("button",{type:"button",onClick:()=>f(T),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:T,outline:m===T?`2px solid ${T}`:"none",outlineOffset:"2px"}},T))}),jsxs("button",{type:"button",onClick:C,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 "',i.trim(),'"']})]})]})}),document.body)]})}function gc({tag:e,onRemove:t,size:r="sm"}){return jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${r==="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 Sp({tags:e,maxVisible:t=3,size:r="sm"}){if(!e||e.length===0)return null;let a=e.slice(0,t),n=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[a.map(s=>jsx(gc,{tag:s,size:r},s.id)),n>0&&jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${r==="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 Eo=[{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 Ep(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h${r}m`}function Ah(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 Ih({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 fc({summary:e,size:t="sm",showEstimate:r=true,onClick:a,className:n}){let s=Ah(e.health),o={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Ep(e.loggedMinutes),i=e.estimateMinutes?Ep(e.estimateMinutes):null,u=r&&i?`${c} / ${i}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(a?"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],a&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",n),onClick:a,type:a?"button":void 0,children:[jsx(Ih,{className:l[t]}),jsx("span",{children:u})]})}function Rh(e){let t=e.trim();if(!t)return null;let r;if(t.startsWith("="))r=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))r=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))r=t;else return null;if(!r||!/^[\d+\-*/().\s]+$/.test(r)||/[+\-*/]{2,}/.test(r.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let a=new Function(`"use strict"; return (${r});`)();return typeof a!="number"||!isFinite(a)||a<0?null:a}catch{return null}}function Ii(e){let t=Rh(e);return t!==null?String(t):e}function Pp(e){let r=Ii(e).trim().toLowerCase();if(r.includes(":")){let[o,l]=r.split(":").map(Number);return (o||0)*60+(l||0)}let a=r.match(/(\d+(?:\.\d+)?)\s*h/),n=r.match(/(\d+)\s*m/);if(a||n){let o=a?.[1]?parseFloat(a[1]):0,l=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+l}let s=parseFloat(r);return isNaN(s)?0:Math.round(s*60)}function Ri(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function Oh(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return t>0?`${t}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${r}:${a.toString().padStart(2,"0")}`}function Hh({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function Uh({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 Fp({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 Wh({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 bc({taskId:e,summary:t,entries:r=[],isTimerRunning:a=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:l,onStopTimer:c,onDiscardTimer:i,onClose:u,className:p}){let[d,m]=useState(""),[f,v]=useState(t.estimateMinutes?Ri(t.estimateMinutes):""),[h,b]=useState(""),[y,x]=useState(false),[w,k]=useState(false),M=useRef(null);useEffect(()=>{M.current?.focus();},[]);let I=async()=>{let P=Pp(d);if(!(P<=0||!s)){x(true);try{await s({durationMinutes:P,note:h.trim()||void 0,source:"manual"}),m(""),b("");}finally{x(false);}}},C=async()=>{if(!o)return;let P=f.trim()?Pp(f):null;await o(P),k(false);},N=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),I()),P.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(Fp,{className:"w-4 h-4"})})]}),jsx("div",{className:"px-3 py-2",children:a?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:Oh(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(Uh,{className:"w-4 h-4"})}),jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(Fp,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:l,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(Hh,{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(Wh,{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:P=>m(P.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:I,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:h,onChange:P=>b(P.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:Ri(t.loggedMinutes)})]}),jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),w?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:f,onChange:P=>v(P.target.value),onKeyDown:P=>{P.key==="Enter"&&C(),P.key==="Escape"&&k(false);},onBlur:C,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?Ri(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)}%`}})})]})]}),r.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:r.slice(0,3).map(P=>jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsx("span",{className:"truncate flex-1",children:P.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Ri(P.durationMinutes)})]},P.id))})]})]})}function _h(e){let r=Ii(e).trim().toLowerCase();if(!r||r==="-")return null;if(r.includes(":")){let[o,l]=r.split(":").map(Number);return (o||0)*60+(l||0)}let a=r.match(/(\d+(?:\.\d+)?)\s*h/),n=r.match(/(\d+)\s*m/);if(a||n){let o=a?.[1]?parseFloat(a[1]):0,l=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+l}let s=parseFloat(r);return isNaN(s)?null:Math.round(s*60)}function Kh(e){if(!e||e===0)return "";let t=Math.floor(e/60),r=e%60;return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`}function Tn({mode:e,locale:t,isDark:r,currentValue:a,onSave:n,onClose:s,className:o}){let[l,c]=useState(Kh(a)),[i,u]=useState(""),[p,d]=useState(false),m=useRef(null);useEffect(()=>{m.current?.focus();},[]);let f=async()=>{d(true);let x=_h(l);await n(x&&x>0?x:null,i||void 0),d(false);},v=async()=>{d(true),await n(null),d(false);},h=x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),f()),x.key==="Escape"&&s();},b={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:r?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:r?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:r?"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:r?"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:r?"#007FFF":"#00E5CC"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:r?"rgba(255,255,255,0.5)":"#6B7280"},children:b[e]})]}),jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:r?"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:l,onChange:x=>c(x.target.value),onKeyDown:h,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:r?"1px solid #333":"1px solid #E5E7EB",background:r?"#1A1A1A":"#F9FAFB",color:r?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:r?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsx("input",{type:"text",value:i,onChange:x=>u(x.target.value),onKeyDown:h,placeholder:y?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:r?"1px solid #333":"1px solid #E5E7EB",background:r?"#1A1A1A":"#F9FAFB",color:r?"rgba(255,255,255,0.7)":"#374151"}}),jsx("button",{type:"button",onClick:f,disabled:p||!l.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:r?"1px solid rgba(0, 229, 204,0.3)":"1px solid #00E5CC",background:r?"rgba(0, 229, 204,0.15)":"#00E5CC",color:r?"#007FFF":"#FFFFFF"},children:p?y?"Guardando...":"Saving...":y?"Registrar":"Save"}),a&&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:r?"rgba(255,255,255,0.3)":"#9CA3AF"},children:y?"Quitar":"Clear"})]})]})}function qh(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 Yh(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 yc({summary:e,showLabel:t=false,size:r="md",className:a}){let n=qh(e.health),s=Yh(e.health),o={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,c=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxs("div",{className:g("flex items-center gap-2",a),children:[jsx("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",o[r]),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",a),children:[jsxs("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",o[r]),children:[jsx("div",{className:g("h-full transition-all duration-300",n),style:{width:`${c}%`}}),i&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:g("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function es(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let r=Math.floor(t/60),a=t%60;return a===0?`${r}h`:`${r}h ${a}m`}function Jh(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 Qh(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 Zh(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 ey({summary:e,locale:t,isDark:r}){let a=e.totalVarianceMinutes>0,n=a?r?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?r?"text-red-400":"text-red-600":r?"text-gray-400":"text-gray-600",s=r?"bg-[#1A1D25]":"bg-white",o=r?"border-white/5":"border-gray-200",l=r?"text-[#9CA3AF]":"text-gray-500",c=r?"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",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:g("text-2xl font-bold",n),children:[a?"+":"",es(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:g("text-xs mt-1",l),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",l),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:r?"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:r?"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:r?"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",l),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:g("font-medium",c),children:es(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:g("font-medium",c),children:es(e.totalLoggedMinutes)})]}),jsxs("div",{className:g("flex justify-between pt-1 border-t",o),children:[jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:g("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function ty({task:e,locale:t,isDark:r,onClick:a}){let n=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=r?"border-white/5":"border-gray-200",o=r?"text-[#E5E7EB]":"text-gray-900",l=r?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:g("border-b",s,a&&g("cursor-pointer",r?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>a?.(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",l),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?es(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:es(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?r?"text-green-400":"text-green-600":e.varianceMinutes<0?r?"text-red-400":"text-red-600":l),children:[n,es(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?r?"text-green-400":"text-green-600":e.variancePercent<0?r?"text-red-400":"text-red-600":l),children:[n,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:g("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Qh(e.status,r),Jh(e.status,r)),children:Zh(e.status,t)})})]})}function xc({report:e,isLoading:t=false,locale:r="en",theme:a="light",className:n,onTaskClick:s}){let o=a==="dark",l=o?"bg-[#050505]":"bg-gray-50",c=o?"bg-[#0A0A0A]":"bg-white",i=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:r==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:g("p-8 text-center",p,n),children:r==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:g("space-y-6 p-6",l,n),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:g("text-2xl font-bold",u),children:r==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:g("text-sm mt-1",p),children:r==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(ey,{summary:e.summary,locale:r,isDark:o}),jsx("div",{className:g("rounded-lg border overflow-hidden",c,i),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:d,children:jsxs("tr",{children:[jsx("th",{className:g("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",p),children:r==="es"?"Tarea":"Task"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:r==="es"?"Ofertado":"Sold"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:r==="es"?"Trabajado":"Logged"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:r==="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:r==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:g("divide-y",i),children:m.map(f=>jsx(ty,{task:f,locale:r,isDark:o,onClick:s},f.taskId))})]})})}),jsx("div",{className:g("text-xs text-center",p),children:r==="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 ts(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function fy(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return t>0?`${t.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`}function Wp(e,t=[]){if("title"in e&&!("name"in e)){let r=e,a=(r.assignedUserIds||[]).map(n=>{let s=t.find(o=>o.id===n);return s||null}).filter(n=>n!==null);return {id:r.id,name:r.title,startDate:r.startDate?new Date(r.startDate):void 0,endDate:r.endDate?new Date(r.endDate):void 0,progress:r.progress||0,status:r.columnId,priority:r.priority?.toLowerCase(),assignees:a,dependencies:Array.isArray(r.dependencies)?r.dependencies.map(n=>typeof n=="string"?n:n.taskId):[],tags:r.tags,subtasks:r.subtasks?.map(n=>({id:n.id,name:n.title,progress:n.completed?100:0,startDate:new Date,endDate:new Date})),color:r.color,description:r.description,effortMinutes:r.effortMinutes,timeLoggedMinutes:r.timeLoggedMinutes,soldEffortMinutes:r.soldEffortMinutes}}return e}function by(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds,dependencies:e.dependencies}}function Mo({task:e,isOpen:t,onClose:r,onTaskUpdate:a,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:l=[],availableTags:c=[],onCreateTag:i,attachments:u=[],onUploadAttachments:p,onDeleteAttachment:d,availableTasks:m=[],comments:f=[],onAddComment:v,currentUser:h,mentionableUsers:b=[],onUploadCommentAttachments:y,enableTimeTracking:x=false,timeTrackingSummary:w,timeEntries:k=[],isTimerRunning:M=false,timerElapsedSeconds:I=0,onTimeLog:C,onEstimateUpdate:N,onSoldEffortUpdate:P,onTimerStart:T,onTimerStop:V,onTimerDiscard:O,blurFinancials:X$1=false}){let F=s==="dark",Fe={textTertiary:F?"#6B7280":"#9CA3AF",textSecondary:F?"#9CA3AF":"#6B7280",textPrimary:F?"#FFFFFF":"#111827",borderLight:F?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:F?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:F?"#1A1D25":"#FFFFFF",bgSecondary:F?"#0A0A0A":"#F9FAFB",hoverBg:F?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},U=e&&"title"in e&&!("name"in e),De=e,[B,z]=useState(e?Wp(e,l):null),[Me,Ue]=useState(false),[ce,Le]=useState(false),[J,Pe]=useState(false),[Ee,$e]=useState(null),[He,et]=useState(new Date),[se,_e]=useState(false),[qe,Re]=useState(false),[ut,Et]=useState(""),[Ge,Ie]=useState(false),[dt,Mt]=useState(false),[Be,vt]=useState(false),[L,Q]=useState(false),[R,_]=useState(""),ue=useRef(null),ve=useRef(null),[Oe,ye]=useState(""),ft=useRef(null),[ie,ge]=useState(""),[Ze,Xe]=useState(false),[kt,Je]=useState([]),[At,Yt]=useState(""),[pr,It]=useState(false),Ur=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 D=Wp(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:D?.id,taskName:D?.name,soldEffortMinutes:D?.soldEffortMinutes,quotedMinutes:D?.quotedMinutes,effortMinutes:D?.effortMinutes,timeLoggedMinutes:D?.timeLoggedMinutes}),z(D),_(D.description||""),ye(D.name||"");}},[e?.id,e?.quotedMinutes,l,t]),useEffect(()=>{if(!t||!R)return;let D=setTimeout(()=>{let W=ve.current;W&&(W.style.height="auto",W.style.height=`${Math.max(100,W.scrollHeight)}px`);},50);return ()=>clearTimeout(D)},[t,R]),useEffect(()=>()=>{ue.current&&clearTimeout(ue.current),ft.current&&clearTimeout(ft.current);},[]),useEffect(()=>{t&&Ur.current&&f.length>0&&setTimeout(()=>{Ur.current&&(Ur.current.scrollTop=Ur.current.scrollHeight);},100);},[t,f.length]);let Ht=useCallback(D=>{z(D),U&&n&&De?n(by(D,De)):a&&a(D);},[U,De,n,a]),vr=useCallback(()=>{Ue(false),Le(false),Pe(false),$e(null),Re(false),Et(""),Ie(false);},[]),jt=useCallback((D,W)=>{if(!B)return;let pe={...B,[D]:W};Ht(pe);},[B,Ht]),or=useCallback(()=>{let D=ve.current;D&&(D.style.height="auto",D.style.height=`${Math.max(100,D.scrollHeight)}px`);},[]),ha=useCallback(D=>{_(D),setTimeout(or,0),ue.current&&clearTimeout(ue.current),ue.current=setTimeout(()=>{if(B){let W={...B,description:D};Ht(W);}},800);},[B,Ht,or]),pa=useCallback(D=>{ye(D),ft.current&&clearTimeout(ft.current),ft.current=setTimeout(()=>{if(B&&D.trim()){let W={...B,name:D.trim()};Ht(W);}},800);},[B,Ht]),tt=useCallback(D=>{let W=D.map(pe=>{let we={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:pe};return pe.type.startsWith("image/")&&(we.preview=URL.createObjectURL(pe)),we});Je(pe=>[...pe,...W]);},[]),Ye=useCallback(D=>{Je(W=>{let pe=W.find(we=>we.id===D);return pe?.preview&&URL.revokeObjectURL(pe.preview),W.filter(we=>we.id!==D)});},[]),ea=useCallback(async()=>{if(!(!B||!ie.trim()&&kt.length===0||!v)){Xe(true);try{let D=Cp(ie,b),W=[];if(kt.length>0&&y){let pe=kt.map(we=>we.file);W=await y(pe);}await v(B.id,ie.trim(),D.length>0?D:void 0,W.length>0?W:void 0),ge(""),kt.forEach(pe=>{pe.preview&&URL.revokeObjectURL(pe.preview);}),Je([]);}finally{Xe(false);}}},[B,ie,kt,v,b,y]),_r=useCallback(()=>{if(!B||!At.trim())return;let D=B.subtasks||[],W={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:At.trim(),progress:0,startDate:new Date,endDate:new Date,position:D.length},pe=[...D,W],we={...B,subtasks:pe};Ht(we),Yt(""),It(false);},[B,At,Ht]),sa=useCallback(D=>{if(!B?.subtasks)return;let W=B.subtasks.map(we=>we.id===D?{...we,progress:we.progress===100?0:100}:we),pe={...B,subtasks:W};Ht(pe);},[B,Ht]),wr=useCallback(D=>{if(!B?.subtasks)return;let W=B.subtasks.filter(we=>we.id!==D),pe={...B,subtasks:W};Ht(pe);},[B,Ht]),Wr=useCallback(D=>{let W=typeof D=="string"?new Date(D):D,we=new Date().getTime()-W.getTime(),rt=Math.floor(we/6e4),fe=Math.floor(we/36e5),q=Math.floor(we/864e5);return rt<1?o==="es"?"Ahora":"Just now":rt<60?o==="es"?`Hace ${rt} min`:`${rt}m ago`:fe<24?o==="es"?`Hace ${fe}h`:`${fe}h ago`:q<7?o==="es"?`Hace ${q}d`:`${q}d ago`:W.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),le=useCallback(D=>{if(!B)return;let W=B.progress||0;D==="completed"?W=100:D==="in-progress"&&W===0?W=10:D==="todo"&&(W=0);let pe={...B,status:D,progress:W};Ht(pe),Ue(false);},[B,Ht]),de=useCallback((D,W)=>{if(!B)return;let pe={...B,startDate:D,endDate:W};Ht(pe);},[B,Ht]),pt=useCallback(()=>{let D=He.getFullYear(),W=He.getMonth(),pe=new Date(D,W,1),rt=new Date(D,W+1,0).getDate(),fe=pe.getDay(),q=[],it=new Date(D,W,0).getDate();for(let Pt=fe-1;Pt>=0;Pt--)q.push({date:new Date(D,W-1,it-Pt),isCurrentMonth:false});for(let Pt=1;Pt<=rt;Pt++)q.push({date:new Date(D,W,Pt),isCurrentMonth:true});let bt=42-q.length;for(let Pt=1;Pt<=bt;Pt++)q.push({date:new Date(D,W+1,Pt),isCurrentMonth:false});return q},[He]),j=useCallback(async D=>{if(D.preventDefault(),D.stopPropagation(),vt(false),!B||!p)return;let W=Array.from(D.dataTransfer.files);if(W.length!==0){Q(true);try{await p(B.id,W);}finally{Q(false);}}},[B,p]),be=useCallback(async D=>{if(!B||!p||!D.target.files)return;let W=Array.from(D.target.files);if(W.length!==0){Q(true);try{await p(B.id,W);}finally{Q(false);}D.target.value="";}},[B,p]),te=useCallback(D=>{D.preventDefault(),D.stopPropagation(),vt(true);},[]),$=useCallback(D=>{D.preventDefault(),D.stopPropagation(),vt(false);},[]),ee=useCallback(D=>D<1024?`${D} B`:D<1024*1024?`${(D/1024).toFixed(1)} KB`:`${(D/(1024*1024)).toFixed(1)} MB`,[]),ke=useCallback(D=>D.startsWith("image/")?Image:D.includes("pdf")||D.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:r,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",F?"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]",F?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:g("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:g("text-xs px-2 py-0.5 rounded",F?"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",F?"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 D=B.progress===100?0:100,pe={...B,progress:D,status:D===100?"completed":"todo"};Ht(pe);},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":F?"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:Oe,onChange:D=>pa(D.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]":F?"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",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{vr(),Ue(!Me);},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]":F?"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:Me&&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]",F?"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(D=>jsxs("button",{onClick:()=>le(D.id),className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",B.status===D.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",D.color)}),jsx("span",{className:F?"text-white":"text-gray-900",children:D.label})]},D.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:g("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{vr(),Pe(!J);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"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((D,W)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:D.color||"#8B5CF6"},title:D.name,children:D.initials||D.name.slice(0,2).toUpperCase()},W)),B.assignees.length>3&&jsxs("span",{className:g("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:["+",B.assignees.length-3]})]}):jsx("span",{className:g("text-sm",F?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:g("w-3 h-3",F?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:J&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Pe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className: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",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(D=>{let W=B.assignees?.some(pe=>pe.name===D.name);return jsxs("button",{onClick:()=>{let pe=B.assignees||[],we;W?we=pe.filter(rt=>rt.name!==D.name):we=[...pe,D],jt("assignees",we);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",W&&(F?"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:D.color||"#8B5CF6"},children:D.initials||D.name.slice(0,2).toUpperCase()}),jsx("span",{className:g("flex-1",F?"text-white":"text-gray-900"),children:D.name}),W&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},D.name)}):jsx("div",{className:g("px-3 py-4 text-sm text-center",F?"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",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{$e(Ee?null:"start"),et(B.startDate||new Date);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"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",F?"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:Ee&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>$e(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",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:g("w-44 py-2 border-r",F?"border-white/10":"border-gray-200"),children:[(()=>{let D=new Date,W=new Date(D);W.setDate(D.getDate()+1);let pe=new Date(D);pe.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let we=new Date(D);we.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let rt=new Date(D);rt.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let fe=new Date(D);fe.setDate(D.getDate()+14);let q=new Date(D);return q.setDate(D.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:W,display:W.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:pe,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:we,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:rt,display:rt.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:q,display:q.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((bt,Pt)=>jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",F?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Ee==="start"){let Zt=B.endDate&&bt.date>B.endDate?bt.date:B.endDate;de(bt.date,Zt),$e("end");}else {let Zt=B.startDate&&bt.date<B.startDate?bt.date:B.startDate;de(Zt,bt.date),$e(null);}},children:[jsx("span",{children:bt.label}),jsx("span",{className:g("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:bt.display})]},Pt))})(),jsx("div",{className:g("border-t mt-2 pt-2",F?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{de(void 0,void 0),$e(null);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",F?"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",F?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Ee==="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",F?"text-white":"text-gray-900"),children:He.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>et(new Date),className:g("p-1 rounded text-sm transition-colors",F?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>et(new Date(He.getFullYear(),He.getMonth()-1)),className:g("p-1 rounded",F?"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:()=>et(new Date(He.getFullYear(),He.getMonth()+1)),className:g("p-1 rounded",F?"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(D=>jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",F?"text-[#6B7280]":"text-gray-400"),children:D},D))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:pt().map((D,W)=>{let pe=D.date.toDateString()===new Date().toDateString(),we=B.startDate?.toDateString()===D.date.toDateString(),rt=B.endDate?.toDateString()===D.date.toDateString(),fe=we||rt,q=B.startDate&&B.endDate&&D.date>=B.startDate&&D.date<=B.endDate;return jsx("button",{onClick:()=>{let it=new Date(D.date);if(Ee==="start"){let bt=B.endDate&&it>B.endDate?it:B.endDate;de(it,bt),$e("end");}else {let bt=B.startDate&&it<B.startDate?it:B.startDate;de(bt,it),$e(null);}},className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(F?"text-[#4B5563]":"text-gray-300"),D.isCurrentMonth&&(F?"text-white":"text-gray-900"),pe&&"ring-2 ring-[#00E5CC]",we&&"bg-[#00E5CC] text-white",rt&&!we&&"bg-[#7C3AED] text-white",q&&!fe&&(F?"bg-[#7C3AED]/20":"bg-purple-100"),!fe&&(F?"hover:bg-white/10":"hover:bg-gray-100")),children:D.date.getDate()},W)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:g("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{vr(),Le(!ce);},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":F?"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:ce&&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 min-w-[140px]",F?"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(D=>jsxs("button",{onClick:()=>{jt("priority",D.id),Le(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",B.priority===D.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",D.color)}),jsx("span",{className:F?"text-white":"text-gray-900",children:D.label})]},D.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:g("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:g("text-sm",F?"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",F?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[se?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:B.progress||0,onChange:D=>{let W=parseInt(D.target.value),pe=B.status;W===100?pe="completed":W>0?pe="in-progress":pe="todo";let we={...B,progress:W,status:pe};Ht(we);},onBlur:()=>_e(false),className:g("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",F?"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:()=>_e(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",F?"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]",F?"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",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"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",F?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:w?.estimateMinutes?ts(w.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsx("button",{type:"button",onClick:()=>Mt("estimate"),className:g("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:ts(w.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>Mt("estimate"),className:g("text-sm",F?"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(Tn,{mode:"estimate",locale:o,isDark:F,currentValue:w?.estimateMinutes||null,onSave:async D=>{await N?.(B.id,D),Mt(false);},onClose:()=>Mt(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:g("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:X$1?jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",F?"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",F?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:B.quotedMinutes?ts(B.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):B.quotedMinutes?jsx("button",{type:"button",onClick:()=>Mt("quoted"),className:g("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:ts(B.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>Mt("quoted"),className:g("text-sm",F?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:dt==="quoted"&&!X$1&&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(Tn,{mode:"quoted",locale:o,isDark:F,currentValue:B.quotedMinutes||null,onSave:async D=>{P?(await P(B.id,D),z(W=>W?{...W,quotedMinutes:D}:null)):jt("quotedMinutes",D),Mt(false);},onClose:()=>Mt(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:g("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"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",F?"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"}),fy(I||0)]}):jsx("button",{type:"button",onClick:()=>T?.(B.id),className:g("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",F?"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",F?"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:()=>Mt("log"),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",F?"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":F?"text-white":"text-gray-900"),children:[ts(w.loggedMinutes),w.estimateMinutes&&jsxs("span",{className:g("font-normal",F?"text-[#6B7280]":"text-gray-400"),children:[" / ",ts(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(Tn,{mode:"log",locale:o,isDark:F,currentValue:null,onSave:async(D,W)=>{D&&await C?.(B.id,{durationMinutes:D,note:W,source:"manual"}),Mt(false);},onClose:()=>Mt(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:g("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Etiquetas":"Tags"}),jsx(Zo,{selectedTags:B.tags||[],availableTags:c,onChange:D=>{jt("tags",D);},onCreateTag:i,theme:Fe})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:g("w-4 h-4 mt-1.5",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0 mt-1",F?"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(D=>{let W=m.find(pe=>pe.id===D);return jsxs("span",{className:g("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",F?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:[W?.name||D.slice(0,8),jsx("button",{onClick:()=>{let pe=(B.dependencies||[]).filter(we=>we!==D);jt("dependencies",pe);},className:g("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},D)})}),jsxs("button",{onClick:()=>{vr(),Re(!qe);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"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",F?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:qe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Re(false),Et("");}}),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]",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:g("p-2 border-b",F?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:ut,onChange:D=>Et(D.target.value),placeholder:o==="es"?"Buscar tarea...":"Search task...",className:g("w-full px-3 py-2 rounded-md text-sm outline-none",F?"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(D=>D.id!==B.id).filter(D=>ut===""||D.name.toLowerCase().includes(ut.toLowerCase())).map(D=>{let W=B.dependencies?.includes(D.id);return jsxs("button",{onClick:()=>{let pe=B.dependencies||[],we;W?we=pe.filter(rt=>rt!==D.id):we=[...pe,D.id],jt("dependencies",we);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",F?"hover:bg-white/5":"hover:bg-gray-50",W&&(F?"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",W?"bg-[#00E5CC] border-[#00E5CC]":F?"border-white/30":"border-gray-300"),children:W&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:g("block truncate",F?"text-white":"text-gray-900"),children:D.name}),jsx("span",{className:g("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:D.id.slice(0,8)})]})]},D.id)}):jsx("div",{className:g("px-3 py-4 text-sm text-center",F?"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",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{vr(),Ie(!Ge);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",F?"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",F?"text-white":"text-gray-900"),children:Eo.find(D=>D.value===B.color)?.name||(o==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:g("w-3 h-3",F?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Ge&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ie(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",F?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Eo.map(D=>{let W=B.color===D.value;return jsx("button",{onClick:()=>{jt("color",D.value),Ie(false);},className:g("w-7 h-7 rounded-full flex items-center justify-center transition-all",W&&"ring-2 ring-offset-2",F?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:D.value,outlineColor:W?D.value:void 0},title:D.name,children:W&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},D.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:g("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",F?"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:D=>jt("isMilestone",D.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":F?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:g("text-sm",F?"text-white":"text-gray-900"),children:o==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",F?"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",F?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:g("text-sm font-semibold",F?"text-white":"text-gray-900"),children:o==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:ve,value:R,onChange:D=>ha(D.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",F?"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",F?"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",F?"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",F?"text-[#6B7280]":"text-gray-400"),children:["(",B.subtasks.filter(D=>D.progress===100).length,"/",B.subtasks.length,")"]})]})}),B.subtasks&&B.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...B.subtasks].sort((D,W)=>(D.position??0)-(W.position??0)).map(D=>jsxs("div",{className:g("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",F?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>sa(D.id),className:g("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",D.progress===100?"bg-green-500 border-green-500":F?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:D.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:g("text-sm flex-1",D.progress===100?"line-through text-[#6B7280]":F?"text-white":"text-gray-900"),children:D.name}),jsx("button",{onClick:()=>wr(D.id),className:g("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",F?"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"})})]},D.id))}),pr?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:At,onChange:D=>Yt(D.target.value),onKeyDown:D=>{D.key==="Enter"&&At.trim()?_r():D.key==="Escape"&&(It(false),Yt(""));},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",F?"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:_r,disabled:!At.trim(),className:g("px-3 py-2 rounded-lg text-sm font-medium transition-colors",At.trim()?"bg-[#00E5CC] hover:bg-[#00C4AE] text-white":F?"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:()=>{It(false),Yt("");},className:g("p-2 rounded-lg transition-colors",F?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>It(true),className:g("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",F?"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",F?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:g("text-sm font-semibold mb-3",F?"text-white":"text-gray-900"),children:[o==="es"?"Adjuntos":"Attachments",u.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsx("div",{className:"space-y-2 mb-4",children:u.map(D=>{let W=ke(D.type),pe=D.type.startsWith("image/");return jsxs("div",{className:g("flex items-center gap-3 p-2 rounded-lg group transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[pe&&D.thumbnailUrl?jsx("img",{src:D.thumbnailUrl,alt:D.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:g("w-10 h-10 rounded flex items-center justify-center",F?"bg-white/10":"bg-gray-200"),children:jsx(W,{className:g("w-5 h-5",F?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:D.url,target:"_blank",rel:"noopener noreferrer",className:g("text-sm font-medium truncate block hover:underline",F?"text-white":"text-gray-900"),children:D.name}),jsx("p",{className:g("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:ee(D.size)})]}),d&&jsx("button",{onClick:()=>d(D.id),className:g("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",F?"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"})})]},D.id)})}),jsxs("div",{onDragOver:te,onDragLeave:$,onDrop:j,className:g("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Be?F?"border-[#00E5CC] bg-[#00E5CC]/10":"border-[#00E5CC] bg-[#00E5CC]/15":F?"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:be,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!p||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",F?"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",Be?"text-[#00E5CC]":F?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:g("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:Be?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",F?"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",F?"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]",F?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:g("text-sm font-semibold",F?"text-white":"text-gray-900"),children:[o==="es"?"Actividad":"Activity",f.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",f.length,")"]})]}),jsx("button",{onClick:r,className:g("p-1.5 rounded transition-colors",F?"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 zb from'html2canvas';import {createPortal}from'react-dom';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {AnimatePresence,motion}from'framer-motion';import {CheckCircle2,PlayCircle,Circle,Copy,Scissors,Settings,Eye,EyeOff,ArrowDown,ArrowUp,ArrowUpDown,BarChart3,Link2,Minus,Plus,Trash2,Pencil,Edit3,AlertTriangle,Paperclip,Users,Tag,CheckSquare,ChevronDown,Calendar,Hash,Type,BarChart,CalendarClock,FileText,Timer,Clock,CalendarCheck,Flag,CircleDot,Moon,Sun,Palette,Check,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,File,User,CalendarDays,X,Hourglass,Play,Square,Diamond,Upload,MessageSquare,Filter,Zap,Layers,GitBranch,FileImage,FileSpreadsheet,FolderKanban,Share2,Download,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 vi=(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 wi=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 [wi.Translate.toString(e),wi.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 ki(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 $b(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function rc(e,t){return e.length===0?1e3:t===0?ki(null,e[0].position):t>=e.length?ki(e[e.length-1].position,null):ki(e[t-1].position,e[t].position)}function zu(e,t=100){return e>t}var Ob=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 Hb(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 Ci(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:n=2,maxDelay:s=1e4,shouldRetry:o=Ob,onRetry:l}=t,c,i=0;for(let u=1;u<=a;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(p){if(c=p,u===a||!o(c,u))return {error:c,attempts:i,success:false};let m=Hb(u,r,n,s);if(l)try{l(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:i,success:false}}function Ub(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 Wb(e,t={}){return async(...a)=>Ci(()=>e(...a),t)}var nc=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 Gu=(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))(Gu||{}),ko=class ko{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:n,component:s,...o}=t,l=`[${a}] [${r}] [${s}]`,c=Object.keys(o).length>0;switch(r){case "DEBUG":console.debug(l,n,c?o:"");break;case "INFO":console.info(l,n,c?o:"");break;case "WARN":console.warn(l,n,c?o:"");break;case "ERROR":console.error(l,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",...ko.globalOptions};}static configure(t){ko.globalOptions={...ko.globalOptions,...t};}child(t){return new ko({...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 Ti((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Ti(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let n={timestamp:new Date().toISOString(),level:Gu[t],message:a,component:this.options.componentName,...r};this.options.onLog(n);}};ko.globalOptions={};var oc=ko,Ti=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}},Vu=new oc;function Gb(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 Vb(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let o=e.columns.find(l=>l.id===s.columnId);return [s.id,sc(s.title),sc(s.description||""),sc(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 jb(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 zb(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=o.toDataURL("image/png"),c=297,i=210,u=o.width/o.height,p=c-20,d=p/u;d>i-20&&(d=i-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(l,"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 l=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,l.length===0?(n.setFontSize(10),n.setFont("helvetica","italic"),n.setTextColor(128,128,128),n.text("No cards in this column",20,s),n.setTextColor(0,0,0),s+=10):l.forEach(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 i=[];if(c.priority&&i.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&i.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&i.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}`),i.push(u.join(" \u2192 "));}i.length>0&&(n.setFontSize(8),n.setTextColor(100,100,100),n.text(i.join(" \u2022 "),25,s),n.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),n}function sc(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function _u(e,t,a,r){switch(t){case "json":return Gb(e,r);case "csv":return Vb(e);case "pdf":return await jb(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Ku(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${r}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,o={json:"application/json",csv:"text/csv",pdf:"application/pdf"},l=new Blob([e],{type:o[t]}),c=URL.createObjectURL(l),i=document.createElement("a");i.href=c,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(c);}function _b(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 Kb(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=qu(t[0]),r=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let l=qu(t[o]||"");if(l.length>a.length){s.push(`Line ${o+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${o+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((m,f)=>{i[m]=l[f]||"";});let u=i.Column||"Unnamed";n.has(u)||n.set(u,{id:`col-${n.size+1}`,title:u,position:n.size+1,cardIds:[]});let p=n.get(u),d={id:i["Card ID"]||`card-${o}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:p.id,position:p.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(d),p.cardIds.push(d.id);}catch(l){s.push(`Line ${o+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:n.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function qu(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 Yu(e,t){switch(t){case "json":return _b(e);case "csv":return Kb(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Xu(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 ic=createContext(null);function Ju(){return useContext(ic)}var Qu=createContext(null);function Zu({children:e,themeName:t}){return jsx(Qu.Provider,{value:{themeName:t},children:e})}function Ni(){return useContext(Qu)}function ia({children:e,container:t}){let[a,r]=useState(false),n=Ju(),s=Ni();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:l,themeName:c}=n,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return createPortal(jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:i,children:e}),o)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),o):createPortal(e,o)}var np={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},th="#BDC3C7",ah=({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 Co({priority:e,onChange:t,className:a}){let[r,n]=useState(false),[s,o]=useState({top:0,left:0}),l=useRef(null),c=useRef(null),i=()=>{if(!c.current)return;let m=c.current.getBoundingClientRect(),f=window.innerHeight,v=window.innerWidth,h=160,b=220,y=4,x=m.right-h;x<10&&(x=m.left),x+h>v-10&&(x=v-h-10);let w=f-m.bottom,k=m.top,M;w>=b+y?M=m.bottom+y:k>=b+y?M=m.top-b-y:M=w>=k?m.bottom+y:Math.max(10,m.top-b-y),o({top:M,left:x}),n(true);};useEffect(()=>{let m=f=>{l.current&&!l.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?np[e]:null,d=p?.color||th;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:c,onClick:()=>r?n(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${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(ia,{children:jsxs("div",{ref:l,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(np).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(ah,{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 rh=[{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 Ps({startDate:e,endDate:t,onChange:a,className:r}){let[n,s]=useState(false),[o,l]=useState({top:0,left:0}),c=useRef(null),i=useRef(null),d=(Ni()?.themeName||"dark")==="dark",m=()=>{if(!i.current)return;let x=i.current.getBoundingClientRect(),w=window.innerHeight,k=window.innerWidth,M=320,I=380,C=4,N=x.left;N+M>k-10&&(N=k-M-10),N<10&&(N=10);let P=w-x.bottom,T=x.top,V;P>=I+C?V=x.bottom+C:T>=I+C?V=x.top-I-C:V=P>=T?x.bottom+C:Math.max(10,x.top-I-C),l({top:V,left:N}),s(true);};useEffect(()=>{let x=w=>{c.current&&!c.current.contains(w.target)&&!i.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,k=N=>{let P=N.getFullYear(),T=String(N.getMonth()+1).padStart(2,"0"),V=String(N.getDate()).padStart(2,"0");return `${P}-${T}-${V}`},M=k(w),I=new Date(w);I.setDate(I.getDate()+x);let C=k(I);a(M,C),s(false);},v=()=>{if(!e||!t)return "Set date";let x=I=>{if(I instanceof Date)return I;if(typeof I!="string"||!I.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=I.split("-").map(Number);if(C.length!==3||C.some(V=>isNaN(V)))return null;let N=C[0],P=C[1],T=C[2];return N===void 0||P===void 0||T===void 0?null:new Date(N,P-1,T)},w=x(e),k=x(t);if(!w||!k||isNaN(w.getTime())||isNaN(k.getTime()))return "Set date";let M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${M[w.getMonth()]} ${w.getDate()} \u2013 ${M[k.getMonth()]} ${k.getDate()}`},h=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:i,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:h?`${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(ia,{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:rh.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 No({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:n=3}){let[s,o]=useState(false),[l,c]=useState(""),[i,u]=useState({top:0,left:0}),p=useRef(null),d=useRef(null),m=()=>{if(!d.current)return;let y=d.current.getBoundingClientRect(),x=window.innerHeight,w=window.innerWidth,k=300,M=380,I=4,C=y.right-k;C<10&&(C=y.left),C+k>w-10&&(C=w-k-10);let N=x-y.bottom,P=y.top,T;N>=M+I?T=y.bottom+I:P>=M+I?T=y.top-M-I:T=N>=P?y.bottom+I:Math.max(10,y.top-M-I),u({top:T,left:C}),o(true);};useEffect(()=>{let y=x=>{p.current&&!p.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(l.toLowerCase())),h=e.slice(0,n),b=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:[h.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)),b>0&&jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsx(ia,{children:jsxs("div",{ref:p,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:l,onChange: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 Di(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(u=>{if(typeof u=="string")return u;let p=u;return p.taskId||p.targetId||""}).filter(Boolean);r.set(c.id,i);}});let n=r.get(a)||[];r.set(a,[...n,t]);let s=new Set,o=new Set,l=c=>{if(!s.has(c)){s.add(c),o.add(c);let i=r.get(c)||[];for(let u of i){if(!s.has(u)&&l(u))return true;if(o.has(u))return true}}return o.delete(c),false};return l(a)}function Ls({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:n,validateCircular:s=true,onCircularDependencyError:o}){let[l,c]=useState(false),[i,u]=useState(""),[p,d]=useState(t.length>0),[m,f]=useState({top:0,left:0}),[v,h]=useState(null),b=useRef(null),y=useRef(null),x=()=>{if(!y.current)return;let C=y.current.getBoundingClientRect(),N=window.innerHeight,P=window.innerWidth,T=300,V=p?380:120,O=4,J=C.right-T;J<10&&(J=C.left),J+T>P-10&&(J=P-T-10);let L=N-C.bottom,Ie=C.top,G;L>=V+O?G=C.bottom+O:Ie>=V+O?G=C.top-V-O:G=L>=Ie?C.bottom+O:Math.max(10,C.top-V-O),f({top:G,left:J}),c(true);};useEffect(()=>{if(!l||!y.current)return;let C=y.current.getBoundingClientRect(),N=window.innerHeight,P=window.innerWidth,T=300,V=p?380:120,O=4,J=C.right-T;J<10&&(J=C.left),J+T>P-10&&(J=P-T-10);let L=N-C.bottom,Ie=C.top,G;L>=V+O?G=C.bottom+O:Ie>=V+O?G=C.top-V-O:G=L>=Ie?C.bottom+O:Math.max(10,C.top-V-O),f({top:G,left:J});},[p,l]),useEffect(()=>{let C=N=>{b.current&&!b.current.contains(N.target)&&!y.current?.contains(N.target)&&(c(false),u(""));};if(l)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[l]),useEffect(()=>{let C=N=>{N.key==="Escape"&&(c(false),u(""));};if(l)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[l]);let w=C=>{let N=t.includes(C),P=a.find(T=>T.id===C);if(h(null),N){let T=t.filter(V=>V!==C);r(T),T.length===0&&d(false);}else {if(s&&Di(a,C,e)){let V=`Cannot add "${P?.title||C}" as dependency - would create circular reference`;h(V),o?.(C,P?.title||C),setTimeout(()=>h(null),3e3);return}r([...t,C]),d(true);}},k=()=>{let C=!p;d(C),C||r([]);},M=a.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(i.toLowerCase())||C.id.toLowerCase().includes(i.toLowerCase())),I=t.length>0?"#00E5CC":"#BDC3C7";return jsxs("div",{className:`relative ${n||""}`,children:[jsxs("button",{ref:y,onClick:()=>l?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:I,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:I},children:t.length})]}),l&&jsx(ia,{children:jsxs("div",{ref:b,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:i,onChange:C=>u(C.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children: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(C=>{let N=t.includes(C.id);return jsxs("button",{onClick:()=>w(C.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:P=>{P.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:P=>{P.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background: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:C.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:C.id})]})]},C.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),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 In=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:n,className:s,onUpdate:o,availableUsers:l=[],allCards:c=[]})=>{let{attributes:i,listeners:u,setNodeRef:p,transform:d,transition:m,isDragging:f}=useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),v={transform:wi.Transform.toString(d),transition:m};if(t)return jsx("div",{ref:p,style:v,...i,...u,onClick:()=>a?.(e),children:t(e)});let h=l.filter(w=>e.assignedUserIds?.includes(w.id)),b=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:p,style:x,className:g("asakaa-card",f&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:w=>{w.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:w=>{w.currentTarget.style.display="none";}})}),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,k)=>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:M=>{M.currentTarget.style.display="none";}}),k===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:b?"line-through":"none",opacity:b?.6:1},children:e.title}),e.description&&jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsx("div",{onClick:w=>w.stopPropagation(),className:"priority-selector",children:jsx(Co,{priority:e.priority,onChange:w=>o?.(e.id,{priority:w})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsx(Ps,{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,k)=>o?.(e.id,{startDate:w,endDate:k})})}),l.length>0&&jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsx(No,{assignedUsers:h,availableUsers:l,onChange:w=>o?.(e.id,{assignedUserIds:w.map(k=>k.id)})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsx(Ls,{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)));In.displayName="Card";var Si={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"}},gp=({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 fp({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[n,s]=useState(false),[o,l]=useState({top:0,left:0}),c=useRef(null),i=useRef(null),u=[...Object.entries(Si).map(([h,b])=>({id:h,label:b.label,color:b.color,icon:b.icon})),...r.filter(h=>!Object.keys(Si).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],p=()=>{let h=Si[e];if(h)return {...h,id:e};let b=r.find(y=>y.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...Si.todo,id:"todo"}},d=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),b=window.innerHeight,y=window.innerWidth,x=180,w=280,k=4,M=h.right-x;M<10&&(M=h.left),M+x>y-10&&(M=y-x-10);let I=b-h.bottom,C=h.top,N;I>=w+k?N=h.bottom+k:C>=w+k?N=h.top-w-k:N=I>=C?h.bottom+k:Math.max(10,h.top-w-k),l({top:N,left:M}),s(true);};useEffect(()=>{let h=b=>{c.current&&!c.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(n)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[n]),useEffect(()=>{let h=b=>{b.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[n]);let m=h=>{t(h),s(false);},f=p(),v=f.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:i,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(gp,{icon:f.icon,color:v})}),n&&jsx(ia,{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:u.map(h=>jsxs("button",{onClick:()=>m(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:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsx(gp,{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 bp={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 hp({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:n,locale:s="en"}){let o=bp[s]||bp.en,[l,c]=useState(false),[i,u]=useState(false),[p,d]=useState(e),[m,f]=useState({top:0,left:0}),v=useRef(null),h=useRef(null),b=useRef(null);useEffect(()=>{if(l&&h.current){let k=h.current.getBoundingClientRect();f({top:k.bottom+window.scrollY+8,left:k.left+window.scrollX});}},[l]),useEffect(()=>{let k=M=>{v.current&&!v.current.contains(M.target)&&!h.current?.contains(M.target)&&(c(false),u(false));};if(l)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),useEffect(()=>{let k=M=>{M.key==="Escape"&&(c(false),u(false),d(e));};if(l)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l,e]),useEffect(()=>{i&&b.current&&(b.current.focus(),b.current.select());},[i]);let y=()=>{u(true),d(e);},x=()=>{let k=p.trim();k&&k!==e&&t(k),u(false),c(false),d(e);},w=k=>{k.key==="Enter"?x():k.key==="Escape"&&(u(false),d(e));};return jsxs("div",{className:`relative ${n||""}`,children:[jsx("button",{ref:h,onClick:()=>c(!l),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:o.columnOptions,"aria-label":o.columnOptions,children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),l&&jsx(ia,{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:i?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:o.renameColumn}),jsx("input",{ref:b,type:"text",value:p,onChange:k=>d(k.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 Qo=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:l,availableUsers:c,allCards:i,enableVirtualization:u,cardHeight:p=120,isCollapsed:d,onToggleCollapse:m,onColumnRename:f,onColumnDelete:v,isDeletable:h=false,className:b,renderMetrics:y,locale:x})=>{let{setNodeRef:w,isOver:k}=useDroppable({id:e.id,data:{type:"column",column:e}}),M=useRef(null),I=u??zu(t.length),C=useVirtualizer({count:t.length,getScrollElement:()=>M.current,estimateSize:()=>p,enabled:I}),N=t.filter(J=>!J.metadata?.isContainer).length;if(a)return jsx("div",{ref:w,className:b,children:a(e,t)});let T=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let J=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:J}:J>=80?{state:"warning",percentage:J}:J>=60?{state:"approaching",percentage:J}:{state:"ok",percentage:J}})(),V=T.state==="exceeded",O=()=>"asakaa-column-count";return jsxs("div",{ref:w,className:g("asakaa-column",k&&"ring-2 ring-asakaa-accent-blue",V&&"ring-2 ring-asakaa-accent-red",b),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(O()),children:[N,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&T.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${T.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[T.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"})]}),T.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"})]}),T.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"})}),T.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(hp,{columnTitle:e.title,onRename:J=>f?.(e.id,J),onDelete:v?()=>v(e.id):void 0,isDeletable:h,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:M,className:"asakaa-column-cards",style:{maxHeight:I?"600px":void 0},children:jsx(SortableContext,{items:t.map(J=>J.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"})}):I?jsx("div",{style:{height:`${C.getTotalSize()}px`,position:"relative"},children:C.getVirtualItems().map(J=>{let L=t[J.index];return L?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${J.start}px)`},children:jsx(In,{card:L,render:r,onClick:o,onUpdate:l,availableUsers:c,allCards:i})},L.id):null})}):t.map(J=>jsx(In,{card:J,render:r,onClick:o,onUpdate:l,availableUsers:c,allCards:i},J.id))})})]})});Qo.displayName="Column";function pc({title:e,onSave:t,className:a}){let[r,n]=useState(false),[s,o]=useState(e),l=useRef(null);useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let c=()=>{let u=s.trim();u&&u!==e?t(u):o(e),n(false);},i=u=>{u.key==="Enter"?c():u.key==="Escape"&&(o(e),n(false));};return r?jsx("input",{ref:l,type:"text",value:s,onChange:u=>o(u.target.value),onBlur:c,onKeyDown:i,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 Ch(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 Cp(e,t){let a=[],r=/@(\S+)/g,n;for(;(n=r.exec(e))!==null;){let s=n[1]?.toLowerCase()??"";if(!s)continue;let o=t.find(l=>{let c=l.name.toLowerCase(),i=c.replace(/\s+/g,""),u=c.split(/\s+/);return !!(i===s||c===s||u.some(p=>p===s))});o&&!a.includes(o.id)&&a.push(o.id);}return a}function Th(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Nh(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Dh=["\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 Tp({value:e,onChange:t,onSubmit:a,users:r,placeholder:n,disabled:s=false,isSubmitting:o=false,theme:l="dark",locale:c="es",currentUser:i,enableEmoji:u=true,enableAttachments:p=true,pendingFiles:d=[],onFilesSelect:m,onRemoveFile:f,maxFileSizeMB:v=10}){let h=l==="dark",[b,y]=useState(false),[x,w]=useState([]),[k,M]=useState(0),[I,C]=useState(null),[N,P]=useState(false),T=useRef(null),V=useRef(null),O=useRef(null),J=useRef(null),L=useCallback((oe,Fe)=>{let Q=Ch(oe,Fe);if(C(Q),Q){let Se=r.filter(Ue=>Ue.name.toLowerCase().includes(Q.query)||Ue.email&&Ue.email.toLowerCase().includes(Q.query)).slice(0,5);w(Se),y(Se.length>0),M(0);}else y(false),w([]);},[r]),Ie=oe=>{let Fe=oe.target.value;if(t(Fe),L(Fe,oe.target.selectionStart||0),T.current){T.current.style.height="24px";let Q=T.current.scrollHeight,Se=280,Ue=Math.min(Q,Se);T.current.style.height=`${Ue}px`,T.current.style.overflowY=Q>Se?"auto":"hidden";}},G=()=>{T.current&&L(e,T.current.selectionStart||0);},ke=useCallback(oe=>{if(!I||!T.current)return;let Fe=e.slice(0,I.start),Q=e.slice(I.end),Se=`@${oe.name.replace(/\s+/g,"")} `,Ue=Fe+Se+Q;t(Ue),y(false),C(null),setTimeout(()=>{if(T.current){let Le=I.start+Se.length;T.current.selectionStart=Le,T.current.selectionEnd=Le,T.current.focus();}},0);},[I,e,t]),R=oe=>{if(b&&x.length>0)switch(oe.key){case "ArrowDown":oe.preventDefault(),M(Fe=>Fe<x.length-1?Fe+1:0);break;case "ArrowUp":oe.preventDefault(),M(Fe=>Fe>0?Fe-1:x.length-1);break;case "Enter":{oe.preventDefault();let Fe=x[k];Fe&&ke(Fe);break}case "Tab":{oe.preventDefault();let Fe=x[k];Fe&&ke(Fe);break}case "Escape":oe.preventDefault(),y(false);break}else oe.key==="Enter"&&!oe.shiftKey&&(oe.preventDefault(),a());};useEffect(()=>{let oe=Fe=>{V.current&&!V.current.contains(Fe.target)&&T.current&&!T.current.contains(Fe.target)&&y(false),J.current&&!J.current.contains(Fe.target)&&P(false);};return document.addEventListener("mousedown",oe),()=>document.removeEventListener("mousedown",oe)},[]);let U=useCallback(oe=>{if(!T.current)return;let Fe=T.current.selectionStart||e.length,Q=e.slice(0,Fe)+oe+e.slice(Fe);t(Q),P(false),setTimeout(()=>{if(T.current){let Se=Fe+oe.length;T.current.selectionStart=Se,T.current.selectionEnd=Se,T.current.focus();}},0);},[e,t]),Pe=useCallback(oe=>{if(!m||!oe.target.files)return;let Fe=Array.from(oe.target.files),Q=v*1024*1024,Se=Fe.filter(Ue=>Ue.size>Q?(console.warn(`File ${Ue.name} exceeds max size of ${v}MB`),false):true);Se.length>0&&m(Se),oe.target.value="";},[m,v]),Ze=useCallback(oe=>oe.type.startsWith("image/")?Image:oe.type.includes("pdf")||oe.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(b&&V.current){let oe=V.current.children[k];oe&&oe.scrollIntoView({block:"nearest"});}},[k,b]),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 Fe=Ze(oe.file),Q=oe.file.type.startsWith("image/");return jsxs("div",{className:g("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",h?"bg-white/10":"bg-gray-100"),children:[Q&&oe.preview?jsx("img",{src:oe.preview,alt:oe.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(Fe,{className:g("w-4 h-4",h?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:g("text-xs truncate",h?"text-white":"text-gray-900"),children:oe.file.name}),jsx("p",{className:g("text-xs",h?"text-[#6B7280]":"text-gray-400"),children:Nh(oe.file.size)})]}),f&&jsx("button",{onClick:()=>f(oe.id),className:g("p-0.5 rounded-full transition-colors",h?"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:[i&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:g("flex-1 relative min-w-0"),children:[jsxs("div",{className:g("flex items-end gap-1 px-2 py-2 rounded-lg",h?"bg-white/5":"bg-white border border-gray-200"),children:[u&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>P(!N),disabled:s||o,className:g("p-1 rounded transition-colors flex-shrink-0",h?"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:J,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",h?"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:Dh.map(oe=>jsx("button",{type:"button",onClick:()=>U(oe),className:g("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",h?"hover:bg-white/10":"hover:bg-gray-100"),children:oe},oe))})})})]}),p&&m&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>O.current?.click(),disabled:s||o,className:g("p-1.5 rounded transition-colors",h?"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:O,type:"file",multiple:true,onChange:Pe,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:T,value:e,onChange:Ie,onSelect:G,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",h?"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]":h?"text-[#6B7280]":"text-gray-400",o&&"opacity-50 cursor-not-allowed"),children:o?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]}),jsx(AnimatePresence,{children:b&&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",h?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:x.map((oe,Fe)=>jsxs("button",{type:"button",onClick:()=>ke(oe),className:g("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",Fe===k?h?"bg-white/10":"bg-gray-100":h?"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:Th(oe.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:g("text-sm font-medium truncate",h?"text-white":"text-gray-900"),children:oe.name}),oe.email&&jsx("p",{className:g("text-xs truncate",h?"text-[#6B7280]":"text-gray-500"),children:oe.email})]})]},oe.id))})})]})]})]})}function Np({content:e,theme:t="dark"}){let a=t==="dark",r=[],n=/@(\S+)/g,s=0,o;for(;(o=n.exec(e))!==null;)o.index>s&&r.push({type:"text",value:e.slice(s,o.index)}),r.push({type:"mention",value:o[0]}),s=o.index+o[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((l,c)=>l.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:l.value},c):jsx("span",{children:l.value},c))})}var Li=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Zo({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:n,disabled:s=false,compact:o=true}){let[l,c]=useState(false),[i,u]=useState(""),[p,d]=useState(false),[m,f]=useState(Li[10]||"#00E5CC"),[v,h]=useState({top:0,left:0}),b=useRef(null),y=useRef(null),x=useRef(null),w=useRef(null),k=t.filter(T=>T.name.toLowerCase().includes(i.toLowerCase())),M=t.some(T=>T.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(l&&y.current){let T=y.current.getBoundingClientRect();h({top:T.bottom+6,left:T.left});}},[l]),useEffect(()=>{let T=V=>{let O=V.target,J=b.current?.contains(O),L=x.current?.contains(O);!J&&!L&&(c(false),u(""),d(false));};if(l)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[l]),useEffect(()=>{l&&w.current&&w.current.focus();},[l]);let I=T=>{let V=e.some(O=>O.id===T.id);a(V?e.filter(O=>O.id!==T.id):[...e,T]);},C=async()=>{if(!(!r||!i.trim())){d(true);try{let T=await r(i.trim(),m);T&&(a([...e,T]),u(""),f(Li[Math.floor(Math.random()*Li.length)]||"#00E5CC"));}finally{d(false);}}},N=(T,V)=>{V.stopPropagation(),a(e.filter(O=>O.id!==T));},P={backgroundColor:`${n.textTertiary}15`,border:`1px solid ${n.borderLight}`,color:n.textSecondary};return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{ref:y,type:"button",onClick:()=>!s&&c(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:P,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(T=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${T.color}20`,color:T.color},children:T.name},T.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:n.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:n.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref: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:i,onChange:T=>u(T.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:T=>{T.key==="Enter"&&i.trim()&&!M&&r&&C();}})}),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(T=>jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${T.color}20`,color:T.color},onClick:V=>N(T.id,V),children:[T.name,jsx(X,{className:"w-3 h-3"})]},T.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:k.length>0?k.map(T=>{let V=e.some(O=>O.id===T.id);return jsxs("button",{type:"button",onClick:()=>I(T),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:V?`${T.color}15`:"transparent",color:n.textPrimary},onMouseEnter:O=>{V||(O.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:O=>{V||(O.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:T.color}}),jsx("span",{className:"flex-1 text-left",children:T.name}),V&&jsx(Check,{className:"w-4 h-4",style:{color:T.color}})]},T.id)}):i.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!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:Li.map(T=>jsx("button",{type:"button",onClick:()=>f(T),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:T,outline:m===T?`2px solid ${T}`:"none",outlineOffset:"2px"}},T))}),jsxs("button",{type:"button",onClick:C,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 "',i.trim(),'"']})]})]})}),document.body)]})}function gc({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 Sp({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(gc,{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 So=[{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 Ep(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 Rh(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 Bh({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 fc({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:n}){let s=Rh(e.health),o={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Ep(e.loggedMinutes),i=e.estimateMinutes?Ep(e.estimateMinutes):null,u=a&&i?`${c} / ${i}`: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(Bh,{className:l[t]}),jsx("span",{children:u})]})}function $h(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 Ii(e){let t=$h(e);return t!==null?String(t):e}function Pp(e){let a=Ii(e).trim().toLowerCase();if(a.includes(":")){let[o,l]=a.split(":").map(Number);return (o||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,l=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+l}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function Ri(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 Uh(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 Wh({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function zh({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 Fp({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 Gh({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 bc({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:l,onStopTimer:c,onDiscardTimer:i,onClose:u,className:p}){let[d,m]=useState(""),[f,v]=useState(t.estimateMinutes?Ri(t.estimateMinutes):""),[h,b]=useState(""),[y,x]=useState(false),[w,k]=useState(false),M=useRef(null);useEffect(()=>{M.current?.focus();},[]);let I=async()=>{let P=Pp(d);if(!(P<=0||!s)){x(true);try{await s({durationMinutes:P,note:h.trim()||void 0,source:"manual"}),m(""),b("");}finally{x(false);}}},C=async()=>{if(!o)return;let P=f.trim()?Pp(f):null;await o(P),k(false);},N=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),I()),P.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(Fp,{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:Uh(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(zh,{className:"w-4 h-4"})}),jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(Fp,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:l,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(Wh,{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(Gh,{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:P=>m(P.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:I,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:h,onChange:P=>b(P.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:Ri(t.loggedMinutes)})]}),jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),w?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:f,onChange:P=>v(P.target.value),onKeyDown:P=>{P.key==="Enter"&&C(),P.key==="Escape"&&k(false);},onBlur:C,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?Ri(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(P=>jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsx("span",{className:"truncate flex-1",children:P.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Ri(P.durationMinutes)})]},P.id))})]})]})}function qh(e){let a=Ii(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[o,l]=a.split(":").map(Number);return (o||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,l=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+l}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function Yh(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 Nn({mode:e,locale:t,isDark:a,currentValue:r,onSave:n,onClose:s,className:o}){let[l,c]=useState(Yh(r)),[i,u]=useState(""),[p,d]=useState(false),m=useRef(null);useEffect(()=>{m.current?.focus();},[]);let f=async()=>{d(true);let x=qh(l);await n(x&&x>0?x:null,i||void 0),d(false);},v=async()=>{d(true),await n(null),d(false);},h=x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),f()),x.key==="Escape"&&s();},b={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:b[e]})]}),jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsx(X,{className:"w-3 h-3"})})]}),jsxs("div",{className:"p-3 space-y-2",children:[jsx("input",{ref:m,type:"text",value:l,onChange:x=>c(x.target.value),onKeyDown:h,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsx("input",{type:"text",value:i,onChange:x=>u(x.target.value),onKeyDown:h,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:p||!l.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0, 229, 204,0.3)":"1px solid #00E5CC",background:a?"rgba(0, 229, 204,0.15)":"#00E5CC",color:a?"#007FFF":"#FFFFFF"},children:p?y?"Guardando...":"Saving...":y?"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:y?"Quitar":"Clear"})]})]})}function Xh(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 Jh(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 yc({summary:e,showLabel:t=false,size:a="md",className:r}){let n=Xh(e.health),s=Jh(e.health),o={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,c=Math.min(100,l),i=l>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}%`}}),i&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:g("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function es(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 Zh(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 ey(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 ty(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 ay({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,n=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",o=a?"border-white/5":"border-gray-200",l=a?"text-[#9CA3AF]":"text-gray-500",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",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:g("text-2xl font-bold",n),children:[r?"+":"",es(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:g("text-xs mt-1",l),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",l),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className: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",l),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:g("font-medium",c),children:es(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:g("font-medium",c),children:es(e.totalLoggedMinutes)})]}),jsxs("div",{className:g("flex justify-between pt-1 border-t",o),children:[jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:g("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function ry({task:e,locale:t,isDark:a,onClick:r}){let n=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",o=a?"text-[#E5E7EB]":"text-gray-900",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className: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",l),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?es(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:es(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":l),children:[n,es(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":l),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",ey(e.status,a),Zh(e.status,a)),children:ty(e.status,t)})})]})}function xc({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:n,onTaskClick:s}){let o=r==="dark",l=o?"bg-[#050505]":"bg-gray-50",c=o?"bg-[#0A0A0A]":"bg-white",i=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",l,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(ay,{summary:e.summary,locale:a,isDark:o}),jsx("div",{className:g("rounded-lg border overflow-hidden",c,i),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className: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",i),children:m.map(f=>jsx(ry,{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 ts(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 hy(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 Wp(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 yy(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 Eo({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:l=[],availableTags:c=[],onCreateTag:i,attachments:u=[],onUploadAttachments:p,onDeleteAttachment:d,availableTasks:m=[],comments:f=[],onAddComment:v,currentUser:h,mentionableUsers:b=[],onUploadCommentAttachments:y,enableTimeTracking:x=false,timeTrackingSummary:w,timeEntries:k=[],isTimerRunning:M=false,timerElapsedSeconds:I=0,onTimeLog:C,onEstimateUpdate:N,onSoldEffortUpdate:P,onTimerStart:T,onTimerStop:V,onTimerDiscard:O,blurFinancials:J=false}){let L=s==="dark",Ie={textTertiary:L?"#6B7280":"#9CA3AF",textSecondary:L?"#9CA3AF":"#6B7280",textPrimary:L?"#FFFFFF":"#111827",borderLight:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:L?"#1A1D25":"#FFFFFF",bgSecondary:L?"#0A0A0A":"#F9FAFB",hoverBg:L?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},G=e&&"title"in e&&!("name"in e),ke=e,[R,U]=useState(e?Wp(e,l):null),[Pe,Ze]=useState(false),[oe,Fe]=useState(false),[Q,Se]=useState(false),[Ue,Le]=useState(null),[Be,ot]=useState(new Date),[se,je]=useState(false),[Xe,$e]=useState(false),[mt,Et]=useState(""),[st,Ne]=useState(false),[lt,Mt]=useState(false),[Oe,xt]=useState(false),[A,X$1]=useState(false),[we,B]=useState(""),q=useRef(null),he=useRef(null),[Ae,ye]=useState(""),tt=useRef(null),[ie,ce]=useState(""),[He,at]=useState(false),[ft,Ye]=useState([]),[vt,Yt]=useState(""),[ba,ca]=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 D=Wp(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:D?.id,taskName:D?.name,soldEffortMinutes:D?.soldEffortMinutes,quotedMinutes:D?.quotedMinutes,effortMinutes:D?.effortMinutes,timeLoggedMinutes:D?.timeLoggedMinutes}),U(D),B(D.description||""),ye(D.name||"");}},[e?.id,e?.quotedMinutes,l,t]),useEffect(()=>{if(!t||!we)return;let D=setTimeout(()=>{let W=he.current;W&&(W.style.height="auto",W.style.height=`${Math.max(100,W.scrollHeight)}px`);},50);return ()=>clearTimeout(D)},[t,we]),useEffect(()=>()=>{q.current&&clearTimeout(q.current),tt.current&&clearTimeout(tt.current);},[]),useEffect(()=>{t&&Gt.current&&f.length>0&&setTimeout(()=>{Gt.current&&(Gt.current.scrollTop=Gt.current.scrollHeight);},100);},[t,f.length]);let Bt=useCallback(D=>{U(D),G&&n&&ke?n(yy(D,ke)):r&&r(D);},[G,ke,n,r]),Da=useCallback(()=>{Ze(false),Fe(false),Se(false),Le(null),$e(false),Et(""),Ne(false);},[]),Ht=useCallback((D,W)=>{if(!R)return;let pe={...R,[D]:W};Bt(pe);},[R,Bt]),kr=useCallback(()=>{let D=he.current;D&&(D.style.height="auto",D.style.height=`${Math.max(100,D.scrollHeight)}px`);},[]),da=useCallback(D=>{B(D),setTimeout(kr,0),q.current&&clearTimeout(q.current),q.current=setTimeout(()=>{if(R){let W={...R,description:D};Bt(W);}},800);},[R,Bt,kr]),pr=useCallback(D=>{ye(D),tt.current&&clearTimeout(tt.current),tt.current=setTimeout(()=>{if(R&&D.trim()){let W={...R,name:D.trim()};Bt(W);}},800);},[R,Bt]),et=useCallback(D=>{let W=D.map(pe=>{let ve={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:pe};return pe.type.startsWith("image/")&&(ve.preview=URL.createObjectURL(pe)),ve});Ye(pe=>[...pe,...W]);},[]),Je=useCallback(D=>{Ye(W=>{let pe=W.find(ve=>ve.id===D);return pe?.preview&&URL.revokeObjectURL(pe.preview),W.filter(ve=>ve.id!==D)});},[]),Aa=useCallback(async()=>{if(!(!R||!ie.trim()&&ft.length===0||!v)){at(true);try{let D=Cp(ie,b),W=[];if(ft.length>0&&y){let pe=ft.map(ve=>ve.file);W=await y(pe);}await v(R.id,ie.trim(),D.length>0?D:void 0,W.length>0?W:void 0),ce(""),ft.forEach(pe=>{pe.preview&&URL.revokeObjectURL(pe.preview);}),Ye([]);}finally{at(false);}}},[R,ie,ft,v,b,y]),ja=useCallback(()=>{if(!R||!vt.trim())return;let D=R.subtasks||[],W={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:vt.trim(),progress:0,startDate:new Date,endDate:new Date,position:D.length},pe=[...D,W],ve={...R,subtasks:pe};Bt(ve),Yt(""),ca(false);},[R,vt,Bt]),or=useCallback(D=>{if(!R?.subtasks)return;let W=R.subtasks.map(ve=>ve.id===D?{...ve,progress:ve.progress===100?0:100}:ve),pe={...R,subtasks:W};Bt(pe);},[R,Bt]),Ca=useCallback(D=>{if(!R?.subtasks)return;let W=R.subtasks.filter(ve=>ve.id!==D),pe={...R,subtasks:W};Bt(pe);},[R,Bt]),Wa=useCallback(D=>{let W=typeof D=="string"?new Date(D):D,ve=new Date().getTime()-W.getTime(),rt=Math.floor(ve/6e4),ge=Math.floor(ve/36e5),K=Math.floor(ve/864e5);return rt<1?o==="es"?"Ahora":"Just now":rt<60?o==="es"?`Hace ${rt} min`:`${rt}m ago`:ge<24?o==="es"?`Hace ${ge}h`:`${ge}h ago`:K<7?o==="es"?`Hace ${K}d`:`${K}d ago`:W.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),de=useCallback(D=>{if(!R)return;let W=R.progress||0;D==="completed"?W=100:D==="in-progress"&&W===0?W=10:D==="todo"&&(W=0);let pe={...R,status:D,progress:W};Bt(pe),Ze(false);},[R,Bt]),ue=useCallback((D,W)=>{if(!R)return;let pe={...R,startDate:D,endDate:W};Bt(pe);},[R,Bt]),gt=useCallback(()=>{let D=Be.getFullYear(),W=Be.getMonth(),pe=new Date(D,W,1),rt=new Date(D,W+1,0).getDate(),ge=pe.getDay(),K=[],ct=new Date(D,W,0).getDate();for(let Pt=ge-1;Pt>=0;Pt--)K.push({date:new Date(D,W-1,ct-Pt),isCurrentMonth:false});for(let Pt=1;Pt<=rt;Pt++)K.push({date:new Date(D,W,Pt),isCurrentMonth:true});let bt=42-K.length;for(let Pt=1;Pt<=bt;Pt++)K.push({date:new Date(D,W+1,Pt),isCurrentMonth:false});return K},[Be]),j=useCallback(async D=>{if(D.preventDefault(),D.stopPropagation(),xt(false),!R||!p)return;let W=Array.from(D.dataTransfer.files);if(W.length!==0){X$1(true);try{await p(R.id,W);}finally{X$1(false);}}},[R,p]),fe=useCallback(async D=>{if(!R||!p||!D.target.files)return;let W=Array.from(D.target.files);if(W.length!==0){X$1(true);try{await p(R.id,W);}finally{X$1(false);}D.target.value="";}},[R,p]),ae=useCallback(D=>{D.preventDefault(),D.stopPropagation(),xt(true);},[]),$=useCallback(D=>{D.preventDefault(),D.stopPropagation(),xt(false);},[]),ee=useCallback(D=>D<1024?`${D} B`:D<1024*1024?`${(D/1024).toFixed(1)} KB`:`${(D/(1024*1024)).toFixed(1)} MB`,[]),Ce=useCallback(D=>D.startsWith("image/")?Image:D.includes("pdf")||D.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",L?"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]",L?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:g("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:g("text-xs px-2 py-0.5 rounded",L?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[o==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:g("text-xs font-mono",L?"text-[#6B7280]":"text-gray-400"),children:R.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let D=R.progress===100?0:100,pe={...R,progress:D,status:D===100?"completed":"todo"};Bt(pe);},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":L?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:R.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Ae,onChange:D=>pr(D.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]":L?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Da(),Ze(!Pe);},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]":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.progress===100||R.status==="completed"?o==="es"?"COMPLETADO":"DONE":R.progress&&R.progress>0||R.status==="in-progress"?o==="es"?"EN PROGRESO":"IN PROGRESS":o==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:Pe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ze(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:o==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:o==="es"?"En progreso":"In Progress",color:"bg-[#00E5CC]"},{id:"completed",label:o==="es"?"Completado":"Done",color:"bg-green-500"}].map(D=>jsxs("button",{onClick:()=>de(D.id),className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",R.status===D.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",D.color)}),jsx("span",{className:L?"text-white":"text-gray-900",children:D.label})]},D.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Da(),Se(!Q);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[R.assignees&&R.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[R.assignees.slice(0,3).map((D,W)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:D.color||"#8B5CF6"},title:D.name,children:D.initials||D.name.slice(0,2).toUpperCase()},W)),R.assignees.length>3&&jsxs("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:["+",R.assignees.length-3]})]}):jsx("span",{className:g("text-sm",L?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:g("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Q&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Se(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",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(D=>{let W=R.assignees?.some(pe=>pe.name===D.name);return jsxs("button",{onClick:()=>{let pe=R.assignees||[],ve;W?ve=pe.filter(rt=>rt.name!==D.name):ve=[...pe,D],Ht("assignees",ve);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",W&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:D.color||"#8B5CF6"},children:D.initials||D.name.slice(0,2).toUpperCase()}),jsx("span",{className:g("flex-1",L?"text-white":"text-gray-900"),children:D.name}),W&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},D.name)}):jsx("div",{className:g("px-3 py-4 text-sm text-center",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{Le(Ue?null:"start"),ot(R.startDate||new Date);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[R.startDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Inicio":"Start"),jsx("span",{className:g("mx-1",L?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),R.endDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:Ue&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Le(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",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:g("w-44 py-2 border-r",L?"border-white/10":"border-gray-200"),children:[(()=>{let D=new Date,W=new Date(D);W.setDate(D.getDate()+1);let pe=new Date(D);pe.setDate(D.getDate()+((6-D.getDay()+7)%7||7));let ve=new Date(D);ve.setDate(D.getDate()+((1-D.getDay()+7)%7||7));let rt=new Date(D);rt.setDate(D.getDate()+(6-D.getDay()+7)%7+7);let ge=new Date(D);ge.setDate(D.getDate()+14);let K=new Date(D);return K.setDate(D.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:D,display:D.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:W,display:W.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:pe,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:ve,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:rt,display:rt.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:ge,display:ge.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:K,display:K.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((bt,Pt)=>jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Ue==="start"){let Zt=R.endDate&&bt.date>R.endDate?bt.date:R.endDate;ue(bt.date,Zt),Le("end");}else {let Zt=R.startDate&&bt.date<R.startDate?bt.date:R.startDate;ue(Zt,bt.date),Le(null);}},children:[jsx("span",{children:bt.label}),jsx("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:bt.display})]},Pt))})(),jsx("div",{className:g("border-t mt-2 pt-2",L?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{ue(void 0,void 0),Le(null);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",L?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Ue==="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",L?"text-white":"text-gray-900"),children:Be.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>ot(new Date),className:g("p-1 rounded text-sm transition-colors",L?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>ot(new Date(Be.getFullYear(),Be.getMonth()-1)),className:g("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>ot(new Date(Be.getFullYear(),Be.getMonth()+1)),className:g("p-1 rounded",L?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(D=>jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",L?"text-[#6B7280]":"text-gray-400"),children:D},D))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:gt().map((D,W)=>{let pe=D.date.toDateString()===new Date().toDateString(),ve=R.startDate?.toDateString()===D.date.toDateString(),rt=R.endDate?.toDateString()===D.date.toDateString(),ge=ve||rt,K=R.startDate&&R.endDate&&D.date>=R.startDate&&D.date<=R.endDate;return jsx("button",{onClick:()=>{let ct=new Date(D.date);if(Ue==="start"){let bt=R.endDate&&ct>R.endDate?ct:R.endDate;ue(ct,bt),Le("end");}else {let bt=R.startDate&&ct<R.startDate?ct:R.startDate;ue(bt,ct),Le(null);}},className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!D.isCurrentMonth&&(L?"text-[#4B5563]":"text-gray-300"),D.isCurrentMonth&&(L?"text-white":"text-gray-900"),pe&&"ring-2 ring-[#00E5CC]",ve&&"bg-[#00E5CC] text-white",rt&&!ve&&"bg-[#7C3AED] text-white",K&&!ge&&(L?"bg-[#7C3AED]/20":"bg-purple-100"),!ge&&(L?"hover:bg-white/10":"hover:bg-gray-100")),children:D.date.getDate()},W)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Da(),Fe(!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":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.priority?R.priority==="high"||R.priority==="urgent"?o==="es"?"Alta":"High":R.priority==="medium"?o==="es"?"Media":"Medium":o==="es"?"Baja":"Low":o==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:oe&&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]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:o==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:o==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:o==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:o==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:o==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(D=>jsxs("button",{onClick:()=>{Ht("priority",D.id),Fe(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",R.priority===D.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",D.color)}),jsx("span",{className:L?"text-white":"text-gray-900",children:D.label})]},D.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:g("text-sm",L?"text-white":"text-gray-900"),children:R.startDate&&R.endDate?`${Math.ceil((R.endDate.getTime()-R.startDate.getTime())/(1e3*60*60*24))} ${o==="es"?"d\xEDas":"days"}`:o==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:g("w-4 h-4 rounded-full border-2",L?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[se?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:R.progress||0,onChange:D=>{let W=parseInt(D.target.value),pe=R.status;W===100?pe="completed":W>0?pe="in-progress":pe="todo";let ve={...R,progress:W,status:pe};Bt(ve);},onBlur:()=>je(false),className:g("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",L?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#00E5CC] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>je(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",L?"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]",L?"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",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:R.status==="completed"||R.progress===100?jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:w?.estimateMinutes?ts(w.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsx("button",{type:"button",onClick:()=>Mt("estimate"),className:g("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:ts(w.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>Mt("estimate"),className:g("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:lt==="estimate"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(Nn,{mode:"estimate",locale:o,isDark:L,currentValue:w?.estimateMinutes||null,onSave:async D=>{await N?.(R.id,D),Mt(false);},onClose:()=>Mt(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:J?jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",L?"text-[#94A3B8]":"text-gray-500"),title:o==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):R.status==="completed"||R.progress===100?jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:R.quotedMinutes?ts(R.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):R.quotedMinutes?jsx("button",{type:"button",onClick:()=>Mt("quoted"),className:g("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:ts(R.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>Mt("quoted"),className:g("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:lt==="quoted"&&!J&&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(Nn,{mode:"quoted",locale:o,isDark:L,currentValue:R.quotedMinutes||null,onSave:async D=>{P?(await P(R.id,D),U(W=>W?{...W,quotedMinutes:D}:null)):Ht("quotedMinutes",D),Mt(false);},onClose:()=>Mt(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[R.status==="completed"||R.progress===100?jsx("div",{className:g("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",L?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):M?jsxs("button",{type:"button",onClick:()=>V?.(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"}),hy(I||0)]}):jsx("button",{type:"button",onClick:()=>T?.(R.id),className:g("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",L?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:o==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),R.status==="completed"||R.progress===100?jsxs("div",{className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>Mt("log"),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",L?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}),w&&w.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:g("text-sm font-medium",w.health==="over-budget"?"text-red-500":w.health==="at-risk"?"text-yellow-500":L?"text-white":"text-gray-900"),children:[ts(w.loggedMinutes),w.estimateMinutes&&jsxs("span",{className:g("font-normal",L?"text-[#6B7280]":"text-gray-400"),children:[" / ",ts(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:lt==="log"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(Nn,{mode:"log",locale:o,isDark:L,currentValue:null,onSave:async(D,W)=>{D&&await C?.(R.id,{durationMinutes:D,note:W,source:"manual"}),Mt(false);},onClose:()=>Mt(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Etiquetas":"Tags"}),jsx(Zo,{selectedTags:R.tags||[],availableTags:c,onChange:D=>{Ht("tags",D);},onCreateTag:i,theme:Ie})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:g("w-4 h-4 mt-1.5",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0 mt-1",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[R.dependencies&&R.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:R.dependencies.map(D=>{let W=m.find(pe=>pe.id===D);return jsxs("span",{className:g("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",L?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:[W?.name||D.slice(0,8),jsx("button",{onClick:()=>{let pe=(R.dependencies||[]).filter(ve=>ve!==D);Ht("dependencies",pe);},className:g("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},D)})}),jsxs("button",{onClick:()=>{Da(),$e(!Xe);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:Xe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{$e(false),Et("");}}),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]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:g("p-2 border-b",L?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:mt,onChange:D=>Et(D.target.value),placeholder:o==="es"?"Buscar tarea...":"Search task...",className:g("w-full px-3 py-2 rounded-md text-sm outline-none",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:m.length>0?m.filter(D=>D.id!==R.id).filter(D=>mt===""||D.name.toLowerCase().includes(mt.toLowerCase())).map(D=>{let W=R.dependencies?.includes(D.id);return jsxs("button",{onClick:()=>{let pe=R.dependencies||[],ve;W?ve=pe.filter(rt=>rt!==D.id):ve=[...pe,D.id],Ht("dependencies",ve);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",W&&(L?"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",W?"bg-[#00E5CC] border-[#00E5CC]":L?"border-white/30":"border-gray-300"),children:W&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:g("block truncate",L?"text-white":"text-gray-900"),children:D.name}),jsx("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:D.id.slice(0,8)})]})]},D.id)}):jsx("div",{className:g("px-3 py-4 text-sm text-center",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Da(),Ne(!st);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:R.color||"#6366F1"}}),jsx("span",{className:g("text-sm",L?"text-white":"text-gray-900"),children:So.find(D=>D.value===R.color)?.name||(o==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:g("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:st&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ne(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",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:So.map(D=>{let W=R.color===D.value;return jsx("button",{onClick:()=>{Ht("color",D.value),Ne(false);},className:g("w-7 h-7 rounded-full flex items-center justify-center transition-all",W&&"ring-2 ring-offset-2",L?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:D.value,outlineColor:W?D.value:void 0},title:D.name,children:W&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},D.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:R.isMilestone||false,onChange:D=>Ht("isMilestone",D.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":L?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:g("text-sm",L?"text-white":"text-gray-900"),children:o==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:g("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:g("text-sm font-semibold",L?"text-white":"text-gray-900"),children:o==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:he,value:we,onChange:D=>da(D.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",L?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:g("text-sm font-semibold",L?"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",L?"text-[#6B7280]":"text-gray-400"),children:["(",R.subtasks.filter(D=>D.progress===100).length,"/",R.subtasks.length,")"]})]})}),R.subtasks&&R.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...R.subtasks].sort((D,W)=>(D.position??0)-(W.position??0)).map(D=>jsxs("div",{className:g("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",L?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>or(D.id),className:g("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",D.progress===100?"bg-green-500 border-green-500":L?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:D.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:g("text-sm flex-1",D.progress===100?"line-through text-[#6B7280]":L?"text-white":"text-gray-900"),children:D.name}),jsx("button",{onClick:()=>Ca(D.id),className:g("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",L?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsx(Trash2,{className:"w-3.5 h-3.5"})})]},D.id))}),ba?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:vt,onChange:D=>Yt(D.target.value),onKeyDown:D=>{D.key==="Enter"&&vt.trim()?ja():D.key==="Escape"&&(ca(false),Yt(""));},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",L?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-[#00E5CC]/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-[#00E5CC]")}),jsx("button",{onClick:ja,disabled:!vt.trim(),className:g("px-3 py-2 rounded-lg text-sm font-medium transition-colors",vt.trim()?"bg-[#00E5CC] hover:bg-[#00C4AE] text-white":L?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:o==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{ca(false),Yt("");},className:g("p-2 rounded-lg transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>ca(true),className:g("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),o==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:g("text-sm font-semibold mb-3",L?"text-white":"text-gray-900"),children:[o==="es"?"Adjuntos":"Attachments",u.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsx("div",{className:"space-y-2 mb-4",children:u.map(D=>{let W=Ce(D.type),pe=D.type.startsWith("image/");return jsxs("div",{className:g("flex items-center gap-3 p-2 rounded-lg group transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[pe&&D.thumbnailUrl?jsx("img",{src:D.thumbnailUrl,alt:D.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:g("w-10 h-10 rounded flex items-center justify-center",L?"bg-white/10":"bg-gray-200"),children:jsx(W,{className:g("w-5 h-5",L?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:D.url,target:"_blank",rel:"noopener noreferrer",className:g("text-sm font-medium truncate block hover:underline",L?"text-white":"text-gray-900"),children:D.name}),jsx("p",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:ee(D.size)})]}),d&&jsx("button",{onClick:()=>d(D.id),className:g("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",L?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:o==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},D.id)})}),jsxs("div",{onDragOver:ae,onDragLeave:$,onDrop:j,className:g("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Oe?L?"border-[#00E5CC] bg-[#00E5CC]/10":"border-[#00E5CC] bg-[#00E5CC]/15":L?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",A&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:fe,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!p||A}),A?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-[#00E5CC] border-t-transparent rounded-full animate-spin"}),jsx("p",{className:g("text-sm",L?"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",Oe?"text-[#00E5CC]":L?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:Oe?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",L?"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",L?"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]",L?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:g("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[o==="es"?"Actividad":"Activity",f.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",f.length,")"]})]}),jsx("button",{onClick:a,className:g("p-1.5 rounded transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("style",{children:`
|
|
5
5
|
.activity-comments-scroll::-webkit-scrollbar {
|
|
6
6
|
width: 4px !important;
|
|
7
7
|
}
|
|
@@ -13,10 +13,10 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
13
13
|
border-radius: 4px !important;
|
|
14
14
|
}
|
|
15
15
|
.activity-comments-scroll:hover::-webkit-scrollbar-thumb {
|
|
16
|
-
background: ${
|
|
16
|
+
background: ${L?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
|
|
17
17
|
}
|
|
18
|
-
`}),jsx("div",{ref:Ur,className:g("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",F?"scrollbar-slim":"scrollbar-slim-light"),children:f.length>0?jsx("div",{className:"space-y-4",children:[...f].sort((D,W)=>{let pe=typeof D.createdAt=="string"?new Date(D.createdAt):D.createdAt,we=typeof W.createdAt=="string"?new Date(W.createdAt):W.createdAt;return pe.getTime()-we.getTime()}).map(D=>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:D.user?.color||"#8B5CF6"},children:D.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",F?"text-white":"text-gray-900"),children:D.user?.name||(o==="es"?"Usuario":"User")}),jsx("span",{className:g("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:Wr(D.createdAt)})]}),jsx("div",{className:g("text-sm",F?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Np,{content:D.content,theme:s})}),D.attachments&&D.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:D.attachments.map(W=>{let pe=W.type.startsWith("image/");return jsxs("a",{href:W.url,target:"_blank",rel:"noopener noreferrer",className:g("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",F?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[pe?jsx(Image,{className:g("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:g("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:g("text-xs truncate max-w-[100px]",F?"text-white":"text-gray-900"),children:W.name})]},W.id)})})]})]},D.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",F?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:g("text-sm",F?"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",F?"border-white/10":"border-gray-200"),children:jsx(Tp,{value:ie,onChange:ge,onSubmit:ea,users:b,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!v,isSubmitting:Ze,theme:s,locale:o,currentUser:h,enableEmoji:true,enableAttachments:!!y,pendingFiles:kt,onFilesSelect:tt,onRemoveFile:Ye})})]})]})]})})}function wc(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(n=>{t(n);}),[]);let r=useCallback(a=>{dragStore.setState(a);},[]);return [e,r]}function eo({board:e,callbacks:t,onCardClick:r,renderProps:a,config:n,availableUsers:s=[],className:o,style:l,isLoading:c,error:i,children:u,availableTags:p=[],onCreateTag:d,attachmentsByCard:m,onUploadAttachments:f,onDeleteAttachment:v,comments:h,onAddComment:b,currentUser:y,mentionableUsers:x,onTaskOpen:w,onUploadCommentAttachments:k,enableTimeTracking:M,timeTrackingSummary:I,timeEntries:C,timerState:N,onLogTime:P,onUpdateEstimate:T,onUpdateSoldEffort:V,onStartTimer:O,onStopTimer:X,onDiscardTimer:F,blurFinancials:Fe=false,sidePanel:U,renderColumnMetrics:De,suppressDetailModal:B=false}){let[z,Me]=wc(),[Ue,ce]=useState(null),[Le,J]=useState(false),Pe=useRef(null),Ee=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),$e=n?.theme||"dark",He=$e==="dark"||$e==="neutral",et=He?"dark":"",se=useCallback((L,Q)=>{t.onCardUpdate?.(L,Q);},[t]),_e=useCallback((L,Q)=>{t.onColumnUpdate?.(L,{title:Q});},[t]),qe=useCallback(L=>{t.onColumnDelete?.(L);},[t]),Re=["todo","in-progress","completed"],ut=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Et=useMemo(()=>{let L=new Map;return e.columns.forEach(Q=>{let R=Q.cardIds.map(_=>e.cards.find(ue=>ue.id===_)).filter(_=>_!==void 0).sort((_,ue)=>_.position-ue.position);L.set(Q.id,R);}),L},[e.cards,e.columns]);useEffect(()=>{let L=Pe.current;if(!L)return;let Q=ve=>{let Oe=ve.target,ye=ve.button===1,ft=Oe===L||Oe.classList.contains("asakaa-column")&&!Oe.closest(".asakaa-card");(ye||ve.button===0&&ft&&!z.isDragging)&&(ve.preventDefault(),J(true),Ee.current={x:ve.clientX,y:ve.clientY,scrollLeft:L.scrollLeft,scrollTop:L.scrollTop},L.style.cursor="grabbing",L.style.userSelect="none");},R=ve=>{if(!Le)return;let Oe=ve.clientX-Ee.current.x,ye=ve.clientY-Ee.current.y;L.scrollLeft=Ee.current.scrollLeft-Oe,L.scrollTop=Ee.current.scrollTop-ye;},_=()=>{Le&&(J(false),L.style.cursor="",L.style.userSelect="");},ue=()=>{Le&&(J(false),L.style.cursor="",L.style.userSelect="");};return L.addEventListener("mousedown",Q),document.addEventListener("mousemove",R),document.addEventListener("mouseup",_),L.addEventListener("mouseleave",ue),()=>{L.removeEventListener("mousedown",Q),document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",_),L.removeEventListener("mouseleave",ue);}},[Le,z.isDragging]);let Ge=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(Q=>typeof Q=="string"?Q:Q.taskId):[]})),[e.cards]),Ie=useCallback(L=>{let{active:Q}=L,R=e.cards.find(_=>_.id===Q.id);R&&Me({isDragging:true,draggedCardId:R.id,sourceColumnId:R.columnId,targetColumnId:R.columnId});},[e.cards,Me]),dt=useCallback(L=>{let{active:Q,over:R}=L;if(!R||!e.cards.find(ve=>ve.id===Q.id))return;let ue=null;R.data.current?.type==="column"?ue=R.id:R.data.current?.type==="card"&&(ue=e.cards.find(Oe=>Oe.id===R.id)?.columnId||null),ue&&ue!==z.targetColumnId&&Me({...z,targetColumnId:ue});},[e.cards,z,Me]),Mt=useCallback(async L=>{let{active:Q,over:R}=L;if(Me({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!R)return;let _=e.cards.find(ye=>ye.id===Q.id);if(!_)return;let ue,ve;if(R.data.current?.type==="column"){ue=R.id;let ye=Et.get(ue)||[];ve=ac(ye,0);}else {let ye=e.cards.find(ge=>ge.id===R.id);if(!ye)return;ue=ye.columnId;let ft=Et.get(ue)||[],ie=ft.findIndex(ge=>ge.id===R.id);ve=ac(ft,ie);}let Oe=e.columns.find(ye=>ye.id===ue);if(Oe&&Oe.wipLimit&&Oe.wipLimitType==="hard"){let ye=Et.get(ue)||[];if(_.columnId!==ue&&ye.length>=Oe.wipLimit){t.onWipLimitExceeded?.(Oe,_);return}}(_.columnId!==ue||_.position!==ve)&&await t.onCardMove?.(_.id,ue,ve);},[e.cards,e.columns,Et,t,Me]),Be=useCallback(L=>{B||ce(L),r?.(L),w?.(L.id);},[r,w,B]),vt=useCallback(L=>{t.onCardUpdate?.(L.id,L),ce(L);},[t]);return c?jsx("div",{className:g("asakaa-board",et,o),style:l,children:jsx(Ey,{columnCount:3})}):i?jsx("div",{className:g("asakaa-board",et,o),style:l,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxs(Zu,{themeName:$e,children:[jsxs("div",{className:g("flex h-full overflow-hidden",U?"flex-row":""),children:[jsxs(DndContext,{sensors:ut,collisionDetection:closestCorners,onDragStart:Ie,onDragOver:dt,onDragEnd:Mt,children:[jsxs("div",{ref:Pe,className:g("asakaa-board",U?"flex-1":"",et,o),style:{...l,cursor:Le?"grabbing":void 0},"data-theme":$e,children:[e.columns.sort((L,Q)=>L.position-Q.position).map(L=>{let Q=Et.get(L.id)||[],R=!Re.includes(L.id),_=a?.renderColumnFooter?.(L);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(Qo,{column:L,cards:Q,renderCard:a?.renderCard,renderColumn:a?.renderColumn,renderHeader:a?.renderColumnHeader,renderEmptyState:a?.renderEmptyState,renderMetrics:De?(ue,ve)=>De(ue,ve):void 0,onCardClick:Be,onCardUpdate:se,onColumnRename:t.onColumnUpdate?_e:void 0,onColumnDelete:t.onColumnDelete?qe:void 0,isDeletable:R,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight}),_]},L.id)}),u]}),jsx(DragOverlay,{children:z.draggedCardId?jsx(An,{card:e.cards.find(L=>L.id===z.draggedCardId),render:a?.renderCardOverlay||a?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),U]}),!B&&jsx(Mo,{task:Ue,isOpen:!!Ue,onClose:()=>ce(null),onCardUpdate:vt,theme:He?"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:Ge,comments:h,onAddComment:b,currentUser:y,mentionableUsers:x,onUploadCommentAttachments:k,enableTimeTracking:M,timeTrackingSummary:I,timeEntries:C,isTimerRunning:N?.isRunning,timerElapsedSeconds:N?.elapsedSeconds,onTimeLog:P,onEstimateUpdate:T,onSoldEffortUpdate:V,onTimerStart:O,onTimerStop:X,onTimerDiscard:F,blurFinancials:Fe})]})}function Ey({columnCount:e}){return jsx(Fragment,{children:Array.from({length:e}).map((t,r)=>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"})]})]},r))})}var Ay={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)"},Iy={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)"},Ry={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},By={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function $y({columns:e,onSelect:t,theme:r,t:a,createTaskLabel:n}){let[s,o]=useState(false),l=useRef(null);useEffect(()=>{let i=u=>{l.current&&!l.current.contains(u.target)&&o(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let c=i=>{t(i),o(false);};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:n||a.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:r.bgSecondary,border:`1px solid ${r.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:r.textTertiary},children:a.selectColumn}),e.sort((i,u)=>i.position-u.position).map((i,u)=>jsxs(motion.button,{onClick:()=>c(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${r.borderLight}`:"none"},whileHover:{backgroundColor:r.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||r.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:r.textPrimary},children:i.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:r.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Oy({theme:e,t,onExportCSV:r,onExportJSON:a,onExportExcel:n}){let[s,o]=useState(false),[l,c]=useState(null),i=useRef(null);if(useEffect(()=>{let m=f=>{i.current&&!i.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]),!(r||a||n))return null;let p=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:r},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:a},{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:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:p.map((m,f)=>jsxs(motion.button,{onClick:()=>d(m.id,m.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:f<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:l===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 Hy({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 Cc({columns:e,onCreateTask:t,createTaskLabel:r,theme:a="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:l,onExportExcel:c,translations:i,toolbarRightContent:u,toolbarEndContent:p}){let d=a==="dark"?Ay:Iy,m={...n==="es"?Ry:By,...i},f=o||l||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:[u&&jsxs(Fragment,{children:[u,jsx("div",{className:"w-px h-5",style:{backgroundColor:d.borderLight}})]}),f&&jsxs(Fragment,{children:[jsx(Oy,{theme:d,t:m,onExportCSV:o,onExportJSON:l,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:d.borderLight}})]}),p,t&&(s?jsx($y,{columns:e,onSelect:t,theme:d,t:m,createTaskLabel:r}):jsx(Hy,{onClick:()=>t(),label:r||m.newTask}))]})})}function Nc({onAddColumn:e,className:t,placeholder:r="Nombre de la columna...",buttonLabel:a="Agregar Columna",disabled:n=false}){let[s,o]=useState(false),[l,c]=useState(""),i=useCallback(()=>{let d=l.trim();d&&(e(d),c(""),o(false));},[l,e]),u=useCallback(d=>{d.key==="Enter"?(d.preventDefault(),i()):d.key==="Escape"&&(c(""),o(false));},[i]),p=useCallback(()=>{setTimeout(()=>{l.trim()||o(false);},150);},[l]);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:l,onChange:d=>c(d.target.value),onKeyDown:u,onBlur:p,placeholder:r,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!l.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{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"})]}),a]})})}function Us({onSubmit:e,onCancel:t,availableUsers:r=[],isDark:a=true,locale:n="es",defaultDate:s,className:o,dropdownDirection:l="up"}){let[c,i]=useState(""),[u,p]=useState(void 0),[d,m]=useState(null),[f,v]=useState(null),[h,b]=useState(false),[y,x]=useState(false),[w,k]=useState(false),[M,I]=useState(s||new Date),C=useRef(null),N=n==="es",P=l==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{C.current?.focus();},[]);let T=useCallback(()=>{b(false),x(false),k(false);},[]),V=useCallback(()=>{i(""),p(void 0),m(null),v(null),T(),t();},[t,T]),O=f||s||new Date,X=useCallback(()=>{let U=c.trim();if(!U)return;let De=r.find(z=>z.id===d),B=O;e({name:U,priority:u,assignee:De||void 0,assigneeId:d,startDate:B,endDate:B}),i(""),p(void 0),m(null),v(null),T(),C.current?.focus();},[c,u,d,O,r,e,T]),F=useCallback(U=>{U.key==="Enter"&&c.trim()&&(U.preventDefault(),X()),U.key==="Escape"&&V();},[X,V,c]),Fe=O;return jsxs("div",{className:g("quick-task-create",o),onClick:()=>T(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:C,type:"text",value:c,onChange:U=>i(U.target.value),placeholder:N?"Nombre de la tarea...":"Task name...",className:g("w-full bg-transparent text-sm outline-none font-mono",a?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:F})}),jsxs("div",{className:g("px-2.5 py-2 flex items-center justify-between border-t",a?"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:U=>{U.stopPropagation(),b(!h),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":a?"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:h&&jsx(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:U=>U.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(U=>jsxs("button",{onClick:()=>{p(U.id),b(false);},type:"button",className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",u===U.id&&(a?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",U.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:U.label})]},U.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:U=>{U.stopPropagation(),k(!w),b(false),x(false),I(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?a?"bg-[#007FFF]/20 text-[#007FFF]":"bg-[#00E5CC]/20 text-[#00C4AE]":a?"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"}),Fe.toLocaleDateString(N?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:w&&jsxs(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:U=>U.stopPropagation(),children:[jsx("div",{className:g("w-40 py-2 border-r",a?"border-white/10":"border-gray-200"),children:(()=>{let U=new Date,De=new Date(U);De.setDate(U.getDate()+1);let B=new Date(U);B.setDate(U.getDate()+((6-U.getDay()+7)%7||7));let z=new Date(U);z.setDate(U.getDate()+((1-U.getDay()+7)%7||7));let Me=new Date(U);Me.setDate(U.getDate()+14);let Ue=new Date(U);Ue.setDate(U.getDate()+28);let ce=N?"es-ES":"en-US";return [{label:N?"Hoy":"Today",date:U,display:U.toLocaleDateString(ce,{weekday:"short"}).slice(0,3)+"."},{label:N?"Ma\xF1ana":"Tomorrow",date:De,display:De.toLocaleDateString(ce,{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:z,display:N?"lun.":"mon."},{label:N?"2 semanas":"2 weeks",date:Me,display:Me.toLocaleDateString(ce,{day:"numeric",month:"short"})},{label:N?"4 semanas":"4 weeks",date:Ue,display:Ue.toLocaleDateString(ce,{day:"numeric",month:"short"})}].map((J,Pe)=>jsxs("button",{type:"button",className:g("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",a?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{v(J.date),k(false);},children:[jsx("span",{children:J.label}),jsx("span",{className:g("text-[10px] font-mono",a?"text-white/30":"text-gray-400"),children:J.display})]},Pe))})()}),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",a?"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:()=>I(new Date),className:g("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",a?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:N?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>I(new Date(M.getFullYear(),M.getMonth()-1)),className:g("p-0.5 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:()=>I(new Date(M.getFullYear(),M.getMonth()+1)),className:g("p-0.5 rounded",a?"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(U=>jsx("div",{className:g("w-6 h-6 flex items-center justify-center text-[10px] font-mono",a?"text-white/30":"text-gray-400"),children:U},U))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let U=M.getFullYear(),De=M.getMonth(),B=new Date(U,De,1).getDay(),z=new Date(U,De+1,0).getDate(),Me=new Date(U,De,0).getDate(),Ue=new Date().toDateString(),ce=[];for(let J=B-1;J>=0;J--)ce.push({dayNum:Me-J,isCurrent:false,date:new Date(U,De-1,Me-J)});for(let J=1;J<=z;J++)ce.push({dayNum:J,isCurrent:true,date:new Date(U,De,J)});let Le=42-ce.length;for(let J=1;J<=Le;J++)ce.push({dayNum:J,isCurrent:false,date:new Date(U,De+1,J)});return ce.map((J,Pe)=>{let Ee=J.date.toDateString()===Ue,$e=(f||s)?.toDateString()===J.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",!J.isCurrent&&(a?"text-white/20":"text-gray-300"),J.isCurrent&&(a?"text-white":"text-gray-900"),Ee&&"ring-1 ring-[#007FFF]",$e&&"bg-[#007FFF] text-white",!$e&&(a?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{v(J.date),k(false);},children:J.dayNum},Pe)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:U=>{U.stopPropagation(),x(!y),b(false),k(false);},type:"button",className:g("p-1 rounded transition-colors",d?"text-[#007FFF] bg-[#007FFF]/20":a?"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:r.find(U=>U.id===d)?.color||"#007FFF"},children:r.find(U=>U.id===d)?.initials||r.find(U=>U.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:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="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",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:U=>U.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",a?"hover:bg-white/5":"hover:bg-gray-50",!d&&(a?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:g("w-5 h-5 rounded-full flex items-center justify-center",a?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:a?"text-white/40":"text-gray-500",children:N?"Sin asignar":"Unassigned"})]}),r.map(U=>jsxs("button",{type:"button",onClick:()=>{m(U.id),x(false);},className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",d===U.id&&(a?"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:U.color||"#007FFF"},children:U.initials||U.name?.slice(0,2).toUpperCase()}),jsx("span",{className:a?"text-white":"text-gray-900",children:U.name})]},U.id)),r.length===0&&jsx("div",{className:g("px-3 py-2 text-xs font-mono",a?"text-white/30":"text-gray-400"),children:N?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:X,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":a?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:N?"Guardar":"Save"})]})]})}function Pc({columnId:e,onAddCard:t,availableUsers:r=[],className:a,buttonLabel:n,disabled:s=false,theme:o="dark",locale:l="es"}){let[c,i]=useState(false),u=useRef(null),p=useRef(null),[d,m]=useState({}),[f,v]=useState(false),h=o==="dark",y={buttonLabel:n||(l==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!c||!u.current)return;let w=90,k=()=>{let M=u.current.getBoundingClientRect(),C=window.innerHeight-M.bottom<w+8;v(C),m({position:"fixed",...C?{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 w=k=>{let M=k.target;p.current&&!p.current.contains(M)&&u.current&&!u.current.contains(M)&&i(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:u,className:g("asakaa-add-card",a),children:[jsxs("button",{onClick:()=>i(!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: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",h?"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(Us,{onSubmit:x,onCancel:()=>i(false),availableUsers:r,isDark:h,locale:l,dropdownDirection:"up"})})}),document.body)]})}var zs=class extends BaseViewAdapter{constructor(r={}){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=r,this.options={animations:r.viewOptions?.animations??true,virtualScrolling:r.viewOptions?.virtualScrolling??false,theme:r.viewOptions?.theme??"dark",readonly:r.viewOptions?.readonly??false};}mount(r,a){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=r,this.data=a,this.root=createRoot(r),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(r){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=r,this.render(),this.emit("view:updated",{viewId:this.id,data:r});}configure(r){this.options={...this.options,...r},this.isMounted()&&this.render();}async export(r){if(!this.data)throw new Error("No data to export");switch(r){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: ${r}`)}}render(){if(!this.root||!this.data)return;let r={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(eo,{board:r,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 r=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(a=>{let n=this.data.columns.find(s=>s.id===a.columnId);r.push([a.id,a.title,n?.title||"",a.description||"",a.labels?.join(", ")||"",a.assignedUserIds?.join(", ")||a.assigneeId||"",a.dueDate?.toString()||"",a.position.toString()]);}),r.map(a=>a.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 a=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((n,s)=>{a.toBlob(o=>{o?n(o):s(new Error("Failed to create PNG blob"));},"image/png");})}};function am(e={}){return new zs(e)}var rs=class extends Component{constructor(r){super(r);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(r){return {hasError:true,error:r}}componentDidCatch(r,a){let{onError:n,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,r),console.error("Error Info:",a)),this.setState({errorInfo:a}),n)try{n(r,a);}catch(o){console.error("Error in error handler:",o);}}render(){let{hasError:r,error:a}=this.state,{children:n,fallback:s,componentName:o}=this.props;return r&&a?s?s(a,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:a.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:a.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 Fc(e,t){let r=a=>jsx(rs,{...t,children:jsx(e,{...a})});return r.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,r}function Ac({board:e,onCreateCard:t,onNavigateToCard:r,onSearch:a,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:l,onOpenAIUsage:c,shortcut:i="k",className:u=""}){let[p,d]=useState(false),[m,f]=useState(""),[v,h]=useState("home"),[b,y]=useState(""),[x,w]=useState("");useEffect(()=>{let C=N=>{(N.metaKey||N.ctrlKey)&&N.key===i&&(N.preventDefault(),d(P=>!P)),N.key==="Escape"&&(d(false),h("home"),f(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i]),useEffect(()=>{p||(h("home"),f(""),y(""),w(""));},[p]);let k=useCallback(()=>{d(false);},[]),M=useCallback(C=>{let[N,P]=C.split(":");switch(N){case "create-card":h("create-card");break;case "create-card-in":y(P||"");break;case "navigate":P?(r?.(P),k()):h("navigate");break;case "search":a?.(m),k();break;case "priority":h("priority");break;case "set-priority":x&&P&&(n?.(x,P),k());break;case "assign":h("assign");break;case "assign-user":x&&P&&(s?.(x,P),k());break;case "ai":h("ai");break;case "ai-generate-plan":o?.(),k();break;case "ai-predict-risks":l?.(),k();break;case "ai-usage":c?.(),k();break;case "back":h("home");break;}},[m,x,t,r,a,n,s,o,l,c,k]),I=useCallback(()=>{b&&m.trim()&&(t?.(b,m.trim()),k());},[b,m,t,k]);return p?jsx(ir,{children:jsx("div",{className:"command-palette-overlay",onClick:k,children:jsx("div",{className:`command-palette ${u}`,onClick:C=>C.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"&&b?"Type card title and press Enter...":v==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&v==="create-card"&&b&&I();}}),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(C=>jsxs(Command.Item,{value:`navigate:${C.id}`,onSelect:M,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsx("span",{children:C.title}),C.labels&&C.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(N=>jsx("span",{className:"command-palette-item-label",children:N},N))})]},C.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(C=>jsxs(Command.Item,{value:`create-card-in:${C.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:C.title}),jsxs("div",{className:"command-palette-item-count",children:[C.cardIds.length," cards"]})]},C.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(C=>{let N=e.columns.find(P=>P.id===C.columnId);return jsxs(Command.Item,{value:`navigate:${C.id}`,onSelect:M,className:"command-palette-item",keywords:[C.title,C.description||"",...C.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:C.title}),jsx("div",{className:"command-palette-item-meta",children:N?.title})]}),C.labels&&C.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(P=>jsx("span",{className:"command-palette-item-label",children:P},P))})]},C.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 sm(e,t,r,a,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",L?"scrollbar-slim":"scrollbar-slim-light"),children:f.length>0?jsx("div",{className:"space-y-4",children:[...f].sort((D,W)=>{let pe=typeof D.createdAt=="string"?new Date(D.createdAt):D.createdAt,ve=typeof W.createdAt=="string"?new Date(W.createdAt):W.createdAt;return pe.getTime()-ve.getTime()}).map(D=>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:D.user?.color||"#8B5CF6"},children:D.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",L?"text-white":"text-gray-900"),children:D.user?.name||(o==="es"?"Usuario":"User")}),jsx("span",{className:g("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:Wa(D.createdAt)})]}),jsx("div",{className:g("text-sm",L?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Np,{content:D.content,theme:s})}),D.attachments&&D.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:D.attachments.map(W=>{let pe=W.type.startsWith("image/");return jsxs("a",{href:W.url,target:"_blank",rel:"noopener noreferrer",className:g("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[pe?jsx(Image,{className:g("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:g("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:g("text-xs truncate max-w-[100px]",L?"text-white":"text-gray-900"),children:W.name})]},W.id)})})]})]},D.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",L?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:g("text-sm",L?"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",L?"border-white/10":"border-gray-200"),children:jsx(Tp,{value:ie,onChange:ce,onSubmit:Aa,users:b,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!v,isSubmitting:He,theme:s,locale:o,currentUser:h,enableEmoji:true,enableAttachments:!!y,pendingFiles:ft,onFilesSelect:et,onRemoveFile:Je})})]})]})]})})}function wc(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(n=>{t(n);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function eo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:n,availableUsers:s=[],className:o,style:l,isLoading:c,error:i,children:u,availableTags:p=[],onCreateTag:d,attachmentsByCard:m,onUploadAttachments:f,onDeleteAttachment:v,comments:h,onAddComment:b,currentUser:y,mentionableUsers:x,onTaskOpen:w,onUploadCommentAttachments:k,enableTimeTracking:M,timeTrackingSummary:I,timeEntries:C,timerState:N,onLogTime:P,onUpdateEstimate:T,onUpdateSoldEffort:V,onStartTimer:O,onStopTimer:J,onDiscardTimer:L,blurFinancials:Ie=false,sidePanel:G,renderColumnMetrics:ke,suppressDetailModal:R=false}){let[U,Pe]=wc(),[Ze,oe]=useState(null),[Fe,Q]=useState(false),Se=useRef(null),Ue=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Le=n?.theme||"dark",Be=Le==="dark"||Le==="neutral",ot=Be?"dark":"",se=useCallback((A,X)=>{t.onCardUpdate?.(A,X);},[t]),je=useCallback((A,X)=>{t.onColumnUpdate?.(A,{title:X});},[t]),Xe=useCallback(A=>{t.onColumnDelete?.(A);},[t]),$e=["todo","in-progress","completed"],mt=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Et=useMemo(()=>{let A=new Map;return e.columns.forEach(X=>{let we=X.cardIds.map(B=>e.cards.find(q=>q.id===B)).filter(B=>B!==void 0).sort((B,q)=>B.position-q.position);A.set(X.id,we);}),A},[e.cards,e.columns]);useEffect(()=>{let A=Se.current;if(!A)return;let X=he=>{let Ae=he.target,ye=he.button===1,tt=Ae===A||Ae.classList.contains("asakaa-column")&&!Ae.closest(".asakaa-card");(ye||he.button===0&&tt&&!U.isDragging)&&(he.preventDefault(),Q(true),Ue.current={x:he.clientX,y:he.clientY,scrollLeft:A.scrollLeft,scrollTop:A.scrollTop},A.style.cursor="grabbing",A.style.userSelect="none");},we=he=>{if(!Fe)return;let Ae=he.clientX-Ue.current.x,ye=he.clientY-Ue.current.y;A.scrollLeft=Ue.current.scrollLeft-Ae,A.scrollTop=Ue.current.scrollTop-ye;},B=()=>{Fe&&(Q(false),A.style.cursor="",A.style.userSelect="");},q=()=>{Fe&&(Q(false),A.style.cursor="",A.style.userSelect="");};return A.addEventListener("mousedown",X),document.addEventListener("mousemove",we),document.addEventListener("mouseup",B),A.addEventListener("mouseleave",q),()=>{A.removeEventListener("mousedown",X),document.removeEventListener("mousemove",we),document.removeEventListener("mouseup",B),A.removeEventListener("mouseleave",q);}},[Fe,U.isDragging]);let st=useMemo(()=>e.cards.map(A=>({id:A.id,name:A.title,startDate:A.startDate?new Date(A.startDate):void 0,endDate:A.endDate?new Date(A.endDate):void 0,progress:A.progress||0,status:A.columnId,priority:A.priority?.toLowerCase(),dependencies:Array.isArray(A.dependencies)?A.dependencies.map(X=>typeof X=="string"?X:X.taskId):[]})),[e.cards]),Ne=useCallback(A=>{let{active:X}=A,we=e.cards.find(B=>B.id===X.id);we&&Pe({isDragging:true,draggedCardId:we.id,sourceColumnId:we.columnId,targetColumnId:we.columnId});},[e.cards,Pe]),lt=useCallback(A=>{let{active:X,over:we}=A;if(!we||!e.cards.find(he=>he.id===X.id))return;let q=null;we.data.current?.type==="column"?q=we.id:we.data.current?.type==="card"&&(q=e.cards.find(Ae=>Ae.id===we.id)?.columnId||null),q&&q!==U.targetColumnId&&Pe({...U,targetColumnId:q});},[e.cards,U,Pe]),Mt=useCallback(async A=>{let{active:X,over:we}=A;if(Pe({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!we)return;let B=e.cards.find(ye=>ye.id===X.id);if(!B)return;let q,he;if(we.data.current?.type==="column"){q=we.id;let ye=Et.get(q)||[];he=rc(ye,0);}else {let ye=e.cards.find(ce=>ce.id===we.id);if(!ye)return;q=ye.columnId;let tt=Et.get(q)||[],ie=tt.findIndex(ce=>ce.id===we.id);he=rc(tt,ie);}let Ae=e.columns.find(ye=>ye.id===q);if(Ae&&Ae.wipLimit&&Ae.wipLimitType==="hard"){let ye=Et.get(q)||[];if(B.columnId!==q&&ye.length>=Ae.wipLimit){t.onWipLimitExceeded?.(Ae,B);return}}(B.columnId!==q||B.position!==he)&&await t.onCardMove?.(B.id,q,he);},[e.cards,e.columns,Et,t,Pe]),Oe=useCallback(A=>{R||oe(A),a?.(A),w?.(A.id);},[a,w,R]),xt=useCallback(A=>{t.onCardUpdate?.(A.id,A),oe(A);},[t]);return c?jsx("div",{className:g("asakaa-board",ot,o),style:l,children:jsx(Py,{columnCount:3})}):i?jsx("div",{className:g("asakaa-board",ot,o),style:l,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxs(Zu,{themeName:Le,children:[jsxs("div",{className:g("flex h-full overflow-hidden",G?"flex-row":""),children:[jsxs(DndContext,{sensors:mt,collisionDetection:closestCorners,onDragStart:Ne,onDragOver:lt,onDragEnd:Mt,children:[jsxs("div",{ref:Se,className:g("asakaa-board",G?"flex-1":"",ot,o),style:{...l,cursor:Fe?"grabbing":void 0},"data-theme":Le,children:[e.columns.sort((A,X)=>A.position-X.position).map(A=>{let X=Et.get(A.id)||[],we=!$e.includes(A.id),B=r?.renderColumnFooter?.(A);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(Qo,{column:A,cards:X,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:ke?(q,he)=>ke(q,he):void 0,onCardClick:Oe,onCardUpdate:se,onColumnRename:t.onColumnUpdate?je:void 0,onColumnDelete:t.onColumnDelete?Xe:void 0,isDeletable:we,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight}),B]},A.id)}),u]}),jsx(DragOverlay,{children:U.draggedCardId?jsx(In,{card:e.cards.find(A=>A.id===U.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),G]}),!R&&jsx(Eo,{task:Ze,isOpen:!!Ze,onClose:()=>oe(null),onCardUpdate:xt,theme:Be?"dark":"light",locale:n?.locale==="es"?"es":"en",availableUsers:s,availableTags:p,onCreateTag:d,attachments:Ze?m?.get(Ze.id)||[]:[],onUploadAttachments:f,onDeleteAttachment:v,availableTasks:st,comments:h,onAddComment:b,currentUser:y,mentionableUsers:x,onUploadCommentAttachments:k,enableTimeTracking:M,timeTrackingSummary:I,timeEntries:C,isTimerRunning:N?.isRunning,timerElapsedSeconds:N?.elapsedSeconds,onTimeLog:P,onEstimateUpdate:T,onSoldEffortUpdate:V,onTimerStart:O,onTimerStop:J,onTimerDiscard:L,blurFinancials:Ie})]})}function Py({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 Ry={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)"},By={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)"},$y={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Oy={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Hy({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:n}){let[s,o]=useState(false),l=useRef(null);useEffect(()=>{let i=u=>{l.current&&!l.current.contains(u.target)&&o(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let c=i=>{t(i),o(false);};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:n||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,u)=>i.position-u.position).map((i,u)=>jsxs(motion.button,{onClick:()=>c(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Uy({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:n}){let[s,o]=useState(false),[l,c]=useState(null),i=useRef(null);if(useEffect(()=>{let m=f=>{i.current&&!i.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:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:p.map((m,f)=>jsxs(motion.button,{onClick:()=>d(m.id,m.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:f<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:l===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 Wy({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 Cc({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:l,onExportExcel:c,translations:i,toolbarRightContent:u,toolbarEndContent:p}){let d=r==="dark"?Ry:By,m={...n==="es"?$y:Oy,...i},f=o||l||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:[u&&jsxs(Fragment,{children:[u,jsx("div",{className:"w-px h-5",style:{backgroundColor:d.borderLight}})]}),f&&jsxs(Fragment,{children:[jsx(Uy,{theme:d,t:m,onExportCSV:o,onExportJSON:l,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:d.borderLight}})]}),p,t&&(s?jsx(Hy,{columns:e,onSelect:t,theme:d,t:m,createTaskLabel:a}):jsx(Wy,{onClick:()=>t(),label:a||m.newTask}))]})})}function Nc({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:n=false}){let[s,o]=useState(false),[l,c]=useState(""),i=useCallback(()=>{let d=l.trim();d&&(e(d),c(""),o(false));},[l,e]),u=useCallback(d=>{d.key==="Enter"?(d.preventDefault(),i()):d.key==="Escape"&&(c(""),o(false));},[i]),p=useCallback(()=>{setTimeout(()=>{l.trim()||o(false);},150);},[l]);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:l,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:i,disabled:!l.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{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 Us({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:n="es",defaultDate:s,className:o,dropdownDirection:l="up"}){let[c,i]=useState(""),[u,p]=useState(void 0),[d,m]=useState(null),[f,v]=useState(null),[h,b]=useState(false),[y,x]=useState(false),[w,k]=useState(false),[M,I]=useState(s||new Date),C=useRef(null),N=n==="es",P=l==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{C.current?.focus();},[]);let T=useCallback(()=>{b(false),x(false),k(false);},[]),V=useCallback(()=>{i(""),p(void 0),m(null),v(null),T(),t();},[t,T]),O=f||s||new Date,J=useCallback(()=>{let G=c.trim();if(!G)return;let ke=a.find(U=>U.id===d),R=O;e({name:G,priority:u,assignee:ke||void 0,assigneeId:d,startDate:R,endDate:R}),i(""),p(void 0),m(null),v(null),T(),C.current?.focus();},[c,u,d,O,a,e,T]),L=useCallback(G=>{G.key==="Enter"&&c.trim()&&(G.preventDefault(),J()),G.key==="Escape"&&V();},[J,V,c]),Ie=O;return jsxs("div",{className:g("quick-task-create",o),onClick:()=>T(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:C,type:"text",value:c,onChange:G=>i(G.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:L})}),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:G=>{G.stopPropagation(),b(!h),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:h&&jsx(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",P,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.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(G=>jsxs("button",{onClick:()=>{p(G.id),b(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===G.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",G.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:G.label})]},G.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:G=>{G.stopPropagation(),k(!w),b(false),x(false),I(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"}),Ie.toLocaleDateString(N?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:w&&jsxs(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",P,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.stopPropagation(),children:[jsx("div",{className:g("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let G=new Date,ke=new Date(G);ke.setDate(G.getDate()+1);let R=new Date(G);R.setDate(G.getDate()+((6-G.getDay()+7)%7||7));let U=new Date(G);U.setDate(G.getDate()+((1-G.getDay()+7)%7||7));let Pe=new Date(G);Pe.setDate(G.getDate()+14);let Ze=new Date(G);Ze.setDate(G.getDate()+28);let oe=N?"es-ES":"en-US";return [{label:N?"Hoy":"Today",date:G,display:G.toLocaleDateString(oe,{weekday:"short"}).slice(0,3)+"."},{label:N?"Ma\xF1ana":"Tomorrow",date:ke,display:ke.toLocaleDateString(oe,{weekday:"short"}).slice(0,3)+"."},{label:N?"Este fin de semana":"This weekend",date:R,display:N?"s\xE1b.":"sat."},{label:N?"Pr\xF3xima semana":"Next week",date:U,display:N?"lun.":"mon."},{label:N?"2 semanas":"2 weeks",date:Pe,display:Pe.toLocaleDateString(oe,{day:"numeric",month:"short"})},{label:N?"4 semanas":"4 weeks",date:Ze,display:Ze.toLocaleDateString(oe,{day:"numeric",month:"short"})}].map((Q,Se)=>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(Q.date),k(false);},children:[jsx("span",{children:Q.label}),jsx("span",{className:g("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:Q.display})]},Se))})()}),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:()=>I(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:()=>I(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:()=>I(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(G=>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:G},G))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let G=M.getFullYear(),ke=M.getMonth(),R=new Date(G,ke,1).getDay(),U=new Date(G,ke+1,0).getDate(),Pe=new Date(G,ke,0).getDate(),Ze=new Date().toDateString(),oe=[];for(let Q=R-1;Q>=0;Q--)oe.push({dayNum:Pe-Q,isCurrent:false,date:new Date(G,ke-1,Pe-Q)});for(let Q=1;Q<=U;Q++)oe.push({dayNum:Q,isCurrent:true,date:new Date(G,ke,Q)});let Fe=42-oe.length;for(let Q=1;Q<=Fe;Q++)oe.push({dayNum:Q,isCurrent:false,date:new Date(G,ke+1,Q)});return oe.map((Q,Se)=>{let Ue=Q.date.toDateString()===Ze,Le=(f||s)?.toDateString()===Q.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",!Q.isCurrent&&(r?"text-white/20":"text-gray-300"),Q.isCurrent&&(r?"text-white":"text-gray-900"),Ue&&"ring-1 ring-[#007FFF]",Le&&"bg-[#007FFF] text-white",!Le&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{v(Q.date),k(false);},children:Q.dayNum},Se)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:G=>{G.stopPropagation(),x(!y),b(false),k(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(G=>G.id===d)?.color||"#007FFF"},children:a.find(G=>G.id===d)?.initials||a.find(G=>G.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:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="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",P,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:G=>G.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(G=>jsxs("button",{type:"button",onClick:()=>{m(G.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===G.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:G.color||"#007FFF"},children:G.initials||G.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:G.name})]},G.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:J,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:N?"Guardar":"Save"})]})]})}function Pc({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:n,disabled:s=false,theme:o="dark",locale:l="es"}){let[c,i]=useState(false),u=useRef(null),p=useRef(null),[d,m]=useState({}),[f,v]=useState(false),h=o==="dark",y={buttonLabel:n||(l==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!c||!u.current)return;let w=90,k=()=>{let M=u.current.getBoundingClientRect(),C=window.innerHeight-M.bottom<w+8;v(C),m({position:"fixed",...C?{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 w=k=>{let M=k.target;p.current&&!p.current.contains(M)&&u.current&&!u.current.contains(M)&&i(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:u,className:g("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>i(!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: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",h?"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(Us,{onSubmit:x,onCancel:()=>i(false),availableUsers:a,isDark:h,locale:l,dropdownDirection:"up"})})}),document.body)]})}var zs=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(eo,{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 rm(e={}){return new zs(e)}var as=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 Fc(e,t){let a=r=>jsx(as,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Ac({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:l,onOpenAIUsage:c,shortcut:i="k",className:u=""}){let[p,d]=useState(false),[m,f]=useState(""),[v,h]=useState("home"),[b,y]=useState(""),[x,w]=useState("");useEffect(()=>{let C=N=>{(N.metaKey||N.ctrlKey)&&N.key===i&&(N.preventDefault(),d(P=>!P)),N.key==="Escape"&&(d(false),h("home"),f(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i]),useEffect(()=>{p||(h("home"),f(""),y(""),w(""));},[p]);let k=useCallback(()=>{d(false);},[]),M=useCallback(C=>{let[N,P]=C.split(":");switch(N){case "create-card":h("create-card");break;case "create-card-in":y(P||"");break;case "navigate":P?(a?.(P),k()):h("navigate");break;case "search":r?.(m),k();break;case "priority":h("priority");break;case "set-priority":x&&P&&(n?.(x,P),k());break;case "assign":h("assign");break;case "assign-user":x&&P&&(s?.(x,P),k());break;case "ai":h("ai");break;case "ai-generate-plan":o?.(),k();break;case "ai-predict-risks":l?.(),k();break;case "ai-usage":c?.(),k();break;case "back":h("home");break;}},[m,x,t,a,r,n,s,o,l,c,k]),I=useCallback(()=>{b&&m.trim()&&(t?.(b,m.trim()),k());},[b,m,t,k]);return p?jsx(ia,{children:jsx("div",{className:"command-palette-overlay",onClick:k,children:jsx("div",{className:`command-palette ${u}`,onClick:C=>C.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"&&b?"Type card title and press Enter...":v==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&v==="create-card"&&b&&I();}}),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(C=>jsxs(Command.Item,{value:`navigate:${C.id}`,onSelect:M,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsx("span",{children:C.title}),C.labels&&C.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(N=>jsx("span",{className:"command-palette-item-label",children:N},N))})]},C.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(C=>jsxs(Command.Item,{value:`create-card-in:${C.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:C.title}),jsxs("div",{className:"command-palette-item-count",children:[C.cardIds.length," cards"]})]},C.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(C=>{let N=e.columns.find(P=>P.id===C.columnId);return jsxs(Command.Item,{value:`navigate:${C.id}`,onSelect:M,className:"command-palette-item",keywords:[C.title,C.description||"",...C.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:C.title}),jsx("div",{className:"command-palette-item-meta",children:N?.title})]}),C.labels&&C.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(P=>jsx("span",{className:"command-palette-item-label",children:P},P))})]},C.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 sm(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;
|
|
@@ -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 i=()=>{o.remove(),document.removeEventListener("keydown",u);},u=p=>{if(p.key==="Escape")i();else if(p.key==="ArrowLeft"&&
|
|
41
|
+
`;let i=()=>{o.remove(),document.removeEventListener("keydown",u);},u=p=>{if(p.key==="Escape")i();else if(p.key==="ArrowLeft"&&a.length>1){let d=r>0?r-1:a.length-1;i(),n(d);}else if(p.key==="ArrowRight"&&a.length>1){let d=r<a.length-1?r+1:0;i(),n(d);}};if(o.onclick=i,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,11 +48,11 @@ 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
|
-
`,p.onclick=f=>f.stopPropagation(),
|
|
51
|
+
`,p.onclick=f=>f.stopPropagation(),a.forEach((f,v)=>{let h=document.createElement("button");h.className=`attachment-lightbox-dot ${v===r?"active":""}`,h.style.cssText=`
|
|
52
52
|
width: 8px !important;
|
|
53
53
|
height: 8px !important;
|
|
54
54
|
border-radius: 50% !important;
|
|
55
|
-
background: ${v===
|
|
55
|
+
background: ${v===r?"white":"rgba(255, 255, 255, 0.3)"} !important;
|
|
56
56
|
border: none !important;
|
|
57
57
|
padding: 0 !important;
|
|
58
58
|
cursor: pointer !important;
|
|
@@ -69,7 +69,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
69
69
|
border: none !important;
|
|
70
70
|
cursor: pointer !important;
|
|
71
71
|
opacity: 0.5 !important;
|
|
72
|
-
`,d.onmouseenter=()=>{d.style.opacity="1";},d.onmouseleave=()=>{d.style.opacity="0.5";},d.onclick=f=>{f.stopPropagation();let v=
|
|
72
|
+
`,d.onmouseenter=()=>{d.style.opacity="1";},d.onmouseleave=()=>{d.style.opacity="0.5";},d.onclick=f=>{f.stopPropagation();let v=r>0?r-1:a.length-1;i(),n(v);};let m=document.createElement("button");m.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",m.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',m.style.cssText=`
|
|
73
73
|
position: absolute !important;
|
|
74
74
|
right: 0 !important;
|
|
75
75
|
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=a<r.length-1?a+1:0;i(),n(v);},o.appendChild(p),o.appendChild(d),o.appendChild(m);}o.appendChild(l),o.appendChild(c),document.body.appendChild(o),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function ex(e){if(e===0)return "0 Bytes";let t=1024,r=["Bytes","KB","MB","GB"],a=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,a)*100)/100+" "+r[a]}function tx(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 Rc(e){return e.startsWith("image/")}function as({attachments:e=[],onUpload:t,onDelete:r,maxSizeMB:a=10,allowedTypes:n,maxFiles:s=10}){let[o,l]=useState(false),[c,i]=useState(false),[u,p]=useState(null),d=useRef(null),m=useRef(e);m.current=e;let f=useCallback((C,N)=>{N.preventDefault(),N.stopPropagation();let P=m.current.filter(O=>Rc(O.type)),T=P.findIndex(O=>O.id===C.id),V=O=>{let X=m.current.filter(Fe=>Rc(Fe.type)),F=X[O];F&&sm(F.url,F.name,X,O,V);};sm(C.url,C.name,P,T,V);},[]),v=useCallback(C=>{let N=[],P=[];return e.length+C.length>s?(P.push(`Maximum ${s} files allowed`),{valid:N,errors:P}):(C.forEach(T=>{if(T.size/1048576>a){P.push(`${T.name} is too large (max ${a}MB)`);return}if(n&&!n.some(O=>T.type.match(O))){P.push(`${T.name} has invalid file type`);return}N.push(T);}),{valid:N,errors:P})},[e.length,s,a,n]),h=useCallback(async C=>{let{valid:N,errors:P}=v(C);if(P.length>0){p(P.join(", ")),setTimeout(()=>p(null),5e3);return}if(N.length!==0){i(true),p(null);try{await t?.(N);}catch(T){p(T instanceof Error?T.message:"Upload failed"),setTimeout(()=>p(null),5e3);}finally{i(false);}}},[v,t]),b=useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(true);},[]),y=useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(false);},[]),x=useCallback(C=>{C.preventDefault(),C.stopPropagation();},[]),w=useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(false);let N=Array.from(C.dataTransfer.files);h(N);},[h]),k=useCallback(C=>{let N=C.target.files?Array.from(C.target.files):[];h(N),d.current&&(d.current.value="");},[h]),M=useCallback(()=>{d.current?.click();},[]),I=useCallback(C=>{confirm("Are you sure you want to delete this attachment?")&&r?.(C);},[r]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${o?"dragging":""} ${c?"uploading":""}`,onDragEnter:b,onDragLeave:y,onDragOver:x,onDrop:w,onClick:M,children:[jsx("input",{ref:d,type:"file",multiple:true,onChange:k,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 ",a,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),u&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(C=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Rc(C.type)&&C.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:N=>f(C,N),title:"Click to view full size",children:[jsx("img",{src:C.thumbnailUrl||C.url,alt:C.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:tx(C.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:C.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:C.name,children:C.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:ex(C.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(C.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>I(C.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"})})})]},C.id))})]})}function cx({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((r,a)=>jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsx("strong",{children:r.value})," cards"]},a))]})}function $c({data:e,title:t="Team Velocity",height:r=300,showAverage:a=true,showPlanned:n=true}){let s=e.map(o=>({...o,average:o.average??e.reduce((l,c)=>l+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:r,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(cx,{})}),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}}),a&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((o,l)=>o+l.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((o,l)=>o+l.completed,0)/e.length).toFixed(1)})]}),n&&e.some(o=>o.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:e.reduce((o,l)=>o+(l.planned||0),0)})]})]})]})}function 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.day}),t.map((r,a)=>jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsx("strong",{children:r.value})," tasks"]},a))]})}function Oc({data:e,title:t="Sprint Burndown",height:r=300,totalTasks:a,useArea:n=false}){let s=a??(e[0]?.ideal||e[0]?.remaining||0),o=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,c=s>0?(s-o)/s*100:0,i=o<=l;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,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(yx,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color: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:i?"#10B981":"#EF4444"},children:o})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Sx={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},gm=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Ex({cx:e,cy:t,midAngle:r,innerRadius:a,outerRadius:n,percent:s}){let o=a+(n-a)*.5,l=e+o*Math.cos(-r*(Math.PI/180)),c=t+o*Math.sin(-r*(Math.PI/180));return s<.05?null:jsx("text",{x:l,y:c,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function fm({active:e,payload:t}){if(!e||!t||!t.length)return null;let r=t[0].payload,a=t[0].payload.totalValue||0,n=a>0?(r.value/a*100).toFixed(1):"0";return jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:r.name}),jsxs("p",{className:"chart-tooltip-value",style:{color:r.color||t[0].color},children:["Count: ",jsx("strong",{children:r.value})]}),jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxs("strong",{children:[n,"%"]})]})]})}function Hc({data:e,title:t="Distribution",type:r="pie",height:a=300,showPercentages:n=true}){let s=e.reduce((c,i)=>c+i.value,0),o=e.map(c=>({...c,totalValue:s,color:c.color||Sx[c.name]||gm[e.indexOf(c)%gm.length]})),l=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:a,children:r==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:o,cx:"50%",cy:"50%",labelLine:false,label:n?Ex:false,outerRadius:a*.35,fill:"#8884d8",dataKey:"value",children:o.map((c,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(fm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let u=i.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(fm,{})}),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,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,i)=>i.value>c.value?i:c).name})]})]})]})}var Ki=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:r,callbacks:a,columns:n=[],availableLabels:s=[]})=>{let[o,l]=useState(false),[c,i]=useState(false),[u,p]=useState(false),[d,m]=useState(false);if(e.length===0)return null;let f=e.map(w=>w.id),v=w=>{a.onBulkUpdate?.(f,{priority:w}),l(false);},h=w=>{a.onBulkMove?.(f,w),i(false),r();},b=w=>{a.onBulkUpdate?.(f,{assignedUserIds:w}),p(false);},y=w=>{let k=new Set;e.forEach(I=>{I.labels?.forEach(C=>k.add(C));});let M=Array.from(new Set([...k,...w]));a.onBulkUpdate?.(f,{labels:M}),m(false);},x=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(a.onBulkDelete?.(f),r());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!o),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),o&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>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:()=>i(!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:()=>h(w.id),children:w.title},w.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(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([w.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>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:r,title:"Clear selection",children:jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});Ki.displayName="BulkOperationsToolbar";function Ax(e,t,r){if(t==="none")return [];let a=new Map;return e.forEach(n=>{let s,o,l,c,i;switch(t){case "assignee":let u=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);u.length>0?u.forEach(m=>{let f=r?.find(v=>v.id===m);o=`assignee-${m}`,l=f?.name||`User ${m}`,c=f?.color,i=f?.avatar,a.has(o)||a.set(o,{id:o,title:l,groupValue:m,cardIds:[],color:c,icon:i}),a.get(o).cardIds.push(n.id);}):(o="assignee-unassigned",l="Unassigned",c="#6b7280",i="\u{1F464}",a.has(o)||a.set(o,{id:o,title:l,groupValue:null,cardIds:[],color:c,icon:i}),a.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];l=d.title,c=d.color,a.has(o)||a.set(o,{id:o,title:l,groupValue:s,cardIds:[],color:c}),a.get(o).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(m=>{o=`label-${m}`,l=m,c="#6b7280",a.has(o)||a.set(o,{id:o,title:l,groupValue:m,cardIds:[],color:c}),a.get(o).cardIds.push(n.id);}):(o="label-none",l="No Labels",c="#6b7280",a.has(o)||a.set(o,{id:o,title:l,groupValue:null,cardIds:[],color:c}),a.get(o).cardIds.push(n.id));break}}),Array.from(a.values()).sort((n,s)=>n.title.localeCompare(s.title))}function Uc({board:e,swimlaneConfig:t,availableUsers:r,callbacks:a,className:n,swimlanes:s,renderSwimlaneHeader:o,renderProps:l,config:c,onCardClick:i,suppressDetailModal:u,availableTags:p,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}),h=useMemo(()=>s||Ax(e.cards,t.groupBy,r),[s,e.cards,t.groupBy,r]),b={callbacks:a,availableUsers:r,renderProps:l,config:c,onCardClick:i,suppressDetailModal:u,availableTags:p,attachmentsByCard:d,renderColumnMetrics:m},y=useCallback(x=>{v(w=>{let k=new Set(w);return k.has(x)?k.delete(x):k.add(x),k});},[]);return !s&&(t.groupBy==="none"||h.length===0)?jsx(eo,{board:e,className:n,...b}):jsxs("div",{className:g("asakaa-swimlane-view",n),children:[h.map(x=>{let w=f.has(x.id),k=e.cards.filter(I=>x.cardIds.includes(I.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: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(eo,{board:M,...b})})]},x.id)}),h.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 Wc=[{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 zc({value:e,onChange:t,className:r}){let[a,n]=useState(false),s=useRef(null),o=useRef(null),l=Wc.find(i=>i.value===e)||Wc[0];useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=i=>{t(i),n(false);};return jsxs("div",{className:g("relative inline-block",r),children:[jsxs("button",{ref:o,onClick:()=>n(!a),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:l.icon}),jsx("span",{children:l.label}),jsx("svg",{className:g("w-4 h-4 transition-transform",a&&"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"})})]}),a&&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:Wc.map(i=>jsxs("button",{onClick:()=>c(i.value),className:g("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsx("span",{className:"text-[#00E5CC] text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Vs=[{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 Bx(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let n=t.modifiers||{},s=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,o=n.shift?e.shiftKey:!e.shiftKey,l=n.alt?e.altKey:!e.altKey,c=n.meta?e.metaKey:true;return s&&o&&l&&c}function vm(e={}){let{shortcuts:t=Vs,enabled:r=true,preventDefault:a=true}=e,n=useRef(t),s=useRef(r);useEffect(()=>{n.current=t,s.current=r;},[t,r]);let o=useCallback(c=>{n.current=[...n.current,c];},[]),l=useCallback(c=>{n.current=n.current.filter(i=>i.action!==c);},[]);return useEffect(()=>{function c(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let p of n.current)if(Bx(i,p)){a&&i.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)},[a]),{registerShortcut:o,unregisterShortcut:l,isEnabled:r}}function Ox(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Hx(e){let t=[],r=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(r?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(r?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function Ux(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,r=Hx(e),a=t?Ox(t):"";return r?`${r} + ${a}`:a}function Wx(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(r=>{r.action.includes("navigate")?t.Navigation?.push(r):r.action.includes("select")?t.Selection?.push(r):["undo","redo","save"].includes(r.action)?t.Editing?.push(r):t.Actions?.push(r);}),t}function Gc({shortcuts:e=Vs,isOpen:t,onClose:r,className:a}){let[n,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function l(c){c.key==="Escape"&&t&&r();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,r]),!n||!t)return null;let o=Wx(e);return jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:r}),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:r,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(o).map(([l,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"}),l]}),jsx("div",{className:"space-y-3",children:c.map(i=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:Ux(i)})]},i.action))})]},l))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Vc=[{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;i(),n(v);},o.appendChild(p),o.appendChild(d),o.appendChild(m);}o.appendChild(l),o.appendChild(c),document.body.appendChild(o),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function ax(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 rx(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 Rc(e){return e.startsWith("image/")}function rs({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:n,maxFiles:s=10}){let[o,l]=useState(false),[c,i]=useState(false),[u,p]=useState(null),d=useRef(null),m=useRef(e);m.current=e;let f=useCallback((C,N)=>{N.preventDefault(),N.stopPropagation();let P=m.current.filter(O=>Rc(O.type)),T=P.findIndex(O=>O.id===C.id),V=O=>{let J=m.current.filter(Ie=>Rc(Ie.type)),L=J[O];L&&sm(L.url,L.name,J,O,V);};sm(C.url,C.name,P,T,V);},[]),v=useCallback(C=>{let N=[],P=[];return e.length+C.length>s?(P.push(`Maximum ${s} files allowed`),{valid:N,errors:P}):(C.forEach(T=>{if(T.size/1048576>r){P.push(`${T.name} is too large (max ${r}MB)`);return}if(n&&!n.some(O=>T.type.match(O))){P.push(`${T.name} has invalid file type`);return}N.push(T);}),{valid:N,errors:P})},[e.length,s,r,n]),h=useCallback(async C=>{let{valid:N,errors:P}=v(C);if(P.length>0){p(P.join(", ")),setTimeout(()=>p(null),5e3);return}if(N.length!==0){i(true),p(null);try{await t?.(N);}catch(T){p(T instanceof Error?T.message:"Upload failed"),setTimeout(()=>p(null),5e3);}finally{i(false);}}},[v,t]),b=useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(true);},[]),y=useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(false);},[]),x=useCallback(C=>{C.preventDefault(),C.stopPropagation();},[]),w=useCallback(C=>{C.preventDefault(),C.stopPropagation(),l(false);let N=Array.from(C.dataTransfer.files);h(N);},[h]),k=useCallback(C=>{let N=C.target.files?Array.from(C.target.files):[];h(N),d.current&&(d.current.value="");},[h]),M=useCallback(()=>{d.current?.click();},[]),I=useCallback(C=>{confirm("Are you sure you want to delete this attachment?")&&a?.(C);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${o?"dragging":""} ${c?"uploading":""}`,onDragEnter:b,onDragLeave:y,onDragOver:x,onDrop:w,onClick:M,children:[jsx("input",{ref:d,type:"file",multiple:true,onChange:k,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"]})]})})]}),u&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(C=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Rc(C.type)&&C.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:N=>f(C,N),title:"Click to view full size",children:[jsx("img",{src:C.thumbnailUrl||C.url,alt:C.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:rx(C.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:C.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:C.name,children:C.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:ax(C.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(C.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>I(C.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"})})})]},C.id))})]})}function ux({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 $c({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:n=true}){let s=e.map(o=>({...o,average:o.average??e.reduce((l,c)=>l+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(ux,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),n&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#00E5CC",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#00E5CC",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((o,l)=>o+l.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((o,l)=>o+l.completed,0)/e.length).toFixed(1)})]}),n&&e.some(o=>o.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:e.reduce((o,l)=>o+(l.planned||0),0)})]})]})]})}function vx({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 Oc({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:n=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),o=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,c=s>0?(s-o)/s*100:0,i=o<=l;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(n?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(vx,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color: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:i?"#10B981":"#EF4444"},children:o})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Mx={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},gm=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Px({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:n,percent:s}){let o=r+(n-r)*.5,l=e+o*Math.cos(-a*(Math.PI/180)),c=t+o*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:l,y:c,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function fm({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 Hc({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:n=true}){let s=e.reduce((c,i)=>c+i.value,0),o=e.map(c=>({...c,totalValue:s,color:c.color||Mx[c.name]||gm[e.indexOf(c)%gm.length]})),l=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?Px:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:o.map((c,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(fm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let u=i.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(fm,{})}),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,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,i)=>i.value>c.value?i:c).name})]})]})]})}var Ki=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:n=[],availableLabels:s=[]})=>{let[o,l]=useState(false),[c,i]=useState(false),[u,p]=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}),l(false);},h=w=>{r.onBulkMove?.(f,w),i(false),a();},b=w=>{r.onBulkUpdate?.(f,{assignedUserIds:w}),p(false);},y=w=>{let k=new Set;e.forEach(I=>{I.labels?.forEach(C=>k.add(C));});let M=Array.from(new Set([...k,...w]));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:()=>l(!o),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),o&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>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:()=>i(!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:()=>h(w.id),children:w.title},w.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(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([w.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>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"})})]})]})})});Ki.displayName="BulkOperationsToolbar";function Rx(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(n=>{let s,o,l,c,i;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}`,l=f?.name||`User ${m}`,c=f?.color,i=f?.avatar,r.has(o)||r.set(o,{id:o,title:l,groupValue:m,cardIds:[],color:c,icon:i}),r.get(o).cardIds.push(n.id);}):(o="assignee-unassigned",l="Unassigned",c="#6b7280",i="\u{1F464}",r.has(o)||r.set(o,{id:o,title:l,groupValue:null,cardIds:[],color:c,icon:i}),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];l=d.title,c=d.color,r.has(o)||r.set(o,{id:o,title:l,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}`,l=m,c="#6b7280",r.has(o)||r.set(o,{id:o,title:l,groupValue:m,cardIds:[],color:c}),r.get(o).cardIds.push(n.id);}):(o="label-none",l="No Labels",c="#6b7280",r.has(o)||r.set(o,{id:o,title:l,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 Uc({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:n,swimlanes:s,renderSwimlaneHeader:o,renderProps:l,config:c,onCardClick:i,suppressDetailModal:u,availableTags:p,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}),h=useMemo(()=>s||Rx(e.cards,t.groupBy,a),[s,e.cards,t.groupBy,a]),b={callbacks:r,availableUsers:a,renderProps:l,config:c,onCardClick:i,suppressDetailModal:u,availableTags:p,attachmentsByCard:d,renderColumnMetrics:m},y=useCallback(x=>{v(w=>{let k=new Set(w);return k.has(x)?k.delete(x):k.add(x),k});},[]);return !s&&(t.groupBy==="none"||h.length===0)?jsx(eo,{board:e,className:n,...b}):jsxs("div",{className:g("asakaa-swimlane-view",n),children:[h.map(x=>{let w=f.has(x.id),k=e.cards.filter(I=>x.cardIds.includes(I.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: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(eo,{board:M,...b})})]},x.id)}),h.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 Wc=[{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 zc({value:e,onChange:t,className:a}){let[r,n]=useState(false),s=useRef(null),o=useRef(null),l=Wc.find(i=>i.value===e)||Wc[0];useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=i=>{t(i),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:l.icon}),jsx("span",{children:l.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:Wc.map(i=>jsxs("button",{onClick:()=>c(i.value),className:g("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsx("span",{className:"text-[#00E5CC] text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Vs=[{keys:"ArrowUp",action:"navigate_up",description:"Navigate to card above"},{keys:"ArrowDown",action:"navigate_down",description:"Navigate to card below"},{keys:"ArrowLeft",action:"navigate_left",description:"Navigate to previous column"},{keys:"ArrowRight",action:"navigate_right",description:"Navigate to next column"},{keys:"Enter",action:"open_card",description:"Open selected card"},{keys:"Escape",action:"close_modal",description:"Close modal or dialog"},{keys:"Delete",action:"delete_card",description:"Delete selected card",modifiers:{shift:true}},{keys:"n",action:"new_card",description:"Create new card",modifiers:{ctrl:true}},{keys:"k",action:"search",description:"Open search/command palette",modifiers:{ctrl:true}},{keys:"s",action:"save",description:"Save changes",modifiers:{ctrl:true}},{keys:"z",action:"undo",description:"Undo last action",modifiers:{ctrl:true}},{keys:"y",action:"redo",description:"Redo last undone action",modifiers:{ctrl:true}},{keys:"a",action:"select_all",description:"Select all cards",modifiers:{ctrl:true}},{keys:"Escape",action:"deselect_all",description:"Deselect all cards"},{keys:"?",action:"show_shortcuts",description:"Show keyboard shortcuts help",modifiers:{shift:true}}];function Ox(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let n=t.modifiers||{},s=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,o=n.shift?e.shiftKey:!e.shiftKey,l=n.alt?e.altKey:!e.altKey,c=n.meta?e.metaKey:true;return s&&o&&l&&c}function vm(e={}){let{shortcuts:t=Vs,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];},[]),l=useCallback(c=>{n.current=n.current.filter(i=>i.action!==c);},[]);return useEffect(()=>{function c(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let p of n.current)if(Ox(i,p)){r&&i.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:l,isEnabled:a}}function Ux(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Wx(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 zx(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Wx(e),r=t?Ux(t):"";return a?`${a} + ${r}`:r}function Gx(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 Gc({shortcuts:e=Vs,isOpen:t,onClose:a,className:r}){let[n,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function l(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!n||!t)return null;let o=Gx(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(([l,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"}),l]}),jsx("div",{className:"space-y-3",children:c.map(i=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:zx(i)})]},i.action))})]},l))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Vc=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
86
86
|
1.
|
|
87
87
|
|
|
88
88
|
**Expected behavior:**
|
|
@@ -122,13 +122,13 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
122
122
|
1.
|
|
123
123
|
|
|
124
124
|
**Action items:**
|
|
125
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function jc({templates:e,onSelectTemplate:t,className:r}){let[a,n]=useState(false),s=useRef(null),o=useRef(null);useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let l=i=>{t(i),n(false);},c=e.reduce((i,u)=>{let p=u.category||"Other";return i[p]||(i[p]=[]),i[p].push(u),i},{});return jsxs("div",{className:g("relative inline-block",r),children:[jsxs("button",{ref:o,onClick:()=>n(!a),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:g("w-4 h-4 transition-transform",a&&"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"})})]}),a&&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(([i,u])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:u.map(p=>jsxs("button",{onClick:()=>l(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))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Kc({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:s}){let[o,l]=useState("export"),[c,i]=useState("json"),[u,p]=useState(null),d=useRef(null);if(!t)return null;let m=async()=>{let v=n?.current||void 0,h=await _u(e,c,v);Ku(h,c);},f=async v=>{let h=v.target.files?.[0];if(h){try{let b=await Xu(h),y=h.name.endsWith(".json")?"json":"csv",x=Yu(b,y);p(x),x.success&&a&&a(x,b);}catch(b){p({success:false,errors:[`Failed to read file: ${b instanceof Error?b.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:r}),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:r,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>l("export"),className: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:()=>l("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:()=>i(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,h)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",v]},h))})]})]})]})]})]})}var _x=["URGENT","HIGH","MEDIUM","LOW"],Kx=[{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"}],qx=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function qc({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:p=true,compact:d=false,groupBy:m="none",onGroupByChange:f}){let[v,h]=useState(true),b=useCallback(M=>{r({search:M.target.value});},[r]),y=useCallback(M=>{r({dateFilter:M.target.value});},[r]),x=useCallback(M=>{a({by:M.target.value});},[a]),w=useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),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:()=>h(!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"}),l&&jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange: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:M=>{let I=M.target.value;r({priorities:I==="all"?[]:[I]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),_x.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 I=M.target.value;r({assignees:I==="all"?[]:[I]});},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))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:M=>{let I=M.target.value;r({labels:I==="all"?[]:[I]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.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:Kx.map(M=>jsx("option",{value:M.value,children:M.label},M.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:M=>f(M.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:qx.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 Yc({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,u]=useState(false),p=useRef(null);useEffect(()=>{let m=f=>{p.current&&!p.current.contains(f.target)&&u(false);};return i&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[i]);let d=m=>{m(),u(false);};return jsxs("div",{className:g("relative",a),ref:p,children:[jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxs("button",{onClick:()=>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 l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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(r),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 Xc={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"}},Jc={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"}},Qc={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"}},Fo={dark:Xc,light:Jc,neutral:Qc},Yi="dark";var Xi=createContext(void 0),nv="asakaa-theme";function Cm({children:e,defaultTheme:t=Yi,storageKey:r=nv}){let[a,n]=useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(r);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=useCallback(l=>{n(l),typeof window<"u"&&localStorage.setItem(r,l);},[r]);useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=Fo[a];Object.entries(c.colors).forEach(([u,p])=>{p&&l.style.setProperty(`--theme-${ov(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&&l.style.setProperty(p,d);}),l.setAttribute("data-theme",a),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${a}`);},[a]);let o={theme:a,setTheme:s,themes:Fo};return jsx(Xi.Provider,{value:o,children:e})}function ss(){let e=useContext(Xi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function ov(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Zc({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=ss();return e?jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick: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(Fo).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",a===s?"border-[#00E5CC] bg-[#00E5CC]/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:a===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"]})]}),a===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 ct={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 Tm(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ct[e]||ct.dark;let t=document.documentElement,r=getComputedStyle(t),a=(s,o)=>r.getPropertyValue(s).trim()||o;return {bgPrimary:a("--theme-bg-primary",ct[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",ct[e].bgSecondary),bgGrid:a("--theme-bg-card",ct[e].bgGrid),bgWeekend:a("--theme-bg-hover",ct[e].bgWeekend),border:a("--theme-border-primary",ct[e].border),borderLight:a("--theme-border-subtle",ct[e].borderLight),textPrimary:a("--theme-text-primary",ct[e].textPrimary),textSecondary:a("--theme-text-secondary",ct[e].textSecondary),textTertiary:a("--theme-text-tertiary",ct[e].textTertiary),accent:a("--theme-accent-primary",ct[e].accent),accentHover:a("--theme-accent-hover",ct[e].accentHover),accentLight:a("--theme-accent-primary",ct[e].accentLight),taskBarPrimary:a("--theme-accent-primary",ct[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",ct[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",ct[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",ct[e].dependency),dependencyHover:a("--theme-border-secondary",ct[e].dependencyHover),criticalPath:a("--theme-error",ct[e].criticalPath),criticalPathLight:a("--theme-error",ct[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",ct[e].today):e==="neutral"?a("--theme-text-primary",ct[e].today):a("--theme-error",ct[e].today),todayLight:e==="light"?a("--theme-accent-primary",ct[e].todayLight):e==="neutral"?a("--theme-text-primary",ct[e].todayLight):a("--theme-error",ct[e].todayLight),milestone:a("--theme-warning",ct[e].milestone),milestoneLight:a("--theme-warning",ct[e].milestoneLight),statusTodo:a("--theme-text-tertiary",ct[e].statusTodo),statusInProgress:a("--theme-accent-primary",ct[e].statusInProgress),statusCompleted:a("--theme-success",ct[e].statusCompleted),hoverBg:a("--theme-bg-hover",ct[e].hoverBg),focusRing:a("--theme-accent-primary",ct[e].focusRing),...ct[e].dotGrid&&{dotGrid:ct[e].dotGrid},...ct[e].glassHeader&&{glassHeader:ct[e].glassHeader},...ct[e].glassToolbar&&{glassToolbar:ct[e].glassToolbar},...ct[e].forecastHud&&{forecastHud:ct[e].forecastHud},...ct[e].neonRedGlow&&{neonRedGlow:ct[e].neonRedGlow},...ct[e].executionBarBg&&{executionBarBg:ct[e].executionBarBg}}}var Ji={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Nm={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},ed={en:Ji,es:Nm};function Dm(e){return ed[e]||ed.en}function td(e,t){let r=Dm(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},contextMenu:{...r.contextMenu,...t.contextMenu},actions:{...r.actions,...t.actions},status:{...r.status,...t.status},labels:{...r.labels,...t.labels},ai:{...r.ai,...t.ai,suggestions:{...r.ai.suggestions,...t.ai?.suggestions},errors:{...r.ai.errors,...t.ai?.errors}},export:{...r.export,...t.export},dateFormat:{...r.dateFormat,...t.dateFormat}}:r}var ls=createContext(Ji);function _a(){return useContext(ls)}function Ks(e,t,r="left",a=208){let[n,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),l=o.bottom+4,c;r==="right"?c=o.right-a:c=o.left;let i=8;c+a>window.innerWidth-i&&(c=window.innerWidth-i-a),c<i&&(c=i),s({top:l,left:c});},[t,r,e,a]),n}function Im({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[l,c]=useState(false),[i,u]=useState(null),p=useRef(null),d=useRef(null),m=_a(),f=Ks(p,l,"right",176);if(useEffect(()=>{if(!l)return;let y=x=>{let w=x.target;p.current&&!p.current.contains(w)&&d.current&&!d.current.contains(w)&&c(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[l]),!(t||r||a||n||s||o))return null;let h=[{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:r},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:a},{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),b=async(y,x)=>{if(x){u(y);try{await x();}catch(w){console.error(`Export ${y} failed:`,w);}finally{u(null),c(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:p,onClick:()=>c(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:m.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:l&&jsx(motion.div,{ref: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:h.map((y,x)=>jsxs(motion.button,{onClick:()=>b(y.id,y.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<h.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:i===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 rd({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportMSProject:n,onCopySnapshotLink:s}){let[o,l]=useState(false),[c,i]=useState(null),[u,p]=useState(false),d=useRef(null),m=useRef(null),f=_a(),v=Ks(d,o,"right",224),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=f.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!o)return;let k=M=>{let I=M.target;d.current&&!d.current.contains(I)&&m.current&&!m.current.contains(I)&&l(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[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:r},{id:"excel",label:f.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:a},{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){i(k);try{await M();}catch(I){console.error(`Export ${k} failed:`,I);}finally{i(null),l(false);}}},w=()=>{s?.(),p(true),setTimeout(()=>p(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:d,onClick:()=>l(!o),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:o?e.accent:e.textTertiary,backgroundColor:o?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:f.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:o&&jsxs(motion.div,{ref: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: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:[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:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:y.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:h?"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))})]}),y.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"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:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:w,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color: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*.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 Sv({options:e,value:t,onChange:r,theme:a,layoutId:n="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`},children:e.map(s=>{let o=t===s.value;return jsxs(motion.button,{onClick:()=>r(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?a.textPrimary:a.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:a.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":a.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:s.label})]},s.value)})})}function Ev({options:e,value:t,onChange:r,theme:a}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(n=>{let s=t===n.value;return jsxs(motion.button,{onClick:()=>r(n.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?a.accent:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?a.accent:a.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:a.accent},transition:{type:"spring",stiffness:400,damping:30}})]},n.value)})})}function ad({theme:e,value:t,onChange:r,maxDepth:a}){let[n,s]=useState(false),o=useRef(null),l=useRef(null),c=_a(),i=Ks(o,n,"left");useEffect(()=>{if(!n)return;let d=m=>{let f=m.target;o.current&&!o.current.contains(f)&&l.current&&!l.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(a,5)},(d,m)=>({value:m+1,label:`L${m+1}`}))],p=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"}: ${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:l,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:u.map((d,m)=>{let f=t===d.value;return jsxs(motion.button,{onClick:()=>{r(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 nd({theme:e,value:t,onChange:r,hideCompleted:a=false,onHideCompletedChange:n}){let[s,o]=useState(false),l=useRef(null),c=useRef(null),i=_a(),u=Ks(l,s,"left");useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let v=b=>{let y=b.target;l.current&&!l.current.contains(y)&&c.current&&!c.current.contains(y)&&o(false);},h=b=>{b.key==="Escape"&&o(false);};document.addEventListener("mousedown",v),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(f),c._cleanup&&c._cleanup();}},[s]);let p=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],d=t!=="all"||a,m=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:l,onClick:f=>{f.stopPropagation(),o(v=>!v);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:d?m?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${d?m?"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:i.toolbar.filter||"Filters"}),d&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#00E5CC"}})]}),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:m?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${m?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:m?"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:m?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:m?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:p.map(f=>{let v=t===f.value&&!a,h=()=>f.value==="all"?v?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):f.icon;return jsxs(motion.button,{onClick:()=>{r(f.value),n&&n(false),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:v?m?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:m?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${v?f.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:m?"rgba(255,255,255,0.85)":"#111827"},children:f.label}),v&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},f.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:m?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),n&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{n(!a),a||r("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:a?m?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:m?"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:a?"#00E5CC":m?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:m?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),a&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function Em({value:e,onChange:t,theme:r}){let a=_a(),n=r.bgPrimary==="#050505"||r.textPrimary==="#FFFFFF",s=[{value:"day",label:a.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:a.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:a.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":r.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":r.border}`},children:s.map(o=>{let l=e===o.value;return jsx(motion.button,{onClick:()=>t(o.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:l?n?"#FFFFFF":r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:l?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":r.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function Mv({theme:e,forecast:t}){let r=_a(),a=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",n=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,o=s!=null,l=s!=null?s>0?`+${s}d ${r.toolbar.delayLabel}`:s<0?`${s}d ${r.toolbar.earlyLabel}`:r.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:a?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:a?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:a?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:a?"#22C55E":"#16A34A"}:{bg:a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,u=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,p=t?.costAtCompletion,d=t?.currency||"$",m=p!=null?p>=1e6?`${d}${(p/1e6).toFixed(2)}M`:p>=1e3?`${d}${(p/1e3).toFixed(1)}K`:`${d}${p.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,v=f!=null&&f!==0,h=f!=null?f>0?`+${f.toFixed(0)}% ${r.toolbar.budgetOver}`:`${f.toFixed(0)}% ${r.toolbar.budgetUnder}`:null,b=f!=null&&f>0?{bg:a?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:a?"#EF4444":"#DC2626"}:f!=null&&f<0?{bg:a?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:a?"#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||(a?"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,": ",n]}),o&&l&&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: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:u,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:a?"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:m}),v&&h&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:b.bg,color:b.text,fontFamily:"'JetBrains Mono', monospace"},children:h})]})]})]})}function Mm({theme:e,showCriticalPath:t,onShowCriticalPathChange:r,showBaseline:a,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:l,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:u,hasDependencies:p=true}){let[d,m]=useState(false),f=useRef(null),v=useRef(null),h=_a(),b=Ks(f,d,"right",208),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!d)return;let M=I=>{let C=I.target;f.current&&!f.current.contains(C)&&v.current&&!v.current.contains(C)&&m(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[d]);let x=h.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:x?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:r,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:a,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:l,onChange:c}],k=[{value:"compact",label:h.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:h.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:h.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:b.top,left:b.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:h.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:w.map((M,I)=>{let C=M.icon,N=M.disabled,P=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?y?"rgba(255,255,255,0.3)":"#9CA3AF":y?"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:I*.03},title:P,children:[jsx(C,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:N?y?"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: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:h.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),k.map((M,I)=>{let C=i===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: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+I)*.03},children:[jsx("span",{style:{color:C?e.accent||"#00E5CC":y?"rgba(255,255,255,0.85)":e.textPrimary},children:M.label}),C&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.value)})]})]})}),document.body)]})}function Pv({theme:e,etiqueta:t,children:r}){let[a,n]=useState(false),s=useRef(null);return useEffect(()=>{if(!a)return;let o=c=>{s.current&&!s.current.contains(c.target)&&n(false);},l=c=>{c.key==="Escape"&&n(false);};return document.addEventListener("mousedown",o),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",l);}},[a]),jsxs("div",{ref:s,className:"relative",children:[jsx("button",{type:"button",onClick:()=>n(o=>!o),"aria-label":t,"aria-expanded":a,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"}),a&&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:r})]})}function Qi({enCabecera:e=false,theme:t,timeScale:r,onTimeScaleChange:a,zoom:n,onZoomChange:s,currentTheme:o,onThemeChange:l,rowDensity:c,onRowDensityChange:i,showThemeSelector:u=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:m,taskFilter:f="all",onTaskFilterChange:v,hideCompleted:h=false,onHideCompletedChange:b,toolbarRightContent:y,wbsLevel:x,onWbsLevelChange:w,maxWbsDepth:k=4,viewMode:M="execution",onViewModeChange:I,projectForecast:C,hideForecastHud:N,onExportPNG:P,onExportPDF:T,onExportExcel:V,onExportCSV:O,onExportJSON:X,onExportMSProject:F,showCriticalPath:Fe=true,onShowCriticalPathChange:U,showDependencies:De=true,onShowDependenciesChange:B,highlightWeekends:z=true,onHighlightWeekendsChange:Me,showBaseline:Ue=false,onShowBaselineChange:ce,onCopySnapshotLink:Le,hasDependencies:J=true}){let Pe=_a(),Ee=P||T||V||O||X||F,$e=!!t.glassToolbar,He=[{value:"day",label:Pe.toolbar.day},{value:"week",label:Pe.toolbar.week},{value:"month",label:Pe.toolbar.month}],et=[{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"})}],se=t.bgPrimary==="#050505"||t.textPrimary==="#FFFFFF";if(e)return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Em,{value:r,onChange:a,theme:t}),v&&jsx(nd,{theme:t,value:f,onChange:v,hideCompleted:h,onHideCompletedChange:b}),y,jsx(Mm,{theme:t,showCriticalPath:Fe,onShowCriticalPathChange:U,showBaseline:Ue,onShowBaselineChange:ce,highlightWeekends:z,onHighlightWeekendsChange:Me,showDependencies:De,onShowDependenciesChange:B,rowDensity:c,onRowDensityChange:i,hasDependencies:J}),jsx(rd,{theme:t,onExportPNG:P,onExportPDF:T,onExportExcel:V,onExportMSProject:F,onCopySnapshotLink:Le}),(I||w)&&jsxs(Pv,{theme:t,etiqueta:Pe.toolbar.today==="Hoy"?"M\xE1s opciones":"More options",children:[I&&jsx("div",{className:"flex flex-col gap-1",children:["execution","oracle"].map(_e=>jsxs("button",{type:"button",onClick:()=>I(_e),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===_e?se?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.05)":"transparent"},children:[_e==="execution"?Pe.toolbar.viewExecution:Pe.toolbar.viewOracle,M===_e&&jsx(Check,{className:"w-3.5 h-3.5"})]},_e))}),w&&jsx("div",{className:"pt-1 mt-1",style:{borderTop:`1px solid ${t.borderLight}`},children:jsx(ad,{theme:t,value:x??"all",onChange:w,maxDepth:k})})]})]});if($e){let _e=se?"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:I&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:se?"#000000":t.bgSecondary,border:`1px solid ${se?"rgba(255,255,255,0.08)":t.border}`},children:[jsx(motion.button,{onClick:()=>I("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:M==="execution"?se?"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:Pe.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>I("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:M==="oracle"?se?"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:Pe.toolbar.viewOracle})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Em,{value:r,onChange:a,theme:t}),jsx("div",{className:"w-px h-5",style:{backgroundColor:_e}}),w&&jsx(ad,{theme:t,value:x??"all",onChange:w,maxDepth:k}),v&&jsx(nd,{theme:t,value:f,onChange:v,hideCompleted:h,onHideCompletedChange:b}),y&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:_e}}),y]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:_e}}),jsx(Mm,{theme:t,showCriticalPath:Fe,onShowCriticalPathChange:U,showBaseline:Ue,onShowBaselineChange:ce,highlightWeekends:z,onHighlightWeekendsChange:Me,showDependencies:De,onShowDependenciesChange:B,rowDensity:c,onRowDensityChange:i,hasDependencies:J}),jsx(rd,{theme:t,onExportPNG:P,onExportPDF:T,onExportExcel:V,onExportMSProject:F,onCopySnapshotLink:Le}),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 ${se?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${se?"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||Pe.toolbar.createTask})]})]})]}),C&&!N&&jsx(Mv,{theme:t,forecast:C})]})}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(Ev,{options:He,value:r,onChange:_e=>a(_e),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(ad,{theme:t,value:x??"all",onChange:w,maxDepth:k}),v&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),jsx(nd,{theme:t,value:f,onChange:v,hideCompleted:h,onHideCompletedChange:b})]})]}),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}})]}),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||Pe.toolbar.createTask})]}),(Ee||u)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}})]}),jsx(rd,{theme:t,onExportPNG:P,onExportPDF:T,onExportExcel:V,onExportMSProject:F,onCopySnapshotLink:Le}),u&&jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}}),u&&jsx(Sv,{options:et,value:o,onChange:_e=>l(_e),theme:t})]})]})}function Zi({columns:e,onToggleColumn:t,theme:r}){let[a,n]=useState(false),[s,o]=useState({x:0,y:0}),l=useRef(null),c=useRef(null);useEffect(()=>{if(!a)return;let u=p=>{l.current&&!l.current.contains(p.target)&&n(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[a]);let i=e.filter(u=>u.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:c,onClick:()=>{if(!a&&c.current){let u=c.current.getBoundingClientRect();o({x:u.left,y:u.bottom+4});}n(!a);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`,color:r.textSecondary},whileHover:{backgroundColor:r.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:a&&jsx(ir,{children:jsx(motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:r.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:u.label}),u.visible&&jsx(Check,{className:"w-4 h-4",style:{color:r.accent}})]},u.id))]})})})})]})}function cs({isOpen:e,x:t,y:r,items:a,onClose:n,theme:s}){let o=useRef(null),[l,c]=useState({x:t,y:r});if(useEffect(()=>{if(!e)return;let u=200,p=a.length*36+8,d=8,m=window.innerWidth,f=window.innerHeight,v=t,h=r;t+u+d>m&&(v=t-u,v<d&&(v=d)),r+p+d>f&&(h=f-p-d,h<d&&(h=d)),c({x:v,y:h});},[e,t,r,a.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 i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:o,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:a.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 ar={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 Wm({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:p,enableKeyboard:d=true}){let m=useRef(false),f=useCallback(x=>{m.current=x;},[]),v=useCallback(x=>{let w=[],k=M=>{for(let I of M)w.push(I),I.subtasks&&I.subtasks.length>0&&I.isExpanded&&k(I.subtasks);};return k(x),w},[]),h=useCallback(()=>{let x=v(e);for(let w of x)if(t.has(w.id))return w;return null},[e,t,v]),b=useCallback((x,w)=>{let k=v(e);if(k.length===0)return;let M=h();if(!M){r(k[0].id,false);return}let I=k.findIndex(P=>P.id===M.id);if(I===-1)return;let C=x==="up"?I-1:I+1;if(C<0||C>=k.length)return;let N=k[C];r(N.id,w);},[e,h,v,r]),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 I=navigator.platform.toUpperCase().indexOf("MAC")>=0?x.metaKey:x.ctrlKey,C=Array.from(t),N=h();if(x.key==="ArrowUp"){x.preventDefault(),b("up",x.shiftKey);return}if(x.key==="ArrowDown"){x.preventDefault(),b("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")){C.length>0&&(x.preventDefault(),o(C,x.key==="ArrowUp"?"up":"down"));return}if(x.key==="Tab"&&!x.shiftKey){C.length>0&&(x.preventDefault(),l(C));return}if(x.key==="Tab"&&x.shiftKey){C.length>0&&(x.preventDefault(),c(C));return}if(x.key==="Enter"&&!x.shiftKey&&!I){N&&(x.preventDefault(),a(N.id,"below"));return}if(x.key==="Enter"&&x.shiftKey&&!I){N&&(x.preventDefault(),a(N.id,"above"));return}if(x.key==="Enter"&&I){N&&(x.preventDefault(),p(N.id));return}if(x.key==="F2"){N&&(x.preventDefault(),i(N.id));return}if(x.key==="Delete"||x.key==="Backspace"&&I){C.length>0&&(x.preventDefault(),n(C));return}if(x.key==="d"&&I&&!x.shiftKey){C.length>0&&(x.preventDefault(),s(C));return}},[d,t,h,b,a,n,s,o,l,c,i,u,p]);return useEffect(()=>{if(d)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[d,y]),{setIsEditing:f}}function Gm(e){let[t,r]=useState(new Set),[a,n]=useState(null);useEffect(()=>{e&&(r(d=>d.size===1&&d.has(e)?d:new Set([e])),n(d=>d===e?d:e));},[e]);let s=useCallback(d=>{r(new Set([d])),n(d);},[]),o=useCallback(d=>{r(m=>{let f=new Set(m);return f.has(d)?f.delete(d):f.add(d),f}),n(d);},[]),l=useCallback((d,m)=>{if(!a){s(d);return}let f=m.indexOf(a),v=m.indexOf(d);if(f===-1||v===-1){s(d);return}let h=Math.min(f,v),b=Math.max(f,v),y=m.slice(h,b+1);r(new Set(y)),n(d);},[a,s]),c=useCallback((d,m,f,v)=>{v?l(d,m):f?o(d):s(d);},[s,o,l]),i=useCallback((d,m)=>{m?r(f=>{let v=new Set(f);return v.add(d),v}):s(d);},[s]),u=useCallback(()=>{r(new Set),n(null);},[]),p=useCallback(d=>t.has(d),[t]);return {selectedTaskIds:t,selectTask:s,toggleTaskSelection:o,selectTaskRange:l,handleTaskClick:c,handleKeyboardSelection:i,clearSelection:u,isTaskSelected:p}}function cd(e){return e.map((t,r)=>({...t,position:r,subtasks:t.subtasks?.length?cd(t.subtasks):t.subtasks}))}function Ro(e){let t=[],r=(a,n,s=0)=>{let o=[...a].sort((l,c)=>(l.position??0)-(c.position??0));for(let l=0;l<o.length;l++){let c={...o[l],parentId:n,level:s,position:o[l].position??l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&r(c.subtasks,c.id,s+1);}};return r(e),t}function ds(e,t){for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=ds(r.subtasks,t);if(a)return a}}return null}function ld(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=ld(r.subtasks,t);if(a)return a}return null}function dd(e,t){if(t.length===0)return e;let r=Ro(e),a=t[0],n=r.findIndex(d=>d.id===a);if(n<=0)return e;let s=r[n-1],o=(d,m)=>{let f=[];return {tasks:d.filter(h=>{if(m.has(h.id))return f.push(h),false;if(h.subtasks){let b=o(h.subtasks,m);h.subtasks=b.tasks,f.push(...b.removed);}return true}),removed:f}},l=(d,m,f)=>d.map(v=>v.id===m?{...v,subtasks:[...v.subtasks||[],...f],isExpanded:true}:v.subtasks?{...v,subtasks:l(v.subtasks,m,f)}:v),c=new Set(t),{tasks:i,removed:u}=o(e,c),p=l(i,s.id,u);return cd(p)}function ud(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=ld(r,a);if(!n)continue;let s=ld(r,n.id),o=(i,u,p)=>{for(let d=0;d<i.length;d++){let m=i[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},l=(i,u,p)=>{let d=i.findIndex(m=>m.id===u);if(d!==-1)return i.splice(d+1,0,p),i;for(let m of i)m.subtasks&&l(m.subtasks,u,p);return i},c=o(r,n.id,a);c&&(s&&s.subtasks?l(s.subtasks,n.id,c):l(r,n.id,c));}return cd(r)}function pd(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],s=(o,l,c)=>{let i=o.findIndex(p=>p.id===l);if(i===-1){for(let p of o)if(p.subtasks&&s(p.subtasks,l,c))return true;return false}let u=c==="up"?i-1:i+1;return u<0||u>=o.length?false:([o[i],o[u]]=[o[u],o[i]],o[i]={...o[i],position:i},o[u]={...o[u],position:u},true)};return s(a,n,r),a}function md(e,t){let r=new Set(t),a=n=>n.filter(s=>!r.has(s.id)).map(s=>s.subtasks?{...s,subtasks:a(s.subtasks)}:s);return a(e)}function Ys(e,t){let r=[...e],a=[];for(let n of t){let s=(c,i)=>c.map((u,p)=>({...u,id:`${u.id}-copy-${Date.now()}-${p}`,parentId:i,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${p}`):void 0})),o=c=>{let i=c.findIndex(m=>m.id===n);if(i===-1){for(let m of c)if(m.subtasks){let f=o(m.subtasks);if(f)return f}return null}let u=c[i],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(i+1,0,d),d},l=o(r);l&&a.push(l);}return {tasks:r,duplicatedTasks:a}}function Vm(e,t,r){let a=[...e],n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:s,color:"#00E5CC"},l=c=>{let i=c.findIndex(p=>p.id===t);if(i===-1){for(let p of c)if(p.subtasks&&l(p.subtasks))return true;return false}let u=r==="above"?i:i+1;return c.splice(u,0,o),true};return l(a),{tasks:a,newTask:o}}function gd(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:gd(a.subtasks,t,r)}:a)}function fd(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:fd(r.subtasks,t)}:r)}function bd(e,t){let r=d=>{for(let m of d){if(m.id===t)return m;if(m.subtasks){let f=r(m.subtasks);if(f)return f}}return null},a=r(e),n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o=a?.startDate||n,l=a?.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},i=c(e),u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(l),color:a?.color||"#00E5CC",position:i,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 jm(e,t,r,a){if(t===r)return e;let n=ds(e,t);if(!n)return e;if(r){let l=(c,i)=>{if(!c.subtasks)return false;for(let u of c.subtasks)if(u.id===i||l(u,i))return true;return false};if(l(n,r))return e}let s=l=>{let c=l.filter(u=>u.id!==t),i=c.length<l.length;return c.map((u,p)=>{let d=i?{...u,position:p}:u;return d.subtasks&&d.subtasks.length>0?{...d,subtasks:s(d.subtasks)}:d})},o=s(e);if(r===null){let l=a!==void 0?a:o.length;o.splice(l,0,{...n,parentId:void 0}),o=o.map((c,i)=>({...c,position:i}));}else {let l=c=>c.map(i=>{if(i.id===r){let u=i.subtasks||[],p=a!==void 0?a:u.length,d=[...u];d.splice(p,0,{...n,parentId:r});let m=d.map((f,v)=>({...f,position:v}));return {...i,subtasks:m,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});o=l(o);}return o}function Ka(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let r=Ka(t.subtasks),a=r.reduce((l,c)=>(c.startDate&&l.starts.push(new Date(c.startDate).getTime()),c.endDate&&l.ends.push(new Date(c.endDate).getTime()),l.progresses.push(c.progress??0),l),{starts:[],ends:[],progresses:[]}),n=a.starts.length>0?new Date(Math.min(...a.starts)):t.startDate,s=a.ends.length>0?new Date(Math.max(...a.ends)):t.endDate,o=a.progresses.length>0?Math.round(a.progresses.reduce((l,c)=>l+c,0)/a.progresses.length):t.progress;return {...t,subtasks:r,startDate:n,endDate:s,progress:o}})}function tl({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:s,onTaskSelectionChange:o,selectedTaskId:l,onTaskDblClick:c,onTaskContextMenu:i,onTaskToggle:u,scrollTop:p,columns:d,onToggleColumn:m,onColumnResize:f,onTaskUpdate:v,onBulkFill:h,onTaskIndent:b,onTaskOutdent:y,onTaskMove:x,onMultiTaskDelete:w,onTaskDuplicate:k,onTaskCreate:M,onTaskRename:I,onCreateSubtask:C,onOpenTaskModal:N,onDeleteRequest:P,onTaskReparent:T,allTasks:V,scrollContainerRef:O,showCriticalPath:X=false}){let F=useContext(ls),[Fe,U]=useState(null),[De,B]=useState(null),[z,Me]=useState(""),Ue=useRef(null),[ce,Le]=useState(null),[J,Pe]=useState(0),[Ee,$e]=useState(0),[He,et]=useState({isOpen:false,x:0,y:0,type:"header"}),[se,_e]=useState(null),[qe,Re]=useState(null),[ut,Et]=useState(null),Ge=useRef(0),Ie=5,dt=useRef(false),[Mt,Be]=useState(null),[vt,L]=useState(false),Q=useRef(null),[R,_]=useState(null),[ue,ve]=useState(null),[Oe,ye]=useState(false),ft=useRef(null);useEffect(()=>{function le(de){ft.current&&!ft.current.contains(de.target)&&ye(false);}if(Oe)return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[Oe]),useEffect(()=>{De&&Ue.current&&(Ue.current.focus(),Ue.current.select());},[De]),useEffect(()=>{if(!ce)return;let le=pt=>{let j=pt.clientX-J,be=Ee+j;f?.(ce,be);},de=()=>{Le(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",le),document.addEventListener("mouseup",de),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",de),document.body.style.cursor="",document.body.style.userSelect="";}},[ce,J,Ee,f]);let{selectedTaskIds:ie,handleTaskClick:ge,isTaskSelected:Ze}=Gm(l),{setIsEditing:Xe}=Wm({tasks:e,selectedTaskIds:ie,onTaskSelect:(le,de)=>{let j=Ro(e).map(be=>be.id);ge(le,j,de||false,false),o?.(le);},onTaskCreate:M||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:k||(()=>{}),onTaskMove:x||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:le=>{let de=Ro(e).find(pt=>pt.id===le);de&&vr(de);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:le=>{let de=Ro(e).find(pt=>pt.id===le);de&&N&&N(de);},enableKeyboard:true}),kt=(le,de=0,pt="")=>{let j=[],be=[...le].sort((te,$)=>(te.position??0)-($.position??0));for(let te=0;te<be.length;te++){let $=be[te],ee=te+1,ke=pt?`${pt}.${ee}`:`${ee}.0`,D=$.wbsCode||ke;if($.wbsCode=D,j.push({task:$,level:de}),$.subtasks&&$.subtasks.length>0&&$.isExpanded){let pe=$.wbsCode?.replace(/\.0$/,"")||(pt?`${pt}.${ee}`:`${ee}`);j.push(...kt($.subtasks,de+1,pe));}}return j},Je=kt(e),At=48,Yt=Math.max(Je.length*r,600-At),pr=(le,de)=>de==="assignees"?le.assignees:de==="startDate"?le.startDate:le.endDate,It=(le,de,pt,j)=>{le.preventDefault(),le.stopPropagation(),_({sourceTaskId:de,column:pt,sourceIndex:j,targetIndex:j}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let be=le.currentTarget.closest("[data-grid-body]"),te=rt=>{let fe=be?.getBoundingClientRect().top??0,q=Math.floor((rt-fe)/r);return q=Math.max(0,Math.min(Je.length-1,q)),q<j&&(q=j),q},$=le.clientY,ee=O?.current??null,ke=()=>{Q.current&&(cancelAnimationFrame(Q.current),Q.current=null);},D=()=>{let rt=te($);_(fe=>fe&&{...fe,targetIndex:rt});},W=()=>{if(ke(),!ee)return;let rt=ee.getBoundingClientRect(),fe=60,q=12,it=$-rt.top,bt=rt.bottom-$;if(bt<fe&&ee.scrollTop<ee.scrollHeight-ee.clientHeight){let Pt=Math.max(1,Math.round(q*(1-Math.max(0,bt)/fe))),Zt=()=>{ee.scrollTop+=Pt,D(),ee.scrollTop<ee.scrollHeight-ee.clientHeight&&(Q.current=requestAnimationFrame(Zt));};Q.current=requestAnimationFrame(Zt);}else if(it<fe&&ee.scrollTop>0){let Pt=Math.max(1,Math.round(q*(1-Math.max(0,it)/fe))),Zt=()=>{ee.scrollTop-=Pt,D(),ee.scrollTop>0&&(Q.current=requestAnimationFrame(Zt));};Q.current=requestAnimationFrame(Zt);}},pe=rt=>{$=rt.clientY,D(),W();},we=rt=>{window.removeEventListener("mousemove",pe),window.removeEventListener("mouseup",we),ke(),document.body.style.cursor="",document.body.style.userSelect="",_(null);let fe=te(rt.clientY),q=Je.find(ya=>ya.task.id===de)?.task;if(!q)return;let it=pr(q,pt),bt=Math.min(j,fe),Pt=Math.max(j,fe),Zt=[];for(let ya=bt;ya<=Pt;ya++){if(ya===j)continue;let Kr=Je[ya]?.task;!Kr||Kr.subtasks&&Kr.subtasks.length>0||Zt.push(Kr.id);}Zt.length!==0&&h?.(Zt,pt,it);};window.addEventListener("mousemove",pe),window.addEventListener("mouseup",we);},Ur=le=>{if(!R)return false;let de=Math.min(R.sourceIndex,R.targetIndex),pt=Math.max(R.sourceIndex,R.targetIndex);return le>=de&&le<=pt},Ht=le=>!le.startDate||!le.endDate?"-":`${Math.ceil((le.endDate.getTime()-le.startDate.getTime())/(1e3*60*60*24))}d`,vr=le=>{B(le.id),Me(le.name),Xe(true);},jt=le=>{z.trim()&&z!==e.find(de=>de.id===le)?.name&&I?.(le,z.trim()),B(null),Me(""),Xe(false);},or=()=>{B(null),Me(""),Xe(false);},ha=(le,de)=>{de.stopPropagation(),C?.(le.id);},pa=(le,de)=>{de.preventDefault(),Ge.current=de.clientY,_e(le),dt.current=false,L(false),Be({x:de.clientX,y:de.clientY});},tt=le=>{if(!se||(Math.abs(le.clientY-Ge.current)>Ie&&!dt.current&&(dt.current=true,L(true)),Be({x:le.clientX,y:le.clientY}),!dt.current))return;if(O?.current){let te=O.current,$=te.getBoundingClientRect(),ee=60,ke=12;Q.current&&(cancelAnimationFrame(Q.current),Q.current=null);let D=le.clientY-$.top,W=$.bottom-le.clientY;if(D<ee&&te.scrollTop>0){let pe=Math.round(ke*(1-D/ee)),we=()=>{te.scrollTop-=pe,dt.current&&te.scrollTop>0&&(Q.current=requestAnimationFrame(we));};Q.current=requestAnimationFrame(we);}else if(W<ee&&te.scrollTop<te.scrollHeight-te.clientHeight){let pe=Math.round(ke*(1-W/ee)),we=()=>{te.scrollTop+=pe,dt.current&&te.scrollTop<te.scrollHeight-te.clientHeight&&(Q.current=requestAnimationFrame(we));};Q.current=requestAnimationFrame(we);}}let pt=document.querySelectorAll("[data-task-row]"),j=null,be=null;pt.forEach(te=>{let $=te.getBoundingClientRect(),ee=te.getAttribute("data-task-row");if(ee&&ee!==se&&le.clientY>=$.top&&le.clientY<=$.bottom){j=ee;let ke=le.clientY-$.top,D=$.height;ke<D*.25?be="above":ke>D*.75?be="below":be="child";}}),Re(j),Et(be);},Ye=()=>{if(dt.current&&se&&qe&&ut){if(ut==="child")T?.(se,qe);else if(ut==="above"||ut==="below"){let le=(te,$,ee=null)=>{for(let ke of te){if(ke.id===$)return ee;if(ke.subtasks){let D=le(ke.subtasks,$,ke.id);if(D!==void 0)return D}}},de=V&&V.length>0?V:e,pt=le(de,se,null),j=le(de,qe,null),be=(te,$,ee,ke)=>{let D=te.findIndex(we=>we.id===$),W=ke?te.findIndex(we=>we.id===ee):-1,pe=ut==="below"?D+1:D;return ke&&W!==-1&&W<D&&(pe-=1),Math.max(0,pe)};if(j===null){let $=be(de,qe,se,pt===null);T?.(se,null,$);}else {let te=ds(de,j);if(te?.subtasks){let $=pt===j,ee=be(te.subtasks,qe,se,$);T?.(se,j,ee);}}}}Q.current&&(cancelAnimationFrame(Q.current),Q.current=null),_e(null),Re(null),Et(null),Be(null),dt.current=false,L(false);};useEffect(()=>{if(se)return document.addEventListener("mousemove",tt),document.addEventListener("mouseup",Ye),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",tt),document.removeEventListener("mouseup",Ye),document.body.style.cursor="",document.body.style.userSelect="";}},[se,qe,ut]);let ea=(le,de,pt)=>{let j=de.subtasks&&de.subtasks.length>0;switch(le.id){case "name":let be=De===de.id,te=Fe===de.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${pt*20}px`},children:[T&&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:te?1:.3},onMouseDown:q=>pa(de.id,q),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),de.subtasks&&de.subtasks.length>0?jsx("button",{onClick:q=>{q.stopPropagation(),u?.(de.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:de.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"}),be?jsx("input",{ref:Ue,type:"text",value:z,onChange:q=>Me(q.target.value),onKeyDown:q=>{q.key==="Enter"?jt(de.id):q.key==="Escape"&&or();},onBlur:()=>jt(de.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:q=>q.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:de.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:de.parentId?"13px":"14px",fontWeight:de.isMilestone?600:de.parentId?400:600,letterSpacing:de.parentId?"0":"-0.01em"},title:de.name,children:[de.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:de.wbsCode}),de.isHighlighted&&de.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:de.name}),de.subtasks&&de.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(de.progress||0),"%"]}),X&&de.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),X&&de.cpmData&&jsxs("span",{style:{color:de.cpmData.totalFloat<=0?"#EF4444":de.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(de.cpmData.totalFloat),"d"]})]}),te&&!be&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:q=>q.stopPropagation(),children:[jsx("button",{onClick:q=>ha(de,q),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:q=>{q.stopPropagation(),vr(de);},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 ee=le.id==="startDate"?"startDate":"endDate",ke=de[ee],D=ue?.taskId===de.id&&ue?.field===ee,W=q=>q?(typeof q=="string"?new Date(q):q).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:q=>q.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:j?.5:1,cursor:j?"default":"pointer"},title:j?"Auto-calculated from subtasks":void 0,onClick:q=>{if(!j)if(D)ve(null);else {let it=q.currentTarget.getBoundingClientRect();ve({taskId:de.id,field:ee,month:ke?typeof ke=="string"?new Date(ke):ke:new Date,position:{top:it.bottom+4,left:it.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:W(ke)}),j&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),D&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>ve(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:ue?.position.top,left:ue?.position.left},onClick:q=>q.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let q=new Date,it=new Date(q);it.setDate(q.getDate()+1);let bt=new Date(q);bt.setDate(q.getDate()+7);let Pt=new Date(q);return Pt.setDate(q.getDate()+14),[{label:"Hoy",date:q},{label:"Ma\xF1ana",date:it},{label:"Pr\xF3xima semana",date:bt},{label:"2 semanas",date:Pt}].map((ya,Kr)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Za=>Za.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Za=>Za.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(de.id,{[ee]:ya.date}),ve(null);},children:ya.label},Kr))})(),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:q=>q.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(de.id,{[ee]:void 0}),ve(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:()=>ve(q=>q?{...q,month:new Date(q.month.getFullYear(),q.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:ue?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>ve(q=>q?{...q,month:new Date(q.month.getFullYear(),q.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((q,it)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:q},it))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let q=ue?.month||new Date,it=q.getFullYear(),bt=q.getMonth(),Pt=new Date(it,bt,1).getDay(),Zt=new Date(it,bt+1,0).getDate(),ya=new Date,Kr=[];for(let er=Pt-1;er>=0;er--)Kr.push({day:new Date(it,bt,-er).getDate(),date:new Date(it,bt-1,new Date(it,bt,-er).getDate()),isCurrentMonth:false});for(let er=1;er<=Zt;er++)Kr.push({day:er,date:new Date(it,bt,er),isCurrentMonth:true});let Za=42-Kr.length;for(let er=1;er<=Za;er++)Kr.push({day:er,date:new Date(it,bt+1,er),isCurrentMonth:false});return Kr.map((er,yo)=>{let Vn=er.date.toDateString()===ya.toDateString(),jn=(ke?typeof ke=="string"?new Date(ke):ke:null)?.toDateString()===er.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:er.isCurrentMonth?jn?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:jn?"#00E5CC":"transparent",boxShadow:Vn&&!jn?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{v?.(de.id,{[ee]:er.date}),ve(null);},children:er.day},yo)})})()})]})]})]}),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:Ht(de)})});case "assignees":if(j)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 pe=a.filter(q=>de.assignees?.some(it=>it.id?it.id===q.id:it.name===q.name||it.initials===q.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsx(Do,{assignedUsers:pe,availableUsers:a,onChange:q=>{let it=q.map(bt=>({id:bt.id,name:bt.name,initials:bt.initials,color:bt.color}));v?.(de.id,{assignees:it});}})});case "status":if(j){let q=de.progress===100?"\u2713":de.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:q})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsx(fp,{status:de.status||"todo",onChange:q=>{v?.(de.id,{status:q,progress:q==="completed"?100:de.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:j?.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:`${de.progress}%`,backgroundColor:de.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:[de.progress,"%"]})]});case "priority":let we={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},rt={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},fe=we[de.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:q=>q.stopPropagation(),children:jsx(To,{priority:fe,onChange:q=>{q&&v?.(de.id,{priority:rt[q]||"medium"});}})});default:return null}},_r=le=>[{id:"hide",label:"Hide Column",icon:ar.Hide,onClick:()=>m(le),disabled:le==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ar.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ar.SortDesc,onClick:()=>{}}],sa=le=>{let de=le.subtasks&&le.subtasks.length>0,pt=Ro(e),j=ie.size>1&&ie.has(le.id),be=j?pt.filter(D=>ie.has(D.id)):[le],te=be.map(D=>D.id),$=be.filter(D=>!(D.subtasks&&D.subtasks.length>0)),ee=j?` (${te.length})`:"",ke=()=>{P?P(te,le.name):w?.(te);};return de?[{id:"addSubtask",label:F?.contextMenu?.addSubtask||"Add Subtask",icon:ar.Add,onClick:()=>{C?.(le.id);}},{id:"duplicate",label:(F?.contextMenu?.duplicateTask||"Duplicate Task")+ee,icon:ar.Duplicate,onClick:()=>{k?.(te);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(F?.contextMenu?.deleteTask||"Delete Task")+ee,icon:ar.Delete,onClick:ke}]:[{id:"edit",label:F?.contextMenu?.editTask||"Edit Task",icon:ar.Pencil,onClick:()=>{c?.(le);}},{id:"addSubtask",label:F?.contextMenu?.addSubtask||"Add Subtask",icon:ar.Add,onClick:()=>{C?.(le.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(F?.contextMenu?.markIncomplete||"Mark Incomplete")+ee,icon:ar.MarkIncomplete,onClick:()=>{$.forEach(D=>v?.(D.id,{status:"todo",progress:0}));},disabled:$.length===0||$.every(D=>D.status==="todo")},{id:"setInProgress",label:(F?.contextMenu?.setInProgress||"Set In Progress")+ee,icon:ar.SetInProgress,onClick:()=>{$.forEach(D=>v?.(D.id,{status:"in-progress"}));},disabled:$.length===0||$.every(D=>D.status==="in-progress")},{id:"markComplete",label:(F?.contextMenu?.markComplete||"Mark Complete")+ee,icon:ar.MarkComplete,onClick:()=>{$.forEach(D=>v?.(D.id,{status:"completed",progress:100}));},disabled:$.length===0||$.every(D=>D.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(F?.contextMenu?.duplicateTask||"Duplicate Task")+ee,icon:ar.Duplicate,onClick:()=>{k?.(te);}},{id:"split",label:F?.contextMenu?.splitTask||"Split Task",icon:ar.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(F?.contextMenu?.deleteTask||"Delete Task")+ee,icon:ar.Delete,onClick:ke}]},wr=d.filter(le=>le.visible),Wr=wr.reduce((le,de)=>le+de.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Wr},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${At}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:wr.map((le,de)=>{let pt=de===wr.length-1,j=le.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${j?"":"justify-center"}`,style:{width:`${le.width}px`,minWidth:`${le.minWidth??(j?200:60)}px`,maxWidth:`${le.maxWidth??2e3}px`,flexShrink:j&&wr.length===1?1:0,flexGrow:j&&wr.length===1?1:0,borderRight:pt?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:be=>{be.preventDefault(),et({isOpen:true,x:be.clientX,y:be.clientY,type:"header",columnId:le.id});},onMouseEnter:be=>{be.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:be=>{be.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:le.label,children:le.label}),le.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:ce===le.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:be=>{be.preventDefault(),be.stopPropagation(),Le(le.id),Pe(be.clientX),$e(le.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:ce===le.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},le.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(Zi,{columns:d,onToggleColumn:m,theme:t}),jsx("button",{onClick:()=>ye(!Oe),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"})}),Oe&&jsxs("div",{ref:ft,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:le=>le.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:()=>ye(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content","data-grid-body":true,style:{minHeight:Yt},children:Je.map(({task:le,level:de},pt)=>{let j=Ze(le.id),be=Ur(pt),te=qe===le.id,$=te&&ut==="above",ee=te&&ut==="below",ke=te&&ut==="child",D={};return ke&&(D.backgroundColor=`${t.accent}15`,D.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":le.id,className:`flex items-center cursor-pointer group ${se===le.id?"opacity-50":""}`,style:{position:"relative",height:`${r}px`,borderLeft:j?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:j?t.accentLight:ke?`${t.accent}15`:pt%2===0?t.bgPrimary:t.bgGrid,opacity:X?le.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...D},onMouseEnter:()=>U(le.id),onMouseLeave:()=>U(null),onClick:W=>{let we=Ro(e).map(q=>q.id),fe=navigator.platform.toUpperCase().indexOf("MAC")>=0?W.metaKey:W.ctrlKey;ge(le.id,we,fe,W.shiftKey),o?.(le.id),!fe&&!W.shiftKey&&s?.(le);},onDoubleClick:W=>{W.stopPropagation(),c?.(le);},onContextMenu:W=>{W.preventDefault(),et({isOpen:true,x:W.clientX,y:W.clientY,type:"task",task:le}),i?.(le,W);},whileHover:{backgroundColor:j?t.accentLight:t.hoverBg},children:[$&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ee&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),wr.map((W,pe)=>{let we=pe===wr.length-1,rt=W.id==="name",fe=!!(le.subtasks&&le.subtasks.length>0),q=W.id==="assignees"||W.id==="startDate"||W.id==="endDate"?W.id:null,bt=!!q&&!fe&&Fe===le.id&&!R,Pt=be&&!!R&&R.column===W.id;return jsxs("div",{className:`px-4 flex items-center ${rt?"justify-start":"justify-center"}`,style:{position:"relative",width:`${W.width}px`,minWidth:`${W.minWidth??(rt?200:60)}px`,maxWidth:`${W.maxWidth??2e3}px`,flexShrink:rt&&wr.length===1?1:0,flexGrow:rt&&wr.length===1?1:0,borderRight:we?"none":`1px solid ${Fe===le.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:Pt?`${t.accent}22`:void 0,boxShadow:Pt?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[ea(W,le,rt?de:0),bt&&q&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Zt=>It(Zt,le.id,q,pt),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}})]},`${le.id}-${W.id}`)})]},le.id)})}),jsx(cs,{isOpen:He.isOpen,x:He.x,y:He.y,items:He.type==="header"&&He.columnId?_r(He.columnId):He.type==="task"&&He.task?sa(He.task):[],onClose:()=>et({...He,isOpen:false}),theme:t}),vt&&Mt&&se&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Mt.x+12,top:Mt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let le=Je.find(de=>de.task.id===se)?.task;return le?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:le.name})}):null})()}),document.body)]})}function Xm(e,t){let[r,a]=useState("none"),[n,s]=useState(0),[o,l]=useState(e),[c,i]=useState(t),[u,p]=useState(null),[d,m]=useState(null),[f,v]=useState(null),[h,b]=useState(null),[y,x]=useState(0),[w,k]=useState(0),[M,I]=useState(null),[C,N]=useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:p,hoveredTaskId:d,setHoveredTaskId:m,activeZone:f,setActiveZone:v,draggedSegmentIndex:h,setDraggedSegmentIndex:b,draggedSegmentStartX:y,setDraggedSegmentStartX:x,segmentDragOffsetX:w,setSegmentDragOffsetX:k,hoveredSegmentIndex:M,setHoveredSegmentIndex:I,isHovered:C,setIsHovered:N,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(X,F)=>{a("none"),p(null),m(null),l(X),i(F),k(0),b(null),x(0);}}}function rl({task:e,x:t,y:r,width:a,theme:n,dayWidth:s,startDate:o,templates:l,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:p,onDependencyCreate:d,allTaskPositions:m=[],onDragMove:f,onHoverChange:v,showBaseline:h,showTaskBarLabels:b=true,showCriticalPath:y=true,readOnly:x=false,onProgressChange:w}){let k=Xm(t,a),M=useRef(null),I=useRef(false),C=useRef(null),N=useRef(null),{dragMode:P,setDragMode:T,dragOffset:V,setDragOffset:O,ghostX:X,setGhostX:F,ghostWidth:Fe,setGhostWidth:U,connectionLine:De,setConnectionLine:B,hoveredTaskId:z,setHoveredTaskId:Me,activeZone:Ue,setActiveZone:ce,draggedSegmentIndex:Le,setDraggedSegmentIndex:J,draggedSegmentStartX:Pe,setDraggedSegmentStartX:Ee,segmentDragOffsetX:$e,setSegmentDragOffsetX:He,hoveredSegmentIndex:et,setHoveredSegmentIndex:se,isHovered:_e,setIsHovered:qe,isDragging:Re,isResizing:ut,isConnecting:Et,resetDragState:Ge}=k,Ie=18,dt=!!n.executionBarBg,Mt=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",Be=dt?3:6,vt=e.subtasks&&e.subtasks.length>0,L=useRef(null),[Q,R]=(()=>{let j=useRef(null),[,be]=useState(0);return [j.current,te=>{j.current=te,be($=>$+1);}]})(),_=!!w&&!x&&!vt&&!e.segments&&!!e.startDate&&!!e.endDate,ue=e.endDate&&(()=>{let j=new Date;j.setHours(0,0,0,0);let be=new Date(e.endDate);return be.setHours(0,0,0,0),be<j})()&&e.progress<100,ve=y&&e.isCriticalPath,Oe=n.name==="neutral"||n.today==="#1C1917",ye=e.status==="completed"||e.progress===100,ft={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},ge=y&&e.isCriticalPath||ue?"#EF4444":e.color?e.color:e.priority&&ft[e.priority]?ft[e.priority]:n.taskBarPrimary,Ze=x?"default":Re?Et?"crosshair":ut?"ew-resize":"grabbing":"grab",Xe=x?"default":"ew-resize",Je=(j=>j>=80?20:j>=60?15:j>=50?12:10)(a),At=a<50,Yt=a<40;useEffect(()=>{v&&(!_e||Re||e.segments)&&v(null);},[_e,Re,e.segments,v]);let pr=j=>j.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),It=()=>{let j=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${j} day${j!==1?"s":""}`},Ur=j=>Math.round(j/s)*s,Ht=j=>{let be=Math.round(j/s),te=new Date(o);return te.setDate(te.getDate()+be),te},vr=(j,be)=>{for(let te of m){if(te.id===e.id)continue;let $=5;if(j>=te.x-$&&j<=te.x+te.width+$&&be>=te.y-$&&be<=te.y+te.height+$)return te.id}return null},jt=useCallback((j,be,te)=>{if(x)return;j.preventDefault(),j.stopPropagation();let $=M.current?.ownerSVGElement;if(!$)return;let ee=$.createSVGPoint();ee.x=j.clientX,ee.y=j.clientY;let ke=ee.matrixTransform($.getScreenCTM()?.inverse()),D=te!==void 0?te:t,W=be;if(!W){let pe=ke.x-D;j.shiftKey?(W="connect",B({x:t+a,y:r+Ie/2})):j.ctrlKey||j.metaKey?W="move":j.altKey?W=pe<a/2?"resize-start":"resize-end":Yt?pe<a/2?W="move":W="resize-end":At?pe<=Je/2?W="resize-start":pe>=a-Je/2?W="resize-end":W="move":pe<=Je?W="resize-start":pe>=a-Je?W="resize-end":W="move";}I.current=false,T(W),qe(false),ce(null),W==="move"?O(ke.x-D):W==="connect"?B({x:t+a,y:r+Ie/2}):O(0),F(D),U(a);},[t,a,r,Ie,x]),or=useCallback(j=>{let be=M.current?.ownerSVGElement;if(!be)return;let te=be.closest(".gantt-timeline-scroll");if(!te)return;let $=te.getBoundingClientRect(),ee=60,ke=15,D=0;if(j.clientX<$.left+ee){let W=$.left+ee-j.clientX;D=-Math.min(ke,W/2);}else if(j.clientX>$.right-ee){let W=j.clientX-($.right-ee);D=Math.min(ke,W/2);}return D!==0&&(te.scrollLeft+=D),D!==0},[]),ha=useCallback(j=>{if(P==="none")return;I.current=true,N.current=j;let be=M.current?.ownerSVGElement;if(!be)return;if(P==="move"||P==="resize-start"||P==="resize-end"){let ee=or(j);ee&&!C.current?C.current=window.setInterval(()=>{N.current&&(or(N.current),ha(N.current));},16):!ee&&C.current&&(window.clearInterval(C.current),C.current=null);}let te=be.createSVGPoint();te.x=j.clientX,te.y=j.clientY;let $=te.matrixTransform(be.getScreenCTM()?.inverse());if(P==="connect"){B({x:$.x,y:$.y});let ee=vr($.x,$.y);Me(ee);}else if(P==="move"){let ee=$.x-V,ke=Ur(ee);F(ke),U(a);let D=Math.round((ke-t)/s);if(f?.(e.id,D,true),e.segments&&e.segments.length>0&&Le!==null){let W=ke-Pe;He(W);}}else if(P==="resize-start"){let ee=$.x,ke=Ur(ee),D=t+a-ke;D>=s&&(F(ke),U(D));}else if(P==="resize-end"){let ee=$.x,D=Ur(ee)-t;D>=s&&U(D);}},[P,t,a,s,V,e,Ur,Le,Pe,vr,Me,B,F,U,He,f,or]),pa=useCallback(()=>{if(C.current&&(window.clearInterval(C.current),C.current=null),N.current=null,P!=="none"){if(P==="connect")z&&d&&d(e,z),B(null),Me(null);else {let j=e.endDate.getTime()-e.startDate.getTime(),be,te,$=true;if(P==="move"){if(be=Ht(X),te=new Date(be.getTime()+j),e.segments&&e.segments.length>0&&Le!==null){let ee=Math.round($e/s),ke=e.segments.map((we,rt)=>{if(rt===Le){let fe=new Date(we.startDate),q=new Date(we.endDate);return fe.setDate(fe.getDate()+ee),q.setDate(q.getDate()+ee),{startDate:fe,endDate:q}}return we}),D=ke.flatMap(we=>[we.startDate,we.endDate]),W=new Date(Math.min(...D.map(we=>we.getTime()))),pe=new Date(Math.max(...D.map(we=>we.getTime())));p?.({...e,segments:ke},W,pe),Ge(t,a);return}}else P==="resize-start"?(be=Ht(X),te=e.endDate,be>te&&(console.warn("Invalid date range: start date must be before or equal to end date"),$=false)):P==="resize-end"?(be=e.startDate,te=Ht(X+Fe),te.setDate(te.getDate()-1),te<be&&(console.warn("Invalid date range: end date must be after or equal to start date"),$=false)):$=false;$&&be&&te&&(te.getTime()<be.getTime()?console.warn("Invalid date range: end date cannot be before start date"):p?.(e,be,te));}f?.(e.id,0,false),Ge(t,a);}},[P,X,Fe,e,p,z,d,t,a,s,Ht,$e,Le,Ge,f]);useEffect(()=>{if(P==="none")return;let j=te=>{ha(te);},be=()=>{pa();};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",be),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",be),C.current&&(window.clearInterval(C.current),C.current=null);}},[P,ha,pa]);let tt=Re&&!Et?X:t,Ye=Re&&!Et?Fe:a,ea=l.taskClass(e),_r=24,sa=y?e.isCriticalPath?1:.25:1,wr=useCallback(j=>{if(!_)return;j.stopPropagation(),j.preventDefault();let te=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;L.current={barRect:te,initialPct:e.progress||0},j.currentTarget.setPointerCapture(j.pointerId),R(e.progress||0);},[_,e.progress,R]),Wr=useCallback(j=>{let be=L.current;if(!be)return;let $=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??be.barRect;if(!$||$.width<=0)return;let ee=(j.clientX-$.left)/$.width,ke=Math.round(Math.max(0,Math.min(1,ee))*100);j.shiftKey&&(ke=Math.round(ke/25)*25),R(ke);},[R]),le=useCallback(j=>{let be=L.current;if(!be)return;j.stopPropagation(),j.preventDefault();try{j.currentTarget.releasePointerCapture(j.pointerId);}catch{}let te=Q;L.current=null,R(null),te!=null&&te!==be.initialPct&&w&&w(e,te);},[Q,w,e,R]),de=useCallback(j=>{j.stopPropagation(),j.preventDefault();},[]),pt=Q??(e.progress||0);return jsxs("g",{ref:M,"data-task-bar":"true",style:{opacity:sa,transition:"opacity 300ms ease"},onClick:()=>{!Re&&!I.current&&c?.(e),I.current=false;},onDoubleClick:j=>{!Re&&!I.current&&(j.stopPropagation(),i?.(e));},onContextMenu:j=>{j.preventDefault(),u?.(e,j);},onMouseEnter:()=>!Re&&qe(true),onMouseMove:j=>{v&&_e&&!Re&&!e.segments&&v({task:e,x:t,y:r,width:a,height:Ie,showBelow:false,mouseX:j.clientX,mouseY:j.clientY});},onMouseLeave:()=>{Re||(qe(false),ce(null));},children:[jsx("rect",{x:t,y:r,width:a+_r,height:Ie,fill:"transparent",style:{pointerEvents:"all"}}),_e&&!Re&&!At&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:r,width:Je,height:Ie,fill:Ue==="resize-start"?n.accent:"transparent",opacity:Ue==="resize-start"?.15:0,style:{cursor:Xe,pointerEvents:"all"},onMouseEnter:()=>ce("resize-start"),onMouseDown:j=>jt(j,"resize-start")}),jsx("rect",{x:t+Je,y:r,width:a-Je*2,height:Ie,fill:Ue==="move"?n.accent:"transparent",opacity:Ue==="move"?.1:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>ce("move"),onMouseDown:j=>jt(j,"move")}),jsx("rect",{x:t+a-Je,y:r,width:Je,height:Ie,fill:Ue==="resize-end"?n.accent:"transparent",opacity:Ue==="resize-end"?.15:0,style:{cursor:Xe,pointerEvents:"all"},onMouseEnter:()=>ce("resize-end"),onMouseDown:j=>jt(j,"resize-end")})]}),_e&&!Re&&Yt&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:r,width:a/2,height:Ie,fill:Ue==="move"?n.accent:"transparent",opacity:Ue==="move"?.2:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>ce("move"),onMouseDown:j=>jt(j,"move")}),jsx("rect",{x:t+a/2,y:r,width:a/2,height:Ie,fill:Ue==="resize-end"?n.accent:"transparent",opacity:Ue==="resize-end"?.2:0,style:{cursor:Xe,pointerEvents:"all"},onMouseEnter:()=>ce("resize-end"),onMouseDown:j=>jt(j,"resize-end")}),_e&&jsx(motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+Ie-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Re&&!Et&&!e.segments&&jsx(motion.rect,{x:X,y:r,width:Fe,height:Ie,rx:Be,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"}}),h&&e.baselineStartDate&&e.baselineEndDate&&!Re&&(()=>{let j=e.baselineStartDate.getTime(),be=e.baselineEndDate.getTime(),te=o.getTime(),$=864e5,ee=(j-te)/$,ke=(be-j)/$,D=ee*s,W=Math.max(ke*s,s),pe=tt+Ye,we=D+W,rt=e.endDate?.getTime()??0,fe=Math.ceil((rt-be)/$),q=fe>0,it=fe<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:D,y:r,width:W,height:Ie,rx:Be,fill:"none",stroke:Mt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),q&&pe>we&&jsx("rect",{x:we,y:r,width:pe-we,height:Ie,rx:0,fill:"#EF4444",opacity:.2}),q&&jsxs("text",{x:Math.max(pe,we)+6,y:r+Ie/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",fe,"d"]}),it&&jsxs("text",{x:pe+6,y:r+Ie/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[fe,"d"]})]})})(),!e.segments&&dt&&vt&&(()=>{let be=r+(Ie-8)/2,te=4,$=e.progress||0,ee=new Date;ee.setHours(0,0,0,0);let ke=e.startDate&&ee>=e.startDate,D=e.endDate&&(()=>{let q=new Date(e.endDate);return q.setHours(0,0,0,0),ee>q})(),W=e.startDate&&ee<e.startDate,pe=1;if(ke&&e.startDate&&e.endDate&&!W){let q=new Date(e.startDate);q.setHours(0,0,0,0);let it=new Date(e.endDate);it.setHours(0,0,0,0);let bt=Math.max(1,(it.getTime()-q.getTime())/(1e3*60*60*24)),Zt=Math.min((ee.getTime()-q.getTime())/(1e3*60*60*24),bt)/bt*100;pe=Zt>0?$/Zt:1;}let we;$>=100?we="#00E5CC":W?we="#4B5563":D&&$<100?we="#EF4444":pe>=.95?we="#22C55E":pe>=.8?we="#F59E0B":we="#EF4444";let rt=Math.max($/100*Ye,$>0?te*2:0),fe=Ye>100&&$>0;return jsxs("g",{"data-task-class":ea,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:tt,y:be,width:Ye,height:8,rx:te,fill:"rgba(255,255,255,0.10)"}),$>0&&jsx("rect",{x:tt,y:be,width:rt,height:8,rx:te,fill:we}),fe&&jsxs("text",{x:tt+rt+6,y:be+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round($),"%"]})]})})(),!e.segments&&dt&&!vt&&jsx(motion.rect,{x:tt,y:r,width:Ye,height:Ie,rx:Be,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":ea,"data-bar-background":"true",initial:{opacity:0,scale:.95},animate:{opacity:Re&&!Et?.15:e.parentId?.6:1,scale:_e&&!Re?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:j=>jt(j),style:{cursor:Ze,pointerEvents:"all"}}),!e.segments&&!dt&&jsx(motion.rect,{x:tt,y:r,width:Ye,height:Ie,rx:Be,fill:ge,"data-task-class":ea,initial:{opacity:0,scale:.95},animate:{opacity:Re&&!Et?.15:e.parentId?.6:_e?.9:.8,scale:_e&&!Re?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:vt?void 0:j=>jt(j),style:{cursor:vt?"default":Ze,pointerEvents:"all"}}),dt&&(ue||ve)&&!e.segments&&jsx("rect",{x:tt,y:r,width:Ye,height:Ie,rx:Be,fill:"none",stroke:n.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${n.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&pt>0&&!vt&&jsx("rect",{x:tt,y:r,width:Math.max(Ye*(pt/100),Be*2),height:Ie,rx:Be,fill:ge,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!vt&&e.progress<100&&(()=>{let j=e.progress>0?Ye*(e.progress/100):0,be=tt+j,te=Ye-j,$=e.progress===0?Be:0,ee=e.progress===0?tt:be,ke=e.progress===0?Ye:te;return jsxs(Fragment,{children:[jsx("rect",{x:ee,y:r,width:ke,height:Ie,rx:$,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:ee,y:r,width:ke,height:Ie,rx:$,fill:"none",stroke:ge,strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),dt&&!e.segments&&e.progress>0&&e.progress<100&&!vt&&!Re&&Q===null&&(()=>{let j=tt+Ye*(e.progress/100),be=8,te=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:j,cy:r+Ie/2,r:be,fill:te?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:j,y:r+Ie/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:te?.initials||te?.name?.charAt(0)?.toUpperCase()||""})]})})(),_&&!Re&&Ye>=40&&(Q!==null||pt<88)&&(()=>{let j=tt+Ye*(pt/100),be=r+Ie/2,te=Q!==null,$=te?7:_e?6:5,ee=te||_e?1:.35,ke=tt+Ye-j,D=Math.max(4,Math.min(12,ke-10)),W=12;return jsxs("g",{children:[jsx("rect",{x:j-W,y:be-12,width:W+D,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:wr,onPointerMove:Wr,onPointerUp:le,onPointerCancel:le,onClick:de,onDoubleClick:de,onMouseDown:pe=>pe.stopPropagation()}),jsx("circle",{cx:j,cy:be,r:$,fill:"#FFFFFF",stroke:ge,strokeWidth:2,opacity:ee,style:{pointerEvents:"none",filter:te?`drop-shadow(0 0 4px ${ge})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),te&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:j-20,y:be-28,width:40,height:18,rx:4,fill:Mt?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:ge,strokeWidth:1}),jsxs("text",{x:j,y:be-16,textAnchor:"middle",dominantBaseline:"central",fill:Mt?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[Q,"%"]})]})]})})(),e.segments&&e.segments.map((j,be)=>{let te=(j.startDate.getTime()-o.getTime())/864e5*s,ee=(j.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-te+s,ke=Re&&P==="move"&&Le===be,D=et===be,W=ke?te+$e:te;return jsxs("g",{onMouseEnter:()=>!Re&&se(be),onMouseLeave:()=>!Re&&se(null),children:[jsx(motion.rect,{x:W,y:r,width:ee,height:Ie,rx:Be,fill:ge,initial:{opacity:0,scale:.95},animate:{opacity:ke||e.parentId?.6:D?.9:.8,scale:D&&!Re?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:pe=>{pe.stopPropagation(),J(be),Ee(te),jt(pe,void 0,te);},style:{cursor:Ze,pointerEvents:"all"}}),jsx("rect",{x:W,y:r,width:ee*(e.progress/100),height:Ie,rx:Be,fill:ge,opacity:1,style:{pointerEvents:"none"}})]},`segment-${be}`)}),Oe&&(ue||ve)&&!e.segments&&jsxs(Fragment,{children:[ve&&!ue&&jsx("rect",{x:tt,y:r,width:Ye,height:Ie,rx:Be,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ue&&jsx("rect",{x:tt,y:r,width:Ye,height:Ie,rx:Be,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&Ye>60&&!e.segments&&!(dt&&vt)&&(()=>{let j=l.taskLabel(e),be=typeof j=="string"?j:e.name,te=be.length>Math.floor(Ye/8)?`${be.substring(0,Math.floor(Ye/8))}...`:be;return jsx("text",{x:tt+8,y:r+Ie/2,dominantBaseline:"middle",fill:ye?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ye?"line-through":"none"},children:te})})(),!Re&&!e.segments&&!vt&&e.progress>0&&e.progress<100&&(dt?jsxs("text",{x:tt+Ye+6,y:r+Ie/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Ye>100?jsxs("text",{x:tt+Ye-12,y:r+Ie/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&&Ye>80&&!Re&&!e.segments&&!(dt&&vt)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:tt+Ye-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:tt+Ye-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(_e||ut)&&!Et&&!e.segments&&!vt&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:tt-2,y:r,width:16,height:Ie,fill:"transparent",style:{cursor:Xe},onMouseEnter:()=>ce("resize-start"),onMouseLeave:()=>ce(null),onMouseDown:j=>{j.stopPropagation(),jt(j,"resize-start");}}),jsx(motion.rect,{x:tt+4,y:r+8,width:3,height:Ie-16,rx:1.5,fill:Ue==="resize-start"||P==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:tt+Ye-14,y:r,width:16,height:Ie,fill:"transparent",style:{cursor:Xe},onMouseEnter:()=>ce("resize-end"),onMouseLeave:()=>ce(null),onMouseDown:j=>{j.stopPropagation(),jt(j,"resize-end");}}),jsx(motion.rect,{x:tt+Ye-7,y:r+8,width:3,height:Ie-16,rx:1.5,fill:Ue==="resize-end"||P==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:_e&&!Re&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+a+10,cy:r+Ie/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ce("connect"),onMouseLeave:()=>ce(null),onMouseDown:j=>{j.stopPropagation(),jt(j,"connect");}}),jsx(motion.circle,{cx:t+a+10,cy:r+Ie/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:Ue==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Et&&De&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+a,y1:r+Ie/2,x2:De.x,y2:De.y,stroke:z?n.statusCompleted:n.accent,strokeWidth:z?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:z?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:De.x,cy:De.y,r:z?8:6,fill:z?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),z&&jsx(motion.text,{x:De.x+15,y:De.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:De.x+10},animate:{opacity:1,x:De.x+15},transition:{duration:.2},children:"Connect"})]}),(_e||Re)&&!Et&&!e.segments&&jsx(motion.rect,{x:tt-1,y:r-1,width:Ye+2,height:Ie+2,rx:Be+1,fill:"none",stroke:Re?n.accent:dt?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:dt?1:2,opacity:Re||dt?.6:.4,initial:{opacity:0},animate:{opacity:Re||dt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ut&&jsxs(Fragment,{children:[jsx("line",{x1:X,y1:0,x2:X,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:X+Fe,y1:0,x2:X+Fe,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:_e&&!Re&&!e.segments&&!v&&(()=>{let te=r<100,$=te?r+Ie+13:r-82-13,ee=te?`M ${tt+Ye/2-6} ${r+Ie+3} L ${tt+Ye/2} ${r+Ie+13} L ${tt+Ye/2+6} ${r+Ie+3}`:`M ${tt+Ye/2-6} ${r-13} L ${tt+Ye/2} ${r-3} L ${tt+Ye/2+6} ${r-13}`,ke=$+22,D=$+40,W=$+55,pe=$+70,we=te?$+82-5:r-18;return jsxs(motion.g,{initial:{opacity:0,y:te?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:te?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:ee,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsx("rect",{x:tt+Ye/2-120,y:$,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:tt+Ye/2,y:ke,textAnchor:"middle",fill:n.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:tt+Ye/2-110,y:D,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:tt+Ye/2-70,y:D,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:pr(e.startDate)}),jsx("text",{x:tt+Ye/2-110,y:W,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:tt+Ye/2-70,y:W,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:pr(e.endDate)}),jsx("text",{x:tt+Ye/2+10,y:D,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:tt+Ye/2+65,y:D,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:It()}),jsx("text",{x:tt+Ye/2+10,y:W,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:tt+Ye/2+65,y:W,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:tt+Ye/2-110,y:pe,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:tt+Ye/2-50,y:pe,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(rt=>rt.name).join(", ").substring(0,30),e.assignees.map(rt=>rt.name).join(", ").length>30?"...":""]})]}),!te&&jsx("text",{x:tt+Ye/2,y:we,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Yt?"Left: move \u2022 Right: resize":At?"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 hd=260,ps=8,Zm=16,xw=-12;function eg({tooltipData:e,theme:t,locale:r="en",workingDaysConfig:a}){let[n,s]=useState(null);if(useLayoutEffect(()=>{if(!e){s(null);return}let{task:x,mouseX:w,mouseY:k}=e,M=x.effortMinutes!=null||x.timeLoggedMinutes!=null||x.soldEffortMinutes!=null,I=x.lastActivity!=null,C=(M?155:105)+(I?28:0),N=w+Zm,P=k+xw-C;N+hd>window.innerWidth-ps&&(N=w-hd-Zm),N<ps&&(N=ps);let T=P<ps;T&&(P=k+20),P+C>window.innerHeight-ps&&(P=window.innerHeight-ps-C),s({left:N,top:P,showBelow:T});},[e]),!e||!n)return null;let{task:o}=e,l=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,c={start:r==="es"?"Inicio":"Start",end:r==="es"?"Fin":"End",duration:r==="es"?"Duraci\xF3n":"Duration",progress:r==="es"?"Progreso":"Progress",assignees:r==="es"?"Asignados":"Assignees",estimated:r==="es"?"Estimado":"Estimated",logged:r==="es"?"Registrado":"Logged",quoted:r==="es"?"Ofertado":"Quoted",tags:r==="es"?"Etiqueta":"Tag"},i=x=>x.toLocaleDateString(r==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),u=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!a?.enabledWeekdays){let P=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return r==="es"?`${P} d\xEDa${P!==1?"s":""}`:`${P} day${P!==1?"s":""}`}let x=a.enabledWeekdays,w=a.holidayDates instanceof Set?a.holidayDates:new Set(a.holidayDates??[]),k=P=>`${P.getFullYear()}-${String(P.getMonth()+1).padStart(2,"0")}-${String(P.getDate()).padStart(2,"0")}`,M=0,I=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),C=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;I.getTime()<=C.getTime();){let P=I.getDay();x[P]&&!w.has(k(I))&&M++,I.setDate(I.getDate()+1);}let N=Math.max(0,M);return r==="es"?`${N} d\xEDa${N!==1?"s":""}`:`${N} day${N!==1?"s":""}`},p=x=>{if(x==null||x===0)return "N/A";let w=Math.floor(x/60),k=x%60;return w===0?`${k}m`:k===0?`${w}h`:`${w}h ${k}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",v=t.accent||"#00E5CC",h=t.bgSecondary||"#1F2937",b=t.border||"#374151",y=jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:hd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:h,border:`1px solid ${b}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:f,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(al,{label:c.start,value:o.startDate?i(o.startDate):"N/A",labelColor:d,valueColor:m}),jsx(al,{label:c.duration,value:u(),labelColor:d,valueColor:m}),jsx(al,{label:c.end,value:o.endDate?i(o.endDate):"N/A",labelColor:d,valueColor:m}),jsx(al,{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))})]}),l&&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:r==="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 jc({templates:e,onSelectTemplate:t,className:a}){let[r,n]=useState(false),s=useRef(null),o=useRef(null);useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),n(false);},c=e.reduce((i,u)=>{let p=u.category||"Other";return i[p]||(i[p]=[]),i[p].push(u),i},{});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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className: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(([i,u])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:u.map(p=>jsxs("button",{onClick:()=>l(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))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Kc({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:n,className:s}){let[o,l]=useState("export"),[c,i]=useState("json"),[u,p]=useState(null),d=useRef(null);if(!t)return null;let m=async()=>{let v=n?.current||void 0,h=await _u(e,c,v);Ku(h,c);},f=async v=>{let h=v.target.files?.[0];if(h){try{let b=await Xu(h),y=h.name.endsWith(".json")?"json":"csv",x=Yu(b,y);p(x),x.success&&r&&r(x,b);}catch(b){p({success:false,errors:[`Failed to read file: ${b instanceof Error?b.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:()=>l("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:()=>l("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:()=>i(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,h)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",v]},h))})]})]})]})]})]})}var qx=["URGENT","HIGH","MEDIUM","LOW"],Yx=[{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"}],Xx=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function qc({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:p=true,compact:d=false,groupBy:m="none",onGroupByChange:f}){let[v,h]=useState(true),b=useCallback(M=>{a({search:M.target.value});},[a]),y=useCallback(M=>{a({dateFilter:M.target.value});},[a]),x=useCallback(M=>{r({by:M.target.value});},[r]),w=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:()=>h(!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"}),l&&jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange: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:M=>{let I=M.target.value;a({priorities:I==="all"?[]:[I]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),qx.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 I=M.target.value;a({assignees:I==="all"?[]:[I]});},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))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:M=>{let I=M.target.value;a({labels:I==="all"?[]:[I]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.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:Yx.map(M=>jsx("option",{value:M.value,children:M.label},M.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:M=>f(M.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Xx.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 Yc({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,u]=useState(false),p=useRef(null);useEffect(()=>{let m=f=>{p.current&&!p.current.contains(f.target)&&u(false);};return i&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[i]);let d=m=>{m(),u(false);};return jsxs("div",{className:g("relative",r),ref:p,children:[jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter: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":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxs("button",{onClick:()=>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 l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter: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 Xc={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"}},Jc={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"}},Qc={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"}},Po={dark:Xc,light:Jc,neutral:Qc},Yi="dark";var Xi=createContext(void 0),sv="asakaa-theme";function Cm({children:e,defaultTheme:t=Yi,storageKey:a=sv}){let[r,n]=useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=useCallback(l=>{n(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=Po[r];Object.entries(c.colors).forEach(([u,p])=>{p&&l.style.setProperty(`--theme-${iv(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&&l.style.setProperty(p,d);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let o={theme:r,setTheme:s,themes:Po};return jsx(Xi.Provider,{value:o,children:e})}function ss(){let e=useContext(Xi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function iv(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Zc({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:n}=ss();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(Po).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 pt={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 Tm(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return pt[e]||pt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,o)=>a.getPropertyValue(s).trim()||o;return {bgPrimary:r("--theme-bg-primary",pt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",pt[e].bgSecondary),bgGrid:r("--theme-bg-card",pt[e].bgGrid),bgWeekend:r("--theme-bg-hover",pt[e].bgWeekend),border:r("--theme-border-primary",pt[e].border),borderLight:r("--theme-border-subtle",pt[e].borderLight),textPrimary:r("--theme-text-primary",pt[e].textPrimary),textSecondary:r("--theme-text-secondary",pt[e].textSecondary),textTertiary:r("--theme-text-tertiary",pt[e].textTertiary),accent:r("--theme-accent-primary",pt[e].accent),accentHover:r("--theme-accent-hover",pt[e].accentHover),accentLight:r("--theme-accent-primary",pt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",pt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",pt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",pt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",pt[e].dependency),dependencyHover:r("--theme-border-secondary",pt[e].dependencyHover),criticalPath:r("--theme-error",pt[e].criticalPath),criticalPathLight:r("--theme-error",pt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",pt[e].today):e==="neutral"?r("--theme-text-primary",pt[e].today):r("--theme-error",pt[e].today),todayLight:e==="light"?r("--theme-accent-primary",pt[e].todayLight):e==="neutral"?r("--theme-text-primary",pt[e].todayLight):r("--theme-error",pt[e].todayLight),milestone:r("--theme-warning",pt[e].milestone),milestoneLight:r("--theme-warning",pt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",pt[e].statusTodo),statusInProgress:r("--theme-accent-primary",pt[e].statusInProgress),statusCompleted:r("--theme-success",pt[e].statusCompleted),hoverBg:r("--theme-bg-hover",pt[e].hoverBg),focusRing:r("--theme-accent-primary",pt[e].focusRing),...pt[e].dotGrid&&{dotGrid:pt[e].dotGrid},...pt[e].glassHeader&&{glassHeader:pt[e].glassHeader},...pt[e].glassToolbar&&{glassToolbar:pt[e].glassToolbar},...pt[e].forecastHud&&{forecastHud:pt[e].forecastHud},...pt[e].neonRedGlow&&{neonRedGlow:pt[e].neonRedGlow},...pt[e].executionBarBg&&{executionBarBg:pt[e].executionBarBg}}}var Ji={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Nm={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},ed={en:Ji,es:Nm};function Dm(e){return ed[e]||ed.en}function td(e,t){let a=Dm(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(Ji);function Kr(){return useContext(ls)}function Ks(e,t,a="left",r=208){let[n,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),l=o.bottom+4,c;a==="right"?c=o.right-r:c=o.left;let i=8;c+r>window.innerWidth-i&&(c=window.innerWidth-i-r),c<i&&(c=i),s({top:l,left:c});},[t,a,e,r]),n}function Im({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[l,c]=useState(false),[i,u]=useState(null),p=useRef(null),d=useRef(null),m=Kr(),f=Ks(p,l,"right",176);if(useEffect(()=>{if(!l)return;let y=x=>{let w=x.target;p.current&&!p.current.contains(w)&&d.current&&!d.current.contains(w)&&c(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[l]),!(t||a||r||n||s||o))return null;let h=[{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),b=async(y,x)=>{if(x){u(y);try{await x();}catch(w){console.error(`Export ${y} failed:`,w);}finally{u(null),c(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:p,onClick:()=>c(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:m.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:l&&jsx(motion.div,{ref: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:h.map((y,x)=>jsxs(motion.button,{onClick:()=>b(y.id,y.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<h.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:i===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 ad({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:n,onCopySnapshotLink:s}){let[o,l]=useState(false),[c,i]=useState(null),[u,p]=useState(false),d=useRef(null),m=useRef(null),f=Kr(),v=Ks(d,o,"right",224),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=f.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!o)return;let k=M=>{let I=M.target;d.current&&!d.current.contains(I)&&m.current&&!m.current.contains(I)&&l(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[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(k=>k.handler),x=async(k,M)=>{if(M){i(k);try{await M();}catch(I){console.error(`Export ${k} failed:`,I);}finally{i(null),l(false);}}},w=()=>{s?.(),p(true),setTimeout(()=>p(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:d,onClick:()=>l(!o),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:o?e.accent:e.textTertiary,backgroundColor:o?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:f.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:o&&jsxs(motion.div,{ref: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: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:[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:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:y.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:h?"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))})]}),y.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"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:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:w,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color: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*.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 Mv({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 Pv({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 rd({theme:e,value:t,onChange:a,maxDepth:r}){let[n,s]=useState(false),o=useRef(null),l=useRef(null),c=Kr(),i=Ks(o,n,"left");useEffect(()=>{if(!n)return;let d=m=>{let f=m.target;o.current&&!o.current.contains(f)&&l.current&&!l.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:`L${m+1}`}))],p=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"}: ${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:l,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:u.map((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 nd({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:n}){let[s,o]=useState(false),l=useRef(null),c=useRef(null),i=Kr(),u=Ks(l,s,"left");useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let v=b=>{let y=b.target;l.current&&!l.current.contains(y)&&c.current&&!c.current.contains(y)&&o(false);},h=b=>{b.key==="Escape"&&o(false);};document.addEventListener("mousedown",v),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(f),c._cleanup&&c._cleanup();}},[s]);let p=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],d=t!=="all"||r,m=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:l,onClick:f=>{f.stopPropagation(),o(v=>!v);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:d?m?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${d?m?"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:i.toolbar.filter||"Filters"}),d&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#00E5CC"}})]}),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:m?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${m?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:m?"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:m?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:m?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:p.map(f=>{let v=t===f.value&&!r,h=()=>f.value==="all"?v?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):f.icon;return jsxs(motion.button,{onClick:()=>{a(f.value),n&&n(false),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:v?m?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:m?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${v?f.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:m?"rgba(255,255,255,0.85)":"#111827"},children:f.label}),v&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},f.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:m?"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?m?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:m?"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":m?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:m?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function Em({value:e,onChange:t,theme:a}){let r=Kr(),n=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":a.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":a.border}`},children:s.map(o=>{let l=e===o.value;return jsx(motion.button,{onClick:()=>t(o.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:l?n?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:l?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function Fv({theme:e,forecast:t}){let a=Kr(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",n=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,o=s!=null,l=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,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},i=t?.confidencePercent,u=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,p=t?.costAtCompletion,d=t?.currency||"$",m=p!=null?p>=1e6?`${d}${(p/1e6).toFixed(2)}M`:p>=1e3?`${d}${(p/1e3).toFixed(1)}K`:`${d}${p.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,v=f!=null&&f!==0,h=f!=null?f>0?`+${f.toFixed(0)}% ${a.toolbar.budgetOver}`:`${f.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,b=f!=null&&f>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:f!=null&&f<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-6",children:[jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:a.toolbar.projectForecast}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.expectedFinish,": ",n]}),o&&l&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.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:[a.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:u,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:m}),v&&h&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:b.bg,color:b.text,fontFamily:"'JetBrains Mono', monospace"},children:h})]})]})]})}function Mm({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:l,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:u,hasDependencies:p=true}){let[d,m]=useState(false),f=useRef(null),v=useRef(null),h=Kr(),b=Ks(f,d,"right",208),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!d)return;let M=I=>{let C=I.target;f.current&&!f.current.contains(C)&&v.current&&!v.current.contains(C)&&m(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[d]);let x=h.toolbar.visibility==="Visibilidad",w=[{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:l,onChange:c}],k=[{value:"compact",label:h.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:h.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:h.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:b.top,left:b.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:h.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:w.map((M,I)=>{let C=M.icon,N=M.disabled,P=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?y?"rgba(255,255,255,0.3)":"#9CA3AF":y?"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:I*.03},title:P,children:[jsx(C,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:N?y?"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: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:h.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),k.map((M,I)=>{let C=i===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: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+I)*.03},children:[jsx("span",{style:{color:C?e.accent||"#00E5CC":y?"rgba(255,255,255,0.85)":e.textPrimary},children:M.label}),C&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.value)})]})]})}),document.body)]})}function Lv({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);},l=c=>{c.key==="Escape"&&n(false);};return document.addEventListener("mousedown",o),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",l);}},[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 Qi({enCabecera:e=false,theme:t,timeScale:a,onTimeScaleChange:r,zoom:n,onZoomChange:s,currentTheme:o,onThemeChange:l,rowDensity:c,onRowDensityChange:i,showThemeSelector:u=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:m,taskFilter:f="all",onTaskFilterChange:v,hideCompleted:h=false,onHideCompletedChange:b,toolbarRightContent:y,wbsLevel:x,onWbsLevelChange:w,maxWbsDepth:k=4,viewMode:M="execution",onViewModeChange:I,projectForecast:C,hideForecastHud:N,onExportPNG:P,onExportPDF:T,onExportExcel:V,onExportCSV:O,onExportJSON:J,onExportMSProject:L,showCriticalPath:Ie=true,onShowCriticalPathChange:G,showDependencies:ke=true,onShowDependenciesChange:R,highlightWeekends:U=true,onHighlightWeekendsChange:Pe,showBaseline:Ze=false,onShowBaselineChange:oe,onCopySnapshotLink:Fe,hasDependencies:Q=true}){let Se=Kr(),Ue=P||T||V||O||J||L,Le=!!t.glassToolbar,Be=[{value:"day",label:Se.toolbar.day},{value:"week",label:Se.toolbar.week},{value:"month",label:Se.toolbar.month}],ot=[{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"})}],se=t.bgPrimary==="#050505"||t.textPrimary==="#FFFFFF";if(e)return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Em,{value:a,onChange:r,theme:t}),v&&jsx(nd,{theme:t,value:f,onChange:v,hideCompleted:h,onHideCompletedChange:b}),y,jsx(Mm,{theme:t,showCriticalPath:Ie,onShowCriticalPathChange:G,showBaseline:Ze,onShowBaselineChange:oe,highlightWeekends:U,onHighlightWeekendsChange:Pe,showDependencies:ke,onShowDependenciesChange:R,rowDensity:c,onRowDensityChange:i,hasDependencies:Q}),jsx(ad,{theme:t,onExportPNG:P,onExportPDF:T,onExportExcel:V,onExportMSProject:L,onCopySnapshotLink:Fe}),(I||w)&&jsxs(Lv,{theme:t,etiqueta:Se.toolbar.today==="Hoy"?"M\xE1s opciones":"More options",children:[I&&jsx("div",{className:"flex flex-col gap-1",children:["execution","oracle"].map(je=>jsxs("button",{type:"button",onClick:()=>I(je),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===je?se?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.05)":"transparent"},children:[je==="execution"?Se.toolbar.viewExecution:Se.toolbar.viewOracle,M===je&&jsx(Check,{className:"w-3.5 h-3.5"})]},je))}),w&&jsx("div",{className:"pt-1 mt-1",style:{borderTop:`1px solid ${t.borderLight}`},children:jsx(rd,{theme:t,value:x??"all",onChange:w,maxDepth:k})})]})]});if(Le){let je=se?"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:I&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:se?"#000000":t.bgSecondary,border:`1px solid ${se?"rgba(255,255,255,0.08)":t.border}`},children:[jsx(motion.button,{onClick:()=>I("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:M==="execution"?se?"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:Se.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>I("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:M==="oracle"?se?"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:Se.toolbar.viewOracle})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Em,{value:a,onChange:r,theme:t}),jsx("div",{className:"w-px h-5",style:{backgroundColor:je}}),w&&jsx(rd,{theme:t,value:x??"all",onChange:w,maxDepth:k}),v&&jsx(nd,{theme:t,value:f,onChange:v,hideCompleted:h,onHideCompletedChange:b}),y&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:je}}),y]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:je}}),jsx(Mm,{theme:t,showCriticalPath:Ie,onShowCriticalPathChange:G,showBaseline:Ze,onShowBaselineChange:oe,highlightWeekends:U,onHighlightWeekendsChange:Pe,showDependencies:ke,onShowDependenciesChange:R,rowDensity:c,onRowDensityChange:i,hasDependencies:Q}),jsx(ad,{theme:t,onExportPNG:P,onExportPDF:T,onExportExcel:V,onExportMSProject:L,onCopySnapshotLink:Fe}),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 ${se?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${se?"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||Se.toolbar.createTask})]})]})]}),C&&!N&&jsx(Fv,{theme:t,forecast:C})]})}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(Pv,{options:Be,value:a,onChange:je=>r(je),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(rd,{theme:t,value:x??"all",onChange:w,maxDepth:k}),v&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),jsx(nd,{theme:t,value:f,onChange:v,hideCompleted:h,onHideCompletedChange:b})]})]}),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}})]}),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||Se.toolbar.createTask})]}),(Ue||u)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}})]}),jsx(ad,{theme:t,onExportPNG:P,onExportPDF:T,onExportExcel:V,onExportMSProject:L,onCopySnapshotLink:Fe}),u&&jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}}),u&&jsx(Mv,{options:ot,value:o,onChange:je=>l(je),theme:t})]})]})}function Zi({columns:e,onToggleColumn:t,theme:a}){let[r,n]=useState(false),[s,o]=useState({x:0,y:0}),l=useRef(null),c=useRef(null);useEffect(()=>{if(!r)return;let u=p=>{l.current&&!l.current.contains(p.target)&&n(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let u=c.current.getBoundingClientRect();o({x:u.left,y:u.bottom+4});}n(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(ia,{children:jsx(motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:p=>{p.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 cs({isOpen:e,x:t,y:a,items:r,onClose:n,theme:s}){let o=useRef(null),[l,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,h=a;t+u+d>m&&(v=t-u,v<d&&(v=d)),a+p+d>f&&(h=f-p-d,h<d&&(h=d)),c({x:v,y:h});},[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 i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:o,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(u=>jsxs("div",{children:[u.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),n());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter: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 ra={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 Wm({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:p,enableKeyboard:d=true}){let m=useRef(false),f=useCallback(x=>{m.current=x;},[]),v=useCallback(x=>{let w=[],k=M=>{for(let I of M)w.push(I),I.subtasks&&I.subtasks.length>0&&I.isExpanded&&k(I.subtasks);};return k(x),w},[]),h=useCallback(()=>{let x=v(e);for(let w of x)if(t.has(w.id))return w;return null},[e,t,v]),b=useCallback((x,w)=>{let k=v(e);if(k.length===0)return;let M=h();if(!M){a(k[0].id,false);return}let I=k.findIndex(P=>P.id===M.id);if(I===-1)return;let C=x==="up"?I-1:I+1;if(C<0||C>=k.length)return;let N=k[C];a(N.id,w);},[e,h,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 I=navigator.platform.toUpperCase().indexOf("MAC")>=0?x.metaKey:x.ctrlKey,C=Array.from(t),N=h();if(x.key==="ArrowUp"){x.preventDefault(),b("up",x.shiftKey);return}if(x.key==="ArrowDown"){x.preventDefault(),b("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")){C.length>0&&(x.preventDefault(),o(C,x.key==="ArrowUp"?"up":"down"));return}if(x.key==="Tab"&&!x.shiftKey){C.length>0&&(x.preventDefault(),l(C));return}if(x.key==="Tab"&&x.shiftKey){C.length>0&&(x.preventDefault(),c(C));return}if(x.key==="Enter"&&!x.shiftKey&&!I){N&&(x.preventDefault(),r(N.id,"below"));return}if(x.key==="Enter"&&x.shiftKey&&!I){N&&(x.preventDefault(),r(N.id,"above"));return}if(x.key==="Enter"&&I){N&&(x.preventDefault(),p(N.id));return}if(x.key==="F2"){N&&(x.preventDefault(),i(N.id));return}if(x.key==="Delete"||x.key==="Backspace"&&I){C.length>0&&(x.preventDefault(),n(C));return}if(x.key==="d"&&I&&!x.shiftKey){C.length>0&&(x.preventDefault(),s(C));return}},[d,t,h,b,r,n,s,o,l,c,i,u,p]);return useEffect(()=>{if(d)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[d,y]),{setIsEditing:f}}function Gm(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);},[]),l=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 h=Math.min(f,v),b=Math.max(f,v),y=m.slice(h,b+1);a(new Set(y)),n(d);},[r,s]),c=useCallback((d,m,f,v)=>{v?l(d,m):f?o(d):s(d);},[s,o,l]),i=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:l,handleTaskClick:c,handleKeyboardSelection:i,clearSelection:u,isTaskSelected:p}}function cd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?cd(t.subtasks):t.subtasks}))}function Io(e){let t=[],a=(r,n,s=0)=>{let o=[...r].sort((l,c)=>(l.position??0)-(c.position??0));for(let l=0;l<o.length;l++){let c={...o[l],parentId:n,level:s,position:o[l].position??l};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function ds(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ds(a.subtasks,t);if(r)return r}}return null}function ld(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(n=>n.id===t))return a;let r=ld(a.subtasks,t);if(r)return r}return null}function dd(e,t){if(t.length===0)return e;let a=Io(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(h=>{if(m.has(h.id))return f.push(h),false;if(h.subtasks){let b=o(h.subtasks,m);h.subtasks=b.tasks,f.push(...b.removed);}return true}),removed:f}},l=(d,m,f)=>d.map(v=>v.id===m?{...v,subtasks:[...v.subtasks||[],...f],isExpanded:true}:v.subtasks?{...v,subtasks:l(v.subtasks,m,f)}:v),c=new Set(t),{tasks:i,removed:u}=o(e,c),p=l(i,s.id,u);return cd(p)}function ud(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let n=ld(a,r);if(!n)continue;let s=ld(a,n.id),o=(i,u,p)=>{for(let d=0;d<i.length;d++){let m=i[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},l=(i,u,p)=>{let d=i.findIndex(m=>m.id===u);if(d!==-1)return i.splice(d+1,0,p),i;for(let m of i)m.subtasks&&l(m.subtasks,u,p);return i},c=o(a,n.id,r);c&&(s&&s.subtasks?l(s.subtasks,n.id,c):l(a,n.id,c));}return cd(a)}function pd(e,t,a){if(t.length===0)return e;let r=[...e],n=t[0],s=(o,l,c)=>{let i=o.findIndex(p=>p.id===l);if(i===-1){for(let p of o)if(p.subtasks&&s(p.subtasks,l,c))return true;return false}let u=c==="up"?i-1:i+1;return u<0||u>=o.length?false:([o[i],o[u]]=[o[u],o[i]],o[i]={...o[i],position:i},o[u]={...o[u],position:u},true)};return s(r,n,a),r}function md(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 Ys(e,t){let a=[...e],r=[];for(let n of t){let s=(c,i)=>c.map((u,p)=>({...u,id:`${u.id}-copy-${Date.now()}-${p}`,parentId:i,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${p}`):void 0})),o=c=>{let i=c.findIndex(m=>m.id===n);if(i===-1){for(let m of c)if(m.subtasks){let f=o(m.subtasks);if(f)return f}return null}let u=c[i],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(i+1,0,d),d},l=o(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function Vm(e,t,a){let r=[...e],n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:s,color:"#00E5CC"},l=c=>{let i=c.findIndex(p=>p.id===t);if(i===-1){for(let p of c)if(p.subtasks&&l(p.subtasks))return true;return false}let u=a==="above"?i:i+1;return c.splice(u,0,o),true};return l(r),{tasks:r,newTask:o}}function gd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:gd(r.subtasks,t,a)}:r)}function fd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:fd(a.subtasks,t)}:a)}function bd(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,l=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},i=c(e),u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(l),color:r?.color||"#00E5CC",position:i,parentId:t},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 jm(e,t,a,r){if(t===a)return e;let n=ds(e,t);if(!n)return e;if(a){let l=(c,i)=>{if(!c.subtasks)return false;for(let u of c.subtasks)if(u.id===i||l(u,i))return true;return false};if(l(n,a))return e}let s=l=>{let c=l.filter(u=>u.id!==t),i=c.length<l.length;return c.map((u,p)=>{let d=i?{...u,position:p}:u;return d.subtasks&&d.subtasks.length>0?{...d,subtasks:s(d.subtasks)}:d})},o=s(e);if(a===null){let l=r!==void 0?r:o.length;o.splice(l,0,{...n,parentId:void 0}),o=o.map((c,i)=>({...c,position:i}));}else {let l=c=>c.map(i=>{if(i.id===a){let u=i.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 {...i,subtasks:m,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});o=l(o);}return o}function qr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=qr(t.subtasks),r=a.reduce((l,c)=>(c.startDate&&l.starts.push(new Date(c.startDate).getTime()),c.endDate&&l.ends.push(new Date(c.endDate).getTime()),l.progresses.push(c.progress??0),l),{starts:[],ends:[],progresses:[]}),n=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,o=r.progresses.length>0?Math.round(r.progresses.reduce((l,c)=>l+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:n,endDate:s,progress:o}})}function tl({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:n,onTaskClick:s,onTaskSelectionChange:o,selectedTaskId:l,onTaskDblClick:c,onTaskContextMenu:i,onTaskToggle:u,scrollTop:p,columns:d,onToggleColumn:m,onColumnResize:f,onTaskUpdate:v,onBulkFill:h,onTaskIndent:b,onTaskOutdent:y,onTaskMove:x,onMultiTaskDelete:w,onTaskDuplicate:k,onTaskCreate:M,onTaskRename:I,onCreateSubtask:C,onOpenTaskModal:N,onDeleteRequest:P,onTaskReparent:T,allTasks:V,scrollContainerRef:O,showCriticalPath:J=false}){let L=useContext(ls),[Ie,G]=useState(null),[ke,R]=useState(null),[U,Pe]=useState(""),Ze=useRef(null),[oe,Fe]=useState(null),[Q,Se]=useState(0),[Ue,Le]=useState(0),[Be,ot]=useState({isOpen:false,x:0,y:0,type:"header"}),[se,je]=useState(null),[Xe,$e]=useState(null),[mt,Et]=useState(null),st=useRef(0),Ne=5,lt=useRef(false),[Mt,Oe]=useState(null),[xt,A]=useState(false),X=useRef(null),[we,B]=useState(null),[q,he]=useState(null),[Ae,ye]=useState(false),tt=useRef(null);useEffect(()=>{function de(ue){tt.current&&!tt.current.contains(ue.target)&&ye(false);}if(Ae)return document.addEventListener("mousedown",de),()=>document.removeEventListener("mousedown",de)},[Ae]),useEffect(()=>{ke&&Ze.current&&(Ze.current.focus(),Ze.current.select());},[ke]),useEffect(()=>{if(!oe)return;let de=gt=>{let j=gt.clientX-Q,fe=Ue+j;f?.(oe,fe);},ue=()=>{Fe(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",de),document.addEventListener("mouseup",ue),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",de),document.removeEventListener("mouseup",ue),document.body.style.cursor="",document.body.style.userSelect="";}},[oe,Q,Ue,f]);let{selectedTaskIds:ie,handleTaskClick:ce,isTaskSelected:He}=Gm(l),{setIsEditing:at}=Wm({tasks:e,selectedTaskIds:ie,onTaskSelect:(de,ue)=>{let j=Io(e).map(fe=>fe.id);ce(de,j,ue||false,false),o?.(de);},onTaskCreate:M||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:k||(()=>{}),onTaskMove:x||(()=>{}),onTaskIndent:b||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:de=>{let ue=Io(e).find(gt=>gt.id===de);ue&&Da(ue);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:de=>{let ue=Io(e).find(gt=>gt.id===de);ue&&N&&N(ue);},enableKeyboard:true}),ft=(de,ue=0,gt="")=>{let j=[],fe=[...de].sort((ae,$)=>(ae.position??0)-($.position??0));for(let ae=0;ae<fe.length;ae++){let $=fe[ae],ee=ae+1,Ce=gt?`${gt}.${ee}`:`${ee}.0`,D=$.wbsCode||Ce;if($.wbsCode=D,j.push({task:$,level:ue}),$.subtasks&&$.subtasks.length>0&&$.isExpanded){let pe=$.wbsCode?.replace(/\.0$/,"")||(gt?`${gt}.${ee}`:`${ee}`);j.push(...ft($.subtasks,ue+1,pe));}}return j},Ye=ft(e),vt=48,Yt=Math.max(Ye.length*a,600-vt),ba=(de,ue)=>ue==="assignees"?de.assignees:ue==="startDate"?de.startDate:de.endDate,ca=(de,ue,gt,j)=>{de.preventDefault(),de.stopPropagation(),B({sourceTaskId:ue,column:gt,sourceIndex:j,targetIndex:j}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let fe=de.currentTarget.closest("[data-grid-body]"),ae=rt=>{let ge=fe?.getBoundingClientRect().top??0,K=Math.floor((rt-ge)/a);return K=Math.max(0,Math.min(Ye.length-1,K)),K<j&&(K=j),K},$=de.clientY,ee=O?.current??null,Ce=()=>{X.current&&(cancelAnimationFrame(X.current),X.current=null);},D=()=>{let rt=ae($);B(ge=>ge&&{...ge,targetIndex:rt});},W=()=>{if(Ce(),!ee)return;let rt=ee.getBoundingClientRect(),ge=60,K=12,ct=$-rt.top,bt=rt.bottom-$;if(bt<ge&&ee.scrollTop<ee.scrollHeight-ee.clientHeight){let Pt=Math.max(1,Math.round(K*(1-Math.max(0,bt)/ge))),Zt=()=>{ee.scrollTop+=Pt,D(),ee.scrollTop<ee.scrollHeight-ee.clientHeight&&(X.current=requestAnimationFrame(Zt));};X.current=requestAnimationFrame(Zt);}else if(ct<ge&&ee.scrollTop>0){let Pt=Math.max(1,Math.round(K*(1-Math.max(0,ct)/ge))),Zt=()=>{ee.scrollTop-=Pt,D(),ee.scrollTop>0&&(X.current=requestAnimationFrame(Zt));};X.current=requestAnimationFrame(Zt);}},pe=rt=>{$=rt.clientY,D(),W();},ve=rt=>{window.removeEventListener("mousemove",pe),window.removeEventListener("mouseup",ve),Ce(),document.body.style.cursor="",document.body.style.userSelect="",B(null);let ge=ae(rt.clientY),K=Ye.find(hr=>hr.task.id===ue)?.task;if(!K)return;let ct=ba(K,gt),bt=Math.min(j,ge),Pt=Math.max(j,ge),Zt=[];for(let hr=bt;hr<=Pt;hr++){if(hr===j)continue;let _a=Ye[hr]?.task;!_a||_a.subtasks&&_a.subtasks.length>0||Zt.push(_a.id);}Zt.length!==0&&h?.(Zt,gt,ct);};window.addEventListener("mousemove",pe),window.addEventListener("mouseup",ve);},Gt=de=>{if(!we)return false;let ue=Math.min(we.sourceIndex,we.targetIndex),gt=Math.max(we.sourceIndex,we.targetIndex);return de>=ue&&de<=gt},Bt=de=>!de.startDate||!de.endDate?"-":`${Math.ceil((de.endDate.getTime()-de.startDate.getTime())/(1e3*60*60*24))}d`,Da=de=>{R(de.id),Pe(de.name),at(true);},Ht=de=>{U.trim()&&U!==e.find(ue=>ue.id===de)?.name&&I?.(de,U.trim()),R(null),Pe(""),at(false);},kr=()=>{R(null),Pe(""),at(false);},da=(de,ue)=>{ue.stopPropagation(),C?.(de.id);},pr=(de,ue)=>{ue.preventDefault(),st.current=ue.clientY,je(de),lt.current=false,A(false),Oe({x:ue.clientX,y:ue.clientY});},et=de=>{if(!se||(Math.abs(de.clientY-st.current)>Ne&&!lt.current&&(lt.current=true,A(true)),Oe({x:de.clientX,y:de.clientY}),!lt.current))return;if(O?.current){let ae=O.current,$=ae.getBoundingClientRect(),ee=60,Ce=12;X.current&&(cancelAnimationFrame(X.current),X.current=null);let D=de.clientY-$.top,W=$.bottom-de.clientY;if(D<ee&&ae.scrollTop>0){let pe=Math.round(Ce*(1-D/ee)),ve=()=>{ae.scrollTop-=pe,lt.current&&ae.scrollTop>0&&(X.current=requestAnimationFrame(ve));};X.current=requestAnimationFrame(ve);}else if(W<ee&&ae.scrollTop<ae.scrollHeight-ae.clientHeight){let pe=Math.round(Ce*(1-W/ee)),ve=()=>{ae.scrollTop+=pe,lt.current&&ae.scrollTop<ae.scrollHeight-ae.clientHeight&&(X.current=requestAnimationFrame(ve));};X.current=requestAnimationFrame(ve);}}let gt=document.querySelectorAll("[data-task-row]"),j=null,fe=null;gt.forEach(ae=>{let $=ae.getBoundingClientRect(),ee=ae.getAttribute("data-task-row");if(ee&&ee!==se&&de.clientY>=$.top&&de.clientY<=$.bottom){j=ee;let Ce=de.clientY-$.top,D=$.height;Ce<D*.25?fe="above":Ce>D*.75?fe="below":fe="child";}}),$e(j),Et(fe);},Je=()=>{if(lt.current&&se&&Xe&&mt){if(mt==="child")T?.(se,Xe);else if(mt==="above"||mt==="below"){let de=(ae,$,ee=null)=>{for(let Ce of ae){if(Ce.id===$)return ee;if(Ce.subtasks){let D=de(Ce.subtasks,$,Ce.id);if(D!==void 0)return D}}},ue=V&&V.length>0?V:e,gt=de(ue,se,null),j=de(ue,Xe,null),fe=(ae,$,ee,Ce)=>{let D=ae.findIndex(ve=>ve.id===$),W=Ce?ae.findIndex(ve=>ve.id===ee):-1,pe=mt==="below"?D+1:D;return Ce&&W!==-1&&W<D&&(pe-=1),Math.max(0,pe)};if(j===null){let $=fe(ue,Xe,se,gt===null);T?.(se,null,$);}else {let ae=ds(ue,j);if(ae?.subtasks){let $=gt===j,ee=fe(ae.subtasks,Xe,se,$);T?.(se,j,ee);}}}}X.current&&(cancelAnimationFrame(X.current),X.current=null),je(null),$e(null),Et(null),Oe(null),lt.current=false,A(false);};useEffect(()=>{if(se)return document.addEventListener("mousemove",et),document.addEventListener("mouseup",Je),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",et),document.removeEventListener("mouseup",Je),document.body.style.cursor="",document.body.style.userSelect="";}},[se,Xe,mt]);let Aa=(de,ue,gt)=>{let j=ue.subtasks&&ue.subtasks.length>0;switch(de.id){case "name":let fe=ke===ue.id,ae=Ie===ue.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${gt*20}px`},children:[T&&jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:ae?1:.3},onMouseDown:K=>pr(ue.id,K),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),ue.subtasks&&ue.subtasks.length>0?jsx("button",{onClick:K=>{K.stopPropagation(),u?.(ue.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ue.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"}),fe?jsx("input",{ref:Ze,type:"text",value:U,onChange:K=>Pe(K.target.value),onKeyDown:K=>{K.key==="Enter"?Ht(ue.id):K.key==="Escape"&&kr();},onBlur:()=>Ht(ue.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:K=>K.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:ue.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ue.parentId?"13px":"14px",fontWeight:ue.isMilestone?600:ue.parentId?400:600,letterSpacing:ue.parentId?"0":"-0.01em"},title:ue.name,children:[ue.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:ue.wbsCode}),ue.isHighlighted&&ue.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:ue.name}),ue.subtasks&&ue.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(ue.progress||0),"%"]}),J&&ue.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),J&&ue.cpmData&&jsxs("span",{style:{color:ue.cpmData.totalFloat<=0?"#EF4444":ue.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(ue.cpmData.totalFloat),"d"]})]}),ae&&!fe&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:K=>K.stopPropagation(),children:[jsx("button",{onClick:K=>da(ue,K),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:K=>{K.stopPropagation(),Da(ue);},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 ee=de.id==="startDate"?"startDate":"endDate",Ce=ue[ee],D=q?.taskId===ue.id&&q?.field===ee,W=K=>K?(typeof K=="string"?new Date(K):K).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:K=>K.stopPropagation(),children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:j?.5:1,cursor:j?"default":"pointer"},title:j?"Auto-calculated from subtasks":void 0,onClick:K=>{if(!j)if(D)he(null);else {let ct=K.currentTarget.getBoundingClientRect();he({taskId:ue.id,field:ee,month:Ce?typeof Ce=="string"?new Date(Ce):Ce:new Date,position:{top:ct.bottom+4,left:ct.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:W(Ce)}),j&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),D&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>he(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:q?.position.top,left:q?.position.left},onClick:K=>K.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let K=new Date,ct=new Date(K);ct.setDate(K.getDate()+1);let bt=new Date(K);bt.setDate(K.getDate()+7);let Pt=new Date(K);return Pt.setDate(K.getDate()+14),[{label:"Hoy",date:K},{label:"Ma\xF1ana",date:ct},{label:"Pr\xF3xima semana",date:bt},{label:"2 semanas",date:Pt}].map((hr,_a)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:en=>en.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:en=>en.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(ue.id,{[ee]:hr.date}),he(null);},children:hr.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:K=>K.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:K=>K.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(ue.id,{[ee]:void 0}),he(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:()=>he(K=>K?{...K,month:new Date(K.month.getFullYear(),K.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:q?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>he(K=>K?{...K,month:new Date(K.month.getFullYear(),K.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((K,ct)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:K},ct))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let K=q?.month||new Date,ct=K.getFullYear(),bt=K.getMonth(),Pt=new Date(ct,bt,1).getDay(),Zt=new Date(ct,bt+1,0).getDate(),hr=new Date,_a=[];for(let ea=Pt-1;ea>=0;ea--)_a.push({day:new Date(ct,bt,-ea).getDate(),date:new Date(ct,bt-1,new Date(ct,bt,-ea).getDate()),isCurrentMonth:false});for(let ea=1;ea<=Zt;ea++)_a.push({day:ea,date:new Date(ct,bt,ea),isCurrentMonth:true});let en=42-_a.length;for(let ea=1;ea<=en;ea++)_a.push({day:ea,date:new Date(ct,bt+1,ea),isCurrentMonth:false});return _a.map((ea,yo)=>{let jn=ea.date.toDateString()===hr.toDateString(),_n=(Ce?typeof Ce=="string"?new Date(Ce):Ce:null)?.toDateString()===ea.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:ea.isCurrentMonth?_n?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:_n?"#00E5CC":"transparent",boxShadow:jn&&!_n?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{v?.(ue.id,{[ee]:ea.date}),he(null);},children:ea.day},yo)})})()})]})]})]}),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:Bt(ue)})});case "assignees":if(j)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 pe=r.filter(K=>ue.assignees?.some(ct=>ct.id?ct.id===K.id:ct.name===K.name||ct.initials===K.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:K=>K.stopPropagation(),children:jsx(No,{assignedUsers:pe,availableUsers:r,onChange:K=>{let ct=K.map(bt=>({id:bt.id,name:bt.name,initials:bt.initials,color:bt.color}));v?.(ue.id,{assignees:ct});}})});case "status":if(j){let K=ue.progress===100?"\u2713":ue.progress>0?"\u25D0":"\u25CB";return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:K})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:K=>K.stopPropagation(),children:jsx(fp,{status:ue.status||"todo",onChange:K=>{v?.(ue.id,{status:K,progress:K==="completed"?100:ue.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:j?.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:`${ue.progress}%`,backgroundColor:ue.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:[ue.progress,"%"]})]});case "priority":let ve={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},rt={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ge=ve[ue.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:K=>K.stopPropagation(),children:jsx(Co,{priority:ge,onChange:K=>{K&&v?.(ue.id,{priority:rt[K]||"medium"});}})});default:return null}},ja=de=>[{id:"hide",label:"Hide Column",icon:ra.Hide,onClick:()=>m(de),disabled:de==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ra.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ra.SortDesc,onClick:()=>{}}],or=de=>{let ue=de.subtasks&&de.subtasks.length>0,gt=Io(e),j=ie.size>1&&ie.has(de.id),fe=j?gt.filter(D=>ie.has(D.id)):[de],ae=fe.map(D=>D.id),$=fe.filter(D=>!(D.subtasks&&D.subtasks.length>0)),ee=j?` (${ae.length})`:"",Ce=()=>{P?P(ae,de.name):w?.(ae);};return ue?[{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:ra.Add,onClick:()=>{C?.(de.id);}},{id:"duplicate",label:(L?.contextMenu?.duplicateTask||"Duplicate Task")+ee,icon:ra.Duplicate,onClick:()=>{k?.(ae);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(L?.contextMenu?.deleteTask||"Delete Task")+ee,icon:ra.Delete,onClick:Ce}]:[{id:"edit",label:L?.contextMenu?.editTask||"Edit Task",icon:ra.Pencil,onClick:()=>{c?.(de);}},{id:"addSubtask",label:L?.contextMenu?.addSubtask||"Add Subtask",icon:ra.Add,onClick:()=>{C?.(de.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(L?.contextMenu?.markIncomplete||"Mark Incomplete")+ee,icon:ra.MarkIncomplete,onClick:()=>{$.forEach(D=>v?.(D.id,{status:"todo",progress:0}));},disabled:$.length===0||$.every(D=>D.status==="todo")},{id:"setInProgress",label:(L?.contextMenu?.setInProgress||"Set In Progress")+ee,icon:ra.SetInProgress,onClick:()=>{$.forEach(D=>v?.(D.id,{status:"in-progress"}));},disabled:$.length===0||$.every(D=>D.status==="in-progress")},{id:"markComplete",label:(L?.contextMenu?.markComplete||"Mark Complete")+ee,icon:ra.MarkComplete,onClick:()=>{$.forEach(D=>v?.(D.id,{status:"completed",progress:100}));},disabled:$.length===0||$.every(D=>D.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(L?.contextMenu?.duplicateTask||"Duplicate Task")+ee,icon:ra.Duplicate,onClick:()=>{k?.(ae);}},{id:"split",label:L?.contextMenu?.splitTask||"Split Task",icon:ra.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(L?.contextMenu?.deleteTask||"Delete Task")+ee,icon:ra.Delete,onClick:Ce}]},Ca=d.filter(de=>de.visible),Wa=Ca.reduce((de,ue)=>de+ue.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Wa},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${vt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:Ca.map((de,ue)=>{let gt=ue===Ca.length-1,j=de.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${j?"":"justify-center"}`,style:{width:`${de.width}px`,minWidth:`${de.minWidth??(j?200:60)}px`,maxWidth:`${de.maxWidth??2e3}px`,flexShrink:j&&Ca.length===1?1:0,flexGrow:j&&Ca.length===1?1:0,borderRight:gt?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:fe=>{fe.preventDefault(),ot({isOpen:true,x:fe.clientX,y:fe.clientY,type:"header",columnId:de.id});},onMouseEnter:fe=>{fe.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:fe=>{fe.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:de.label,children:de.label}),de.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:oe===de.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:fe=>{fe.preventDefault(),fe.stopPropagation(),Fe(de.id),Se(fe.clientX),Le(de.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:oe===de.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},de.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(Zi,{columns:d,onToggleColumn:m,theme:t}),jsx("button",{onClick:()=>ye(!Ae),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"})}),Ae&&jsxs("div",{ref:tt,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:de=>de.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:()=>ye(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content","data-grid-body":true,style:{minHeight:Yt},children:Ye.map(({task:de,level:ue},gt)=>{let j=He(de.id),fe=Gt(gt),ae=Xe===de.id,$=ae&&mt==="above",ee=ae&&mt==="below",Ce=ae&&mt==="child",D={};return Ce&&(D.backgroundColor=`${t.accent}15`,D.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":de.id,className:`flex items-center cursor-pointer group ${se===de.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:j?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:j?t.accentLight:Ce?`${t.accent}15`:gt%2===0?t.bgPrimary:t.bgGrid,opacity:J?de.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...D},onMouseEnter:()=>G(de.id),onMouseLeave:()=>G(null),onClick:W=>{let ve=Io(e).map(K=>K.id),ge=navigator.platform.toUpperCase().indexOf("MAC")>=0?W.metaKey:W.ctrlKey;ce(de.id,ve,ge,W.shiftKey),o?.(de.id),!ge&&!W.shiftKey&&s?.(de);},onDoubleClick:W=>{W.stopPropagation(),c?.(de);},onContextMenu:W=>{W.preventDefault(),ot({isOpen:true,x:W.clientX,y:W.clientY,type:"task",task:de}),i?.(de,W);},whileHover:{backgroundColor:j?t.accentLight:t.hoverBg},children:[$&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ee&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ca.map((W,pe)=>{let ve=pe===Ca.length-1,rt=W.id==="name",ge=!!(de.subtasks&&de.subtasks.length>0),K=W.id==="assignees"||W.id==="startDate"||W.id==="endDate"?W.id:null,bt=!!K&&!ge&&Ie===de.id&&!we,Pt=fe&&!!we&&we.column===W.id;return jsxs("div",{className:`px-4 flex items-center ${rt?"justify-start":"justify-center"}`,style:{position:"relative",width:`${W.width}px`,minWidth:`${W.minWidth??(rt?200:60)}px`,maxWidth:`${W.maxWidth??2e3}px`,flexShrink:rt&&Ca.length===1?1:0,flexGrow:rt&&Ca.length===1?1:0,borderRight:ve?"none":`1px solid ${Ie===de.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:Pt?`${t.accent}22`:void 0,boxShadow:Pt?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[Aa(W,de,rt?ue:0),bt&&K&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Zt=>ca(Zt,de.id,K,gt),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}})]},`${de.id}-${W.id}`)})]},de.id)})}),jsx(cs,{isOpen:Be.isOpen,x:Be.x,y:Be.y,items:Be.type==="header"&&Be.columnId?ja(Be.columnId):Be.type==="task"&&Be.task?or(Be.task):[],onClose:()=>ot({...Be,isOpen:false}),theme:t}),xt&&Mt&&se&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Mt.x+12,top:Mt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let de=Ye.find(ue=>ue.task.id===se)?.task;return de?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:de.name})}):null})()}),document.body)]})}function Xm(e,t){let[a,r]=useState("none"),[n,s]=useState(0),[o,l]=useState(e),[c,i]=useState(t),[u,p]=useState(null),[d,m]=useState(null),[f,v]=useState(null),[h,b]=useState(null),[y,x]=useState(0),[w,k]=useState(0),[M,I]=useState(null),[C,N]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:p,hoveredTaskId:d,setHoveredTaskId:m,activeZone:f,setActiveZone:v,draggedSegmentIndex:h,setDraggedSegmentIndex:b,draggedSegmentStartX:y,setDraggedSegmentStartX:x,segmentDragOffsetX:w,setSegmentDragOffsetX:k,hoveredSegmentIndex:M,setHoveredSegmentIndex:I,isHovered:C,setIsHovered:N,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(J,L)=>{r("none"),p(null),m(null),l(J),i(L),k(0),b(null),x(0);}}}function al({task:e,x:t,y:a,width:r,theme:n,dayWidth:s,startDate:o,templates:l,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:p,onDependencyCreate:d,allTaskPositions:m=[],onDragMove:f,onHoverChange:v,showBaseline:h,showTaskBarLabels:b=true,showCriticalPath:y=true,readOnly:x=false,onProgressChange:w}){let k=Xm(t,r),M=useRef(null),I=useRef(false),C=useRef(null),N=useRef(null),{dragMode:P,setDragMode:T,dragOffset:V,setDragOffset:O,ghostX:J,setGhostX:L,ghostWidth:Ie,setGhostWidth:G,connectionLine:ke,setConnectionLine:R,hoveredTaskId:U,setHoveredTaskId:Pe,activeZone:Ze,setActiveZone:oe,draggedSegmentIndex:Fe,setDraggedSegmentIndex:Q,draggedSegmentStartX:Se,setDraggedSegmentStartX:Ue,segmentDragOffsetX:Le,setSegmentDragOffsetX:Be,hoveredSegmentIndex:ot,setHoveredSegmentIndex:se,isHovered:je,setIsHovered:Xe,isDragging:$e,isResizing:mt,isConnecting:Et,resetDragState:st}=k,Ne=18,lt=!!n.executionBarBg,Mt=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",Oe=lt?3:6,xt=e.subtasks&&e.subtasks.length>0,A=useRef(null),[X,we]=(()=>{let j=useRef(null),[,fe]=useState(0);return [j.current,ae=>{j.current=ae,fe($=>$+1);}]})(),B=!!w&&!x&&!xt&&!e.segments&&!!e.startDate&&!!e.endDate,q=e.endDate&&(()=>{let j=new Date;j.setHours(0,0,0,0);let fe=new Date(e.endDate);return fe.setHours(0,0,0,0),fe<j})()&&e.progress<100,he=y&&e.isCriticalPath,Ae=n.name==="neutral"||n.today==="#1C1917",ye=e.status==="completed"||e.progress===100,tt={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},ce=y&&e.isCriticalPath||q?"#EF4444":e.color?e.color:e.priority&&tt[e.priority]?tt[e.priority]:n.taskBarPrimary,He=x?"default":$e?Et?"crosshair":mt?"ew-resize":"grabbing":"grab",at=x?"default":"ew-resize",Ye=(j=>j>=80?20:j>=60?15:j>=50?12:10)(r),vt=r<50,Yt=r<40;useEffect(()=>{v&&(!je||$e||e.segments)&&v(null);},[je,$e,e.segments,v]);let ba=j=>j.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),ca=()=>{let j=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${j} day${j!==1?"s":""}`},Gt=j=>Math.round(j/s)*s,Bt=j=>{let fe=Math.round(j/s),ae=new Date(o);return ae.setDate(ae.getDate()+fe),ae},Da=(j,fe)=>{for(let ae of m){if(ae.id===e.id)continue;let $=5;if(j>=ae.x-$&&j<=ae.x+ae.width+$&&fe>=ae.y-$&&fe<=ae.y+ae.height+$)return ae.id}return null},Ht=useCallback((j,fe,ae)=>{if(x)return;j.preventDefault(),j.stopPropagation();let $=M.current?.ownerSVGElement;if(!$)return;let ee=$.createSVGPoint();ee.x=j.clientX,ee.y=j.clientY;let Ce=ee.matrixTransform($.getScreenCTM()?.inverse()),D=ae!==void 0?ae:t,W=fe;if(!W){let pe=Ce.x-D;j.shiftKey?(W="connect",R({x:t+r,y:a+Ne/2})):j.ctrlKey||j.metaKey?W="move":j.altKey?W=pe<r/2?"resize-start":"resize-end":Yt?pe<r/2?W="move":W="resize-end":vt?pe<=Ye/2?W="resize-start":pe>=r-Ye/2?W="resize-end":W="move":pe<=Ye?W="resize-start":pe>=r-Ye?W="resize-end":W="move";}I.current=false,T(W),Xe(false),oe(null),W==="move"?O(Ce.x-D):W==="connect"?R({x:t+r,y:a+Ne/2}):O(0),L(D),G(r);},[t,r,a,Ne,x]),kr=useCallback(j=>{let fe=M.current?.ownerSVGElement;if(!fe)return;let ae=fe.closest(".gantt-timeline-scroll");if(!ae)return;let $=ae.getBoundingClientRect(),ee=60,Ce=15,D=0;if(j.clientX<$.left+ee){let W=$.left+ee-j.clientX;D=-Math.min(Ce,W/2);}else if(j.clientX>$.right-ee){let W=j.clientX-($.right-ee);D=Math.min(Ce,W/2);}return D!==0&&(ae.scrollLeft+=D),D!==0},[]),da=useCallback(j=>{if(P==="none")return;I.current=true,N.current=j;let fe=M.current?.ownerSVGElement;if(!fe)return;if(P==="move"||P==="resize-start"||P==="resize-end"){let ee=kr(j);ee&&!C.current?C.current=window.setInterval(()=>{N.current&&(kr(N.current),da(N.current));},16):!ee&&C.current&&(window.clearInterval(C.current),C.current=null);}let ae=fe.createSVGPoint();ae.x=j.clientX,ae.y=j.clientY;let $=ae.matrixTransform(fe.getScreenCTM()?.inverse());if(P==="connect"){R({x:$.x,y:$.y});let ee=Da($.x,$.y);Pe(ee);}else if(P==="move"){let ee=$.x-V,Ce=Gt(ee);L(Ce),G(r);let D=Math.round((Ce-t)/s);if(f?.(e.id,D,true),e.segments&&e.segments.length>0&&Fe!==null){let W=Ce-Se;Be(W);}}else if(P==="resize-start"){let ee=$.x,Ce=Gt(ee),D=t+r-Ce;D>=s&&(L(Ce),G(D));}else if(P==="resize-end"){let ee=$.x,D=Gt(ee)-t;D>=s&&G(D);}},[P,t,r,s,V,e,Gt,Fe,Se,Da,Pe,R,L,G,Be,f,kr]),pr=useCallback(()=>{if(C.current&&(window.clearInterval(C.current),C.current=null),N.current=null,P!=="none"){if(P==="connect")U&&d&&d(e,U),R(null),Pe(null);else {let j=e.endDate.getTime()-e.startDate.getTime(),fe,ae,$=true;if(P==="move"){if(fe=Bt(J),ae=new Date(fe.getTime()+j),e.segments&&e.segments.length>0&&Fe!==null){let ee=Math.round(Le/s),Ce=e.segments.map((ve,rt)=>{if(rt===Fe){let ge=new Date(ve.startDate),K=new Date(ve.endDate);return ge.setDate(ge.getDate()+ee),K.setDate(K.getDate()+ee),{startDate:ge,endDate:K}}return ve}),D=Ce.flatMap(ve=>[ve.startDate,ve.endDate]),W=new Date(Math.min(...D.map(ve=>ve.getTime()))),pe=new Date(Math.max(...D.map(ve=>ve.getTime())));p?.({...e,segments:Ce},W,pe),st(t,r);return}}else P==="resize-start"?(fe=Bt(J),ae=e.endDate,fe>ae&&(console.warn("Invalid date range: start date must be before or equal to end date"),$=false)):P==="resize-end"?(fe=e.startDate,ae=Bt(J+Ie),ae.setDate(ae.getDate()-1),ae<fe&&(console.warn("Invalid date range: end date must be after or equal to start date"),$=false)):$=false;$&&fe&&ae&&(ae.getTime()<fe.getTime()?console.warn("Invalid date range: end date cannot be before start date"):p?.(e,fe,ae));}f?.(e.id,0,false),st(t,r);}},[P,J,Ie,e,p,U,d,t,r,s,Bt,Le,Fe,st,f]);useEffect(()=>{if(P==="none")return;let j=ae=>{da(ae);},fe=()=>{pr();};return window.addEventListener("mousemove",j),window.addEventListener("mouseup",fe),()=>{window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",fe),C.current&&(window.clearInterval(C.current),C.current=null);}},[P,da,pr]);let et=$e&&!Et?J:t,Je=$e&&!Et?Ie:r,Aa=l.taskClass(e),ja=24,or=y?e.isCriticalPath?1:.25:1,Ca=useCallback(j=>{if(!B)return;j.stopPropagation(),j.preventDefault();let ae=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;A.current={barRect:ae,initialPct:e.progress||0},j.currentTarget.setPointerCapture(j.pointerId),we(e.progress||0);},[B,e.progress,we]),Wa=useCallback(j=>{let fe=A.current;if(!fe)return;let $=M.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??fe.barRect;if(!$||$.width<=0)return;let ee=(j.clientX-$.left)/$.width,Ce=Math.round(Math.max(0,Math.min(1,ee))*100);j.shiftKey&&(Ce=Math.round(Ce/25)*25),we(Ce);},[we]),de=useCallback(j=>{let fe=A.current;if(!fe)return;j.stopPropagation(),j.preventDefault();try{j.currentTarget.releasePointerCapture(j.pointerId);}catch{}let ae=X;A.current=null,we(null),ae!=null&&ae!==fe.initialPct&&w&&w(e,ae);},[X,w,e,we]),ue=useCallback(j=>{j.stopPropagation(),j.preventDefault();},[]),gt=X??(e.progress||0);return jsxs("g",{ref:M,"data-task-bar":"true","data-estado":ye?"completed":q?"overdue":"planned","data-resumen":xt?"true":void 0,style:{opacity:or,transition:"opacity 300ms ease"},onClick:()=>{!$e&&!I.current&&c?.(e),I.current=false;},onDoubleClick:j=>{!$e&&!I.current&&(j.stopPropagation(),i?.(e));},onContextMenu:j=>{j.preventDefault(),u?.(e,j);},onMouseEnter:()=>!$e&&Xe(true),onMouseMove:j=>{v&&je&&!$e&&!e.segments&&v({task:e,x:t,y:a,width:r,height:Ne,showBelow:false,mouseX:j.clientX,mouseY:j.clientY});},onMouseLeave:()=>{$e||(Xe(false),oe(null));},children:[jsx("rect",{x:t,y:a,width:r+ja,height:Ne,fill:"transparent",style:{pointerEvents:"all"}}),je&&!$e&&!vt&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Ye,height:Ne,fill:Ze==="resize-start"?n.accent:"transparent",opacity:Ze==="resize-start"?.15:0,style:{cursor:at,pointerEvents:"all"},onMouseEnter:()=>oe("resize-start"),onMouseDown:j=>Ht(j,"resize-start")}),jsx("rect",{x:t+Ye,y:a,width:r-Ye*2,height:Ne,fill:Ze==="move"?n.accent:"transparent",opacity:Ze==="move"?.1:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>oe("move"),onMouseDown:j=>Ht(j,"move")}),jsx("rect",{x:t+r-Ye,y:a,width:Ye,height:Ne,fill:Ze==="resize-end"?n.accent:"transparent",opacity:Ze==="resize-end"?.15:0,style:{cursor:at,pointerEvents:"all"},onMouseEnter:()=>oe("resize-end"),onMouseDown:j=>Ht(j,"resize-end")})]}),je&&!$e&&Yt&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:Ne,fill:Ze==="move"?n.accent:"transparent",opacity:Ze==="move"?.2:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>oe("move"),onMouseDown:j=>Ht(j,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:Ne,fill:Ze==="resize-end"?n.accent:"transparent",opacity:Ze==="resize-end"?.2:0,style:{cursor:at,pointerEvents:"all"},onMouseEnter:()=>oe("resize-end"),onMouseDown:j=>Ht(j,"resize-end")}),je&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Ne-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),$e&&!Et&&!e.segments&&jsx(motion.rect,{x:J,y:a,width:Ie,height:Ne,rx:Oe,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"}}),h&&e.baselineStartDate&&e.baselineEndDate&&!$e&&(()=>{let j=e.baselineStartDate.getTime(),fe=e.baselineEndDate.getTime(),ae=o.getTime(),$=864e5,ee=(j-ae)/$,Ce=(fe-j)/$,D=ee*s,W=Math.max(Ce*s,s),pe=et+Je,ve=D+W,rt=e.endDate?.getTime()??0,ge=Math.ceil((rt-fe)/$),K=ge>0,ct=ge<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:D,y:a,width:W,height:Ne,rx:Oe,fill:"none",stroke:Mt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),K&&pe>ve&&jsx("rect",{x:ve,y:a,width:pe-ve,height:Ne,rx:0,fill:"#EF4444",opacity:.2}),K&&jsxs("text",{x:Math.max(pe,ve)+6,y:a+Ne/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",ge,"d"]}),ct&&jsxs("text",{x:pe+6,y:a+Ne/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[ge,"d"]})]})})(),!e.segments&<&&xt&&(()=>{let fe=a+(Ne-8)/2,ae=4,$=e.progress||0,ee=new Date;ee.setHours(0,0,0,0);let Ce=e.startDate&&ee>=e.startDate,D=e.endDate&&(()=>{let K=new Date(e.endDate);return K.setHours(0,0,0,0),ee>K})(),W=e.startDate&&ee<e.startDate,pe=1;if(Ce&&e.startDate&&e.endDate&&!W){let K=new Date(e.startDate);K.setHours(0,0,0,0);let ct=new Date(e.endDate);ct.setHours(0,0,0,0);let bt=Math.max(1,(ct.getTime()-K.getTime())/(1e3*60*60*24)),Zt=Math.min((ee.getTime()-K.getTime())/(1e3*60*60*24),bt)/bt*100;pe=Zt>0?$/Zt:1;}let ve;$>=100?ve="#00E5CC":W?ve="#4B5563":D&&$<100?ve="#EF4444":pe>=.95?ve="#22C55E":pe>=.8?ve="#F59E0B":ve="#EF4444";let rt=Math.max($/100*Je,$>0?ae*2:0),ge=Je>100&&$>0;return jsxs("g",{"data-task-class":Aa,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{"data-parte":"pista",x:et,y:fe,width:Je,height:8,rx:ae,fill:"rgba(255,255,255,0.10)"}),$>0&&jsx("rect",{"data-parte":"avance",x:et,y:fe,width:rt,height:8,rx:ae,fill:ve}),ge&&jsxs("text",{x:et+rt+6,y:fe+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round($),"%"]})]})})(),!e.segments&<&&!xt&&jsx(motion.rect,{x:et,y:a,width:Je,height:Ne,rx:Oe,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":Aa,"data-bar-background":"true","data-parte":"pista",initial:{opacity:0,scale:.95},animate:{opacity:$e&&!Et?.15:e.parentId?.6:1,scale:je&&!$e?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:j=>Ht(j),style:{cursor:He,pointerEvents:"all"}}),!e.segments&&!lt&&jsx(motion.rect,{x:et,y:a,width:Je,height:Ne,rx:Oe,fill:ce,"data-task-class":Aa,"data-parte":"pista",initial:{opacity:0,scale:.95},animate:{opacity:$e&&!Et?.15:e.parentId?.6:je?.9:.8,scale:je&&!$e?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:xt?void 0:j=>Ht(j),style:{cursor:xt?"default":He,pointerEvents:"all"}}),lt&&(q||he)&&!e.segments&&jsx("rect",{x:et,y:a,width:Je,height:Ne,rx:Oe,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)"})`}}),q&&!ye&&!e.segments&&!xt&&jsxs("g",{"data-parte":"icono-vencida",display:"none",style:{pointerEvents:"none"},transform:`translate(${et+Je+4}, ${a+Ne/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&>>0&&!xt&&jsx("rect",{x:et,y:a,width:Math.max(Je*(gt/100),Oe*2),height:Ne,rx:Oe,fill:ce,opacity:1,"data-parte":"avance",style:{pointerEvents:"none"}}),!e.segments&&!xt&&e.progress<100&&(()=>{let j=e.progress>0?Je*(e.progress/100):0,fe=et+j,ae=Je-j,$=e.progress===0?Oe:0,ee=e.progress===0?et:fe,Ce=e.progress===0?Je:ae;return jsxs(Fragment,{children:[jsx("rect",{x:ee,y:a,width:Ce,height:Ne,rx:$,fill:"url(#bar-remaining-hatch)","data-parte":"trama",style:{pointerEvents:"none"}}),jsx("rect",{x:ee,y:a,width:Ce,height:Ne,rx:$,fill:"none",stroke:ce,strokeWidth:.8,strokeDasharray:"5 3","data-parte":"borde-restante",style:{pointerEvents:"none"}})]})})(),lt&&!e.segments&&e.progress>0&&e.progress<100&&!xt&&!$e&&X===null&&(()=>{let j=et+Je*(e.progress/100),fe=8,ae=e.assignees?.[0];return jsxs("g",{"data-parte":"avatar",style:{pointerEvents:"none"},children:[jsx("circle",{cx:j,cy:a+Ne/2,r:fe,fill:ae?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:j,y:a+Ne/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:ae?.initials||ae?.name?.charAt(0)?.toUpperCase()||""})]})})(),B&&!$e&&Je>=40&&(X!==null||gt<88)&&(()=>{let j=et+Je*(gt/100),fe=a+Ne/2,ae=X!==null,$=ae?7:je?6:5,ee=ae||je?1:.35,Ce=et+Je-j,D=Math.max(4,Math.min(12,Ce-10)),W=12;return jsxs("g",{children:[jsx("rect",{x:j-W,y:fe-12,width:W+D,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:Ca,onPointerMove:Wa,onPointerUp:de,onPointerCancel:de,onClick:ue,onDoubleClick:ue,onMouseDown:pe=>pe.stopPropagation()}),jsx("circle",{"data-parte":"asa-avance",cx:j,cy:fe,r:$,fill:"#FFFFFF",stroke:ce,strokeWidth:2,opacity:ee,style:{pointerEvents:"none",filter:ae?`drop-shadow(0 0 4px ${ce})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),ae&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:j-20,y:fe-28,width:40,height:18,rx:4,fill:Mt?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:ce,strokeWidth:1}),jsxs("text",{x:j,y:fe-16,textAnchor:"middle",dominantBaseline:"central",fill:Mt?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[X,"%"]})]})]})})(),e.segments&&e.segments.map((j,fe)=>{let ae=(j.startDate.getTime()-o.getTime())/864e5*s,ee=(j.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-ae+s,Ce=$e&&P==="move"&&Fe===fe,D=ot===fe,W=Ce?ae+Le:ae;return jsxs("g",{onMouseEnter:()=>!$e&&se(fe),onMouseLeave:()=>!$e&&se(null),children:[jsx(motion.rect,{x:W,y:a,width:ee,height:Ne,rx:Oe,fill:ce,initial:{opacity:0,scale:.95},animate:{opacity:Ce||e.parentId?.6:D?.9:.8,scale:D&&!$e?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:pe=>{pe.stopPropagation(),Q(fe),Ue(ae),Ht(pe,void 0,ae);},style:{cursor:He,pointerEvents:"all"}}),jsx("rect",{x:W,y:a,width:ee*(e.progress/100),height:Ne,rx:Oe,fill:ce,opacity:1,style:{pointerEvents:"none"}})]},`segment-${fe}`)}),Ae&&(q||he)&&!e.segments&&jsxs(Fragment,{children:[he&&!q&&jsx("rect",{x:et,y:a,width:Je,height:Ne,rx:Oe,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),q&&jsx("rect",{x:et,y:a,width:Je,height:Ne,rx:Oe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&Je>60&&!e.segments&&!(lt&&xt)&&(()=>{let j=l.taskLabel(e),fe=typeof j=="string"?j:e.name,ae=fe.length>Math.floor(Je/8)?`${fe.substring(0,Math.floor(Je/8))}...`:fe;return jsx("text",{"data-parte":"etiqueta",x:et+8,y:a+Ne/2,dominantBaseline:"middle",fill:ye?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ye?"line-through":"none"},children:ae})})(),!$e&&!e.segments&&!xt&&e.progress>0&&e.progress<100&&(lt?jsxs("text",{x:et+Je+6,y:a+Ne/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Je>100?jsxs("text",{x:et+Je-12,y:a+Ne/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&&Je>80&&!$e&&!e.segments&&!(lt&&xt)&&jsxs("g",{"data-parte":"insignia-estado",style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:et+Je-8,cy:a+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:et+Je-8,cy:a+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(je||mt)&&!Et&&!e.segments&&!xt&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:et-2,y:a,width:16,height:Ne,fill:"transparent",style:{cursor:at},onMouseEnter:()=>oe("resize-start"),onMouseLeave:()=>oe(null),onMouseDown:j=>{j.stopPropagation(),Ht(j,"resize-start");}}),jsx(motion.rect,{x:et+4,y:a+8,width:3,height:Ne-16,rx:1.5,fill:Ze==="resize-start"||P==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:et+Je-14,y:a,width:16,height:Ne,fill:"transparent",style:{cursor:at},onMouseEnter:()=>oe("resize-end"),onMouseLeave:()=>oe(null),onMouseDown:j=>{j.stopPropagation(),Ht(j,"resize-end");}}),jsx(motion.rect,{x:et+Je-7,y:a+8,width:3,height:Ne-16,rx:1.5,fill:Ze==="resize-end"||P==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:je&&!$e&&!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+Ne/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>oe("connect"),onMouseLeave:()=>oe(null),onMouseDown:j=>{j.stopPropagation(),Ht(j,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+Ne/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:Ze==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Et&&ke&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+Ne/2,x2:ke.x,y2:ke.y,stroke:U?n.statusCompleted:n.accent,strokeWidth:U?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:U?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:ke.x,cy:ke.y,r:U?8:6,fill:U?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),U&&jsx(motion.text,{x:ke.x+15,y:ke.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:ke.x+10},animate:{opacity:1,x:ke.x+15},transition:{duration:.2},children:"Connect"})]}),(je||$e)&&!Et&&!e.segments&&jsx(motion.rect,{x:et-1,y:a-1,width:Je+2,height:Ne+2,rx:Oe+1,fill:"none",stroke:$e?n.accent:lt?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:lt?1:2,opacity:$e||lt?.6:.4,initial:{opacity:0},animate:{opacity:$e||lt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),mt&&jsxs(Fragment,{children:[jsx("line",{x1:J,y1:0,x2:J,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:J+Ie,y1:0,x2:J+Ie,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:je&&!$e&&!e.segments&&!v&&(()=>{let ae=a<100,$=ae?a+Ne+13:a-82-13,ee=ae?`M ${et+Je/2-6} ${a+Ne+3} L ${et+Je/2} ${a+Ne+13} L ${et+Je/2+6} ${a+Ne+3}`:`M ${et+Je/2-6} ${a-13} L ${et+Je/2} ${a-3} L ${et+Je/2+6} ${a-13}`,Ce=$+22,D=$+40,W=$+55,pe=$+70,ve=ae?$+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:ae?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ae?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:ee,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsx("rect",{x:et+Je/2-120,y:$,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:et+Je/2,y:Ce,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:et+Je/2-110,y:D,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:et+Je/2-70,y:D,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ba(e.startDate)}),jsx("text",{x:et+Je/2-110,y:W,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:et+Je/2-70,y:W,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ba(e.endDate)}),jsx("text",{x:et+Je/2+10,y:D,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:et+Je/2+65,y:D,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ca()}),jsx("text",{x:et+Je/2+10,y:W,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:et+Je/2+65,y:W,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:et+Je/2-110,y:pe,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:et+Je/2-50,y:pe,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(rt=>rt.name).join(", ").substring(0,30),e.assignees.map(rt=>rt.name).join(", ").length>30?"...":""]})]}),!ae&&jsx("text",{x:et+Je/2,y:ve,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Yt?"Left: move \u2022 Right: resize":vt?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var hd=260,ps=8,Zm=16,ww=-12;function eg({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:k}=e,M=x.effortMinutes!=null||x.timeLoggedMinutes!=null||x.soldEffortMinutes!=null,I=x.lastActivity!=null,C=(M?155:105)+(I?28:0),N=w+Zm,P=k+ww-C;N+hd>window.innerWidth-ps&&(N=w-hd-Zm),N<ps&&(N=ps);let T=P<ps;T&&(P=k+20),P+C>window.innerHeight-ps&&(P=window.innerHeight-ps-C),s({left:N,top:P,showBelow:T});},[e]),!e||!n)return null;let{task:o}=e,l=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"},i=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 P=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return a==="es"?`${P} d\xEDa${P!==1?"s":""}`:`${P} day${P!==1?"s":""}`}let x=r.enabledWeekdays,w=r.holidayDates instanceof Set?r.holidayDates:new Set(r.holidayDates??[]),k=P=>`${P.getFullYear()}-${String(P.getMonth()+1).padStart(2,"0")}-${String(P.getDate()).padStart(2,"0")}`,M=0,I=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),C=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;I.getTime()<=C.getTime();){let P=I.getDay();x[P]&&!w.has(k(I))&&M++,I.setDate(I.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 w=Math.floor(x/60),k=x%60;return w===0?`${k}m`:k===0?`${w}h`:`${w}h ${k}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",v=t.accent||"#00E5CC",h=t.bgSecondary||"#1F2937",b=t.border||"#374151",y=jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:hd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:h,border:`1px solid ${b}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:f,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(rl,{label:c.start,value:o.startDate?i(o.startDate):"N/A",labelColor:d,valueColor:m}),jsx(rl,{label:c.duration,value:u(),labelColor:d,valueColor:m}),jsx(rl,{label:c.end,value:o.endDate?i(o.endDate):"N/A",labelColor:d,valueColor:m}),jsx(rl,{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))})]}),l&&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
|
|
131
|
-
`)},formatDate:e=>{let t=e.getFullYear(),
|
|
130
|
+
`})]});return createPortal(y,document.body)}function rl({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 Js({x1:e,y1:t,x2:a,y2:r,theme:n,onDelete:s,lineStyle:o="curved",isHoverLayer:l=false,onHoverChange:c,hoverOverlayOnly:i=false,colorOverride:u,strokeWidthOverride:p,glowFilter:d}){let[,m]=useState(false),[f,v]=useState(null),h=r-t,b=h>0,y=Math.abs(h)<5,x=20,w=!y&&a<=e,k,M,I=a-e,C=e+I/2;M=C;let N=8;if(o==="squared")if(y)k=`M ${e} ${t} L ${a} ${r}`;else if(w){let Ue=e+15,Le=a-x,Be=b?t+20:t-20;M=Le;let ot=b?1:-1;k=`M ${e} ${t} L ${Ue-N} ${t} Q ${Ue} ${t} ${Ue} ${t+ot*N} L ${Ue} ${Be-ot*N} Q ${Ue} ${Be} ${Ue-N} ${Be} L ${Le+N} ${Be} Q ${Le} ${Be} ${Le} ${Be+ot*N} L ${Le} ${r-ot*N} Q ${Le} ${r} ${Le+N} ${r} L ${a} ${r}`;}else {M=a-x;let Se=b?1:-1;k=`M ${e} ${t} L ${M-N} ${t} Q ${M} ${t} ${M} ${t+Se*N} L ${M} ${r-Se*N} Q ${M} ${r} ${M+N} ${r} L ${a} ${r}`;}else k=`M ${e} ${t} C ${C} ${t}, ${C} ${r}, ${a} ${r}`;let P=6,T=5,V=`M ${a} ${r} L ${a-P} ${r-T/2} L ${a-P} ${r+T/2} Z`,O=!n.bgPrimary||n.bgPrimary.startsWith("#0")||n.bgPrimary.startsWith("#1"),J=u||(O?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),L=p||1,Ie=n.dependencyHover||(O?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),G="#f87171",ke="rgba(248, 113, 113, 0.15)",R=M,U=(t+r)/2;if(f)if(o==="squared")if(y)R=Math.max(e+10,Math.min(a-10,f.x)),U=t;else if(w){let Se=e+15,Ue=a-x,Le=b?t+20:t-20,Be=[[e,t,Se,t],[Se,t,Se,Le],[Se,Le,Ue,Le],[Ue,Le,Ue,r],[Ue,r,a,r]],ot=1/0,se={x:R,y:U};for(let je of Be){let Xe=Pe(f.x,f.y,je[0],je[1],je[2],je[3]),$e=Math.hypot(f.x-Xe.x,f.y-Xe.y);$e<ot&&(ot=$e,se=Xe);}R=se.x,U=se.y;}else {let Se=[[e,t,M,t],[M,t,M,r],[M,r,a,r]],Ue=1/0,Le={x:R,y:U};for(let Be of Se){let ot=Pe(f.x,f.y,Be[0],Be[1],Be[2],Be[3]),se=Math.hypot(f.x-ot.x,f.y-ot.y);se<Ue&&(Ue=se,Le=ot);}R=Le.x,U=Le.y;}else {let Se=C,Ue=t,Le=C,Be=r,ot=1/0,se=R,je=U;for(let Xe=0;Xe<=1;Xe+=.02){let $e=1-Xe,mt=$e*$e*$e*e+3*$e*$e*Xe*Se+3*$e*Xe*Xe*Le+Xe*Xe*Xe*a,Et=$e*$e*$e*t+3*$e*$e*Xe*Ue+3*$e*Xe*Xe*Be+Xe*Xe*Xe*r,st=Math.hypot(f.x-mt,f.y-Et);st<ot&&(ot=st,se=mt,je=Et);}R=se,U=je;}function Pe(Se,Ue,Le,Be,ot,se){let je=ot-Le,Xe=se-Be,$e=je*je+Xe*Xe;if($e===0)return {x:Le,y:Be};let mt=((Se-Le)*je+(Ue-Be)*Xe)/$e;return mt=Math.max(0,Math.min(1,mt)),{x:Le+mt*je,y:Be+mt*Xe}}let Ze=Se=>{let Ue=Se.currentTarget.ownerSVGElement;if(!Ue)return;let Le=Ue.getScreenCTM();if(!Le)return;let Be=Le.inverse();v({x:Be.a*Se.clientX+Be.c*Se.clientY+Be.e,y:Be.b*Se.clientX+Be.d*Se.clientY+Be.f});},oe=()=>{m(false),v(null),c?.(false);},Fe=()=>{m(true),c?.(true);},Q=Se=>s?jsxs(motion.g,{initial:Se,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Ue=>{Ue.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsx("circle",{cx:R,cy:U,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsx("circle",{cx:R,cy:U,r:9,fill:ke,stroke:G,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("line",{x1:R-3,y1:U-3,x2:R+3,y2:U+3,stroke:G,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("line",{x1:R+3,y1:U-3,x2:R-3,y2:U+3,stroke:G,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return l?jsxs("g",{"data-dependency-line":"true",onMouseLeave:oe,onMouseMove:Ze,children:[jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:k,fill:"none",stroke:Ie,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:k,fill:"none",stroke:Ie,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:V,fill:Ie,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:Ie,opacity:.9,style:{pointerEvents:"none"}}),Q({opacity:0,scale:.8})]}):i?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:Fe,onMouseLeave:oe,onMouseMove:Ze,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx("path",{d:k,fill:"none",stroke:n.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:k,fill:"none",stroke:Ie,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsx("path",{d:k,fill:"none",stroke:Ie,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:V,fill:Ie,stroke:"none",style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:3.5,fill:Ie,style:{pointerEvents:"none"}}),Q({opacity:0,scale:0})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:Fe,onMouseLeave:oe,onMouseMove:Ze,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:k,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:k,fill:"none",stroke:J,strokeWidth:L,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:d||"none"}}),jsx(motion.path,{d:V,fill:J,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:J,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function il({task:e,x:t,y:a,theme:r,onClick:n}){let[s,o]=useState(false),l=16,c=i=>i.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:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{"data-parte":"rombo",x:t-l/2,y:a+16-l/2,width:l,height:l,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsx(motion.rect,{x:t-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children: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 De={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let n=r.getDay();n!==0&&n!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let n=a.getDay();n!==0&&n!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,n=i=>{i.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&n(u.subtasks);});};n(e);let s=r.get(a)||[];r.set(a,[...s,t]);let o=new Set,l=new Set,c=i=>{if(!o.has(i)){o.add(i),l.add(i);let u=r.get(i)||[];for(let p of u){if(!o.has(p)&&c(p))return true;if(l.has(p))return true}}return l.delete(i),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=De.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=De.findTaskById(e,t);if(!r||!r.parentId)return a;let n=r.parentId;for(;n;){let s=De.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=De.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=De.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=De.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)=>De.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=De.findTaskById(e,t);return !a||!a.dependencies?[]:De.flattenTasks(e).filter(n=>a.dependencies.includes(n.id))},filterByStatus:(e,t)=>De.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>De.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=De.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=>De.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=De.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}n.setFontSize(16),n.text("Gantt Chart - Task List",14,20);let o=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=s.map(c=>{let i=c.startDate&&c.endDate?De.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?De.formatDate(c.startDate):"N/A",c.endDate?De.formatDate(c.endDate):"N/A",i>0?`${i} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(n,{head:o,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),n.save(t);}catch(a){throw a}},exportToExcel:async(e,t,a)=>{let r=await import('xlsx'),n=De.flattenTasks(e),s=a?.rateMap,o=a?.defaultRate||0,l=h=>{if(!s||!h.assignees||h.assignees.length===0)return o;let b=h.assignees.map(y=>y.id?s[y.id]:void 0).filter(y=>y!=null&&y>0);return b.length===0?o:b.reduce((y,x)=>y+x,0)/b.length},c=new Map,i=(h,b="")=>{[...h].sort((x,w)=>(x.position??0)-(w.position??0)).forEach((x,w)=>{let k=b?`${b}.${w+1}`:`${w+1}`;c.set(x.id,k),x.subtasks?.length&&i(x.subtasks,k);});};i(e);let u=s&&Object.keys(s).length>0||n.some(h=>h._costRate>0),p=n.map(h=>{let b=h.startDate&&h.endDate?De.calculateDuration(h.startDate,h.endDate):0,y=h.effortMinutes,x=h.timeLoggedMinutes,w=h.soldEffortMinutes,k=typeof y=="number"?+(y/60).toFixed(1):0,M=typeof x=="number"?+(x/60).toFixed(1):0,I=typeof w=="number"?+(w/60).toFixed(1):0,C=h._costRate>0?h._costRate:l(h),N={WBS:c.get(h.id)||"","Task Name":h.name,"Start Date":h.startDate?De.formatDate(h.startDate):"","End Date":h.endDate?De.formatDate(h.endDate):"","Duration (days)":b>0?b:"","Progress (%)":h.progress,Status:h.status||"",Assignees:h.assignees?.map(T=>T.name).join(", ")||"","Estimated (h)":k||"","Logged (h)":M||"","Quoted (h)":I||""};u&&(N["$ Estimated"]=k>0&&C>0?Math.round(k*C):"",N["$ Executed"]=M>0&&C>0?Math.round(M*C):"",N["$ Quoted"]=I>0&&C>0?Math.round(I*C):"",N["Rate ($/h)"]=C>0?C:"");let P=h.weight;return N["Weight (%)"]=typeof P=="number"&&P>0?P:"",N["Is Milestone"]=h.isMilestone?"Yes":"No",N}),d=a?.projectName||"";if(d||p.length>0){let h=0,b=0,y=0,x=0,w=0,k=0,M=0,I=0,C=n.filter(T=>T.startDate).map(T=>T.startDate.getTime()),N=n.filter(T=>T.endDate).map(T=>T.endDate.getTime());for(let T of p)typeof T["Estimated (h)"]=="number"&&(h+=T["Estimated (h)"]),typeof T["Logged (h)"]=="number"&&(b+=T["Logged (h)"]),typeof T["Quoted (h)"]=="number"&&(y+=T["Quoted (h)"]),u&&(typeof T["$ Estimated"]=="number"&&(x+=T["$ Estimated"]),typeof T["$ Executed"]=="number"&&(w+=T["$ Executed"]),typeof T["$ Quoted"]=="number"&&(k+=T["$ Quoted"])),typeof T["Progress (%)"]=="number"&&(M+=T["Progress (%)"],I++);let P={WBS:"0","Task Name":`\u{1F4CB} ${d||"PROJECT TOTAL"}`,"Start Date":C.length>0?De.formatDate(new Date(Math.min(...C))):"","End Date":N.length>0?De.formatDate(new Date(Math.max(...N))):"","Duration (days)":C.length>0&&N.length>0?De.calculateDuration(new Date(Math.min(...C)),new Date(Math.max(...N))):"","Progress (%)":I>0?Math.round(M/I):0,Status:"",Assignees:"","Estimated (h)":+h.toFixed(1)||"","Logged (h)":+b.toFixed(1)||"","Quoted (h)":+y.toFixed(1)||""};u&&(P["$ Estimated"]=x||"",P["$ Executed"]=w||"",P["$ Quoted"]=k||"",P["Rate ($/h)"]=""),P["Is Milestone"]="No",p.unshift(P);}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 h=new Date,b=x=>String(x).padStart(2,"0");t=`Project_${`${h.getFullYear()}-${b(h.getMonth()+1)}-${b(h.getDate())}_${b(h.getHours())}${b(h.getMinutes())}`}.xlsx`;}r.writeFile(v,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=De.flattenTasks(e),n=new Map;r.forEach((d,m)=>{n.set(d.id,m+1);});let s=d=>d.toISOString().replace("Z",""),o=De.getEarliestStartDate(e)||new Date,l=De.getLatestEndDate(e)||new Date,c=r.map((d,m)=>{let f=n.get(d.id),v=d.startDate&&d.endDate?De.calculateDuration(d.startDate,d.endDate):0,h=(d.dependencies||[]).filter(b=>n.has(b)).map(b=>`
|
|
132
132
|
<PredecessorLink>
|
|
133
133
|
<PredecessorUID>${n.get(b)}</PredecessorUID>
|
|
134
134
|
<Type>1</Type>
|
|
@@ -358,14 +358,14 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
358
358
|
</Calendars>
|
|
359
359
|
<Tasks>${c}
|
|
360
360
|
</Tasks>
|
|
361
|
-
</Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),p=document.createElement("a");p.href=URL.createObjectURL(u),p.download=r,p.click(),URL.revokeObjectURL(p.href);},calculateCriticalPath:e=>{let t=Ne.flattenTasks(e),r=t.filter(i=>i.startDate&&i.endDate);if(r.length===0)return [];let a=new Map,n=i=>{if(a.has(i.id))return;let u=i.startDate&&i.endDate?Ne.calculateDuration(i.startDate,i.endDate):0,p=0;if(i.dependencies&&i.dependencies.length>0)for(let m of i.dependencies){let f=t.find(v=>v.id===m);if(f){n(f);let v=a.get(m)?.ef||0;p=Math.max(p,v);}}let d=p+u;a.set(i.id,{es:p,ef:d});};r.forEach(n);let s=Math.max(...Array.from(a.values()).map(i=>i.ef)),o=new Map,l=i=>{if(o.has(i.id))return;let u=i.startDate&&i.endDate?Ne.calculateDuration(i.startDate,i.endDate):0,p=t.filter(f=>f.dependencies&&f.dependencies.includes(i.id)),d=s;if(p.length>0)for(let f of p){l(f);let v=o.get(f.id)?.ls||0;d=Math.min(d,v);}let m=d-u;o.set(i.id,{ls:m,lf:d});};r.forEach(l);let c=[];for(let i of r){let u=a.get(i.id),p=o.get(i.id);if(u&&p){let d=p.ls-u.es;Math.abs(d)<.01&&c.push(i.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,a=Ne.flattenTasks(e).filter(d=>d.startDate&&d.endDate);if(a.length===0)return t;let n=new Map(a.map(d=>[d.id,d])),s=new Map;for(let d of a)s.has(d.id)||s.set(d.id,[]);for(let d of a)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 a)o.set(d.id,0);for(let d of a)if(d.dependencies)for(let m of d.dependencies)n.has(m)&&o.set(d.id,(o.get(d.id)||0)+1);let l=new Map,c=[],i=[];for(let d of a)(o.get(d.id)||0)===0&&i.push(d.id);for(;i.length>0;){let d=i.shift();c.push(d);let m=n.get(d);if(!m||!m.startDate||!m.endDate)continue;let f=Ne.calculateDuration(m.startDate,m.endDate),v=0;if(m.dependencies)for(let b of m.dependencies){let y=l.get(b);y&&(v=Math.max(v,y.ef));}l.set(d,{es:v,ef:v+f});let h=s.get(d)||[];for(let b of h){let y=(o.get(b)||1)-1;o.set(b,y),y===0&&i.push(b);}}if(c.length<a.length)return t;let u=Math.max(...Array.from(l.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=Ne.calculateDuration(f.startDate,f.endDate),h=s.get(m)||[],b=u;if(h.length>0)for(let y of h){let x=p.get(y);x&&(b=Math.min(b,x.ls));}p.set(m,{ls:b-v,lf:b});}for(let d of c){let m=l.get(d),f=p.get(d),v=f.ls-m.es,h=s.get(d)||[],b;h.length>0?b=Math.min(...h.map(y=>l.get(y).es))-m.ef:b=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(b*100)/100),isCritical:v<=.01});}return t},calculateSlack:(e,t)=>{let r=Ne.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return null;if(Ne.calculateCriticalPath(e).includes(t))return 0;let n=Ne.getDependentTasks(e,t);if(n.length===0){let l=Ne.getLatestEndDate(e);if(!l)return null;let c=Ne.calculateDuration(r.endDate,l);return Math.max(0,c)}let s=n.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,c)=>l-c)[0];if(!s)return null;let o=Ne.calculateDuration(r.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>Ne.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,r,a)=>{let n=a||new Set;if(n.has(t))return e;n.add(t);let s=Ne.findTaskById(e,t);if(!s||!s.endDate)return e;let o=Ne.getDependentTasks(e,t);if(o.length===0)return e;let l=[...e];for(let c of o){if(n.has(c.id)||!c.startDate||!c.endDate)continue;let i=Ne.calculateDuration(c.startDate,c.endDate),u;if(r!==void 0?(u=new Date(c.startDate),u.setDate(u.getDate()+r)):(u=new Date(s.endDate),u.setDate(u.getDate()+1)),r!==void 0){let m=new Date(s.endDate),f=new Date(m);f.setDate(f.getDate()+1),u<f&&(u=f);}let p=Ne.calculateEndDate(u,i),d=m=>m.map(f=>f.id===c.id?{...f,startDate:u,endDate:p}:f.subtasks?{...f,subtasks:d(f.subtasks)}:f);l=d(l),l=Ne.autoScheduleDependents(l,c.id,r,n);}return l},calculateCascadePreview:(e,t,r,a,n,s,o,l)=>{if(r===0)return [];let c=[],i=n.getTime(),u=1e3*60*60*24,p=Ne.findTaskById(e,t);if(!p||!p.endDate)return [];let d=(m,f,v=new Set)=>{if(v.has(m))return;v.add(m);let h=Ne.getDependentTasks(e,m);for(let b of h){if(!b.startDate||!b.endDate)continue;let y=a.findIndex(T=>T.id===b.id);if(y===-1)continue;let x=b.startDate.getTime(),k=(b.endDate.getTime()-x)/u,I=(x-i)/u*s,C=I+f*s,N=Math.max(k*s,s),P=l+y*o+(o-18)/2;c.push({taskId:b.id,taskName:b.name,originalX:I,previewX:C,width:N,y:P,rowIndex:y,daysDelta:f,color:b.color}),d(b.id,f,v);}};return d(t,r),c},splitTask:(e,t,r,a=3)=>{let n=Ne.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(r<=n.startDate||r>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(r);s.setDate(s.getDate()-1);let o=new Date(r);o.setDate(o.getDate()+a);let l=new Date(n.endDate);l.setDate(l.getDate()+a);let c=[{startDate:new Date(n.startDate),endDate:s},{startDate:o,endDate:l}],i=u=>u.map(p=>p.id===n.id?{...p,endDate:l,segments:c}:p.subtasks?{...p,subtasks:i(p.subtasks)}:p);return i(e)}};function ll({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:s,zoom:o,locale:l="en",templates:c,dependencyLineStyle:i="curved",showTaskBarLabels:u=true,onTaskClick:p,onTaskDblClick:d,onTaskContextMenu:m,onTaskDateChange:f,onDependencyCreate:v,onDependencyDelete:h,showBaseline:b,showCriticalPath:y=true,showDependencies:x=true,highlightWeekends:w=true,canEditTask:k,onTaskProgressDrag:M,workingDaysConfig:I}){let N=_a(),P=useRef(null),[T,V]=useState([]),[O,X]=useState(null),[F,Fe]=useState(null),[U,De]=useState(null),B=useRef(false),[z,Me]=useState(new Set),[Ue,ce]=useState(null),Le=useCallback(R=>{if(U&&!B.current){let _=R.target,ue=false;for(;_&&_!==R.currentTarget;){if(_.getAttribute?.("data-dependency-line")==="true"||_.getAttribute?.("data-dependency-hover-overlay")==="true"){ue=true;break}_=_.parentElement;}ue||De(null);}},[U]),J=useCallback(R=>{Fe(R);},[]),Pe=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),Ee=a==="day"?60:a==="week"?20:8,$e=Pe*Ee*o,He=R=>{let _=new Date(Date.UTC(R.getFullYear(),R.getMonth(),R.getDate())),ue=_.getUTCDay()||7;_.setUTCDate(_.getUTCDate()+4-ue);let ve=new Date(Date.UTC(_.getUTCFullYear(),0,1));return Math.ceil(((_.getTime()-ve.getTime())/864e5+1)/7)},et=R=>{let _=R.getDay();return _===0||_===6},se=useMemo(()=>{let R=I?.holidayDates;return R?R instanceof Set?R:new Set(R):null},[I?.holidayDates]),_e=R=>{if(!se)return false;let _=`${R.getFullYear()}-${String(R.getMonth()+1).padStart(2,"0")}-${String(R.getDate()).padStart(2,"0")}`;return se.has(_)},qe=useCallback(R=>{let _=Math.round(R/(Ee*o)),ue=new Date(n);return ue.setDate(ue.getDate()+_),ue},[n,Ee,o]),Re=useCallback((R,_)=>{if(_.startDate&&_.endDate)return;let ue=R.currentTarget.ownerSVGElement;if(!ue)return;let ve=ue.createSVGPoint();ve.x=R.clientX,ve.y=R.clientY;let Oe=ve.matrixTransform(ue.getScreenCTM()?.inverse()),ye=qe(Oe.x),ft=new Date(ye);ft.setDate(ft.getDate()+1),ce(null),f?.(_,ye,ft);},[qe,f]),ut=useCallback((R,_,ue)=>{let ve=R.currentTarget.ownerSVGElement;if(!ve)return;let Oe=ve.createSVGPoint();Oe.x=R.clientX,Oe.y=R.clientY;let ye=Oe.matrixTransform(ve.getScreenCTM()?.inverse()),ft=qe(ye.x),ge=Math.round(ye.x/(Ee*o))*Ee*o;ce({taskId:_.id,x:ge,y:ue*r+r/2,date:ft});},[qe,Ee,o,r]),Et=useCallback(()=>{ce(null);},[]),Ge=useMemo(()=>{let R=Oe=>Oe.map(ye=>{if(ye.subtasks&&ye.subtasks.length>0){let ft=R(ye.subtasks),ie=ft.filter(ge=>ge.startDate&&ge.endDate);if(ie.length>0){let ge=ie.map(Je=>Je.startDate.getTime()),Ze=ie.map(Je=>Je.endDate.getTime()),Xe=new Date(Math.min(...ge)),kt=new Date(Math.max(...Ze));return {...ye,subtasks:ft,startDate:Xe,endDate:kt}}return {...ye,subtasks:ft}}return ye}),_=(Oe,ye=[])=>{let ft=[...Oe].sort((ie,ge)=>(ie.position??0)-(ge.position??0));for(let ie of ft)ye.push(ie),ie.subtasks&&ie.subtasks.length>0&&(ie.isExpanded===void 0||ie.isExpanded)&&_(ie.subtasks,ye);return ye},ue=R(e);return _(ue)},[e]),Ie=useCallback(R=>{if(!R.startDate||!R.endDate)return {x:0,width:0};let _=R.startDate.getTime(),ue=R.endDate.getTime(),ve=n.getTime(),Oe=(_-ve)/(1e3*60*60*24),ye=(ue-_)/(1e3*60*60*24)+1,ft=Oe*Ee*o,ie=Math.max(Ee*o,40),ge=Math.max(ye*Ee*o,ie);return {x:ft,width:ge}},[n,Ee,o]),dt=useMemo(()=>Ge.filter(R=>R.startDate&&R.endDate).map(R=>{let{x:_,width:ue}=Ie(R),Oe=Ge.findIndex(ye=>ye.id===R.id)*r+(r-18)/2;return {id:R.id,x:_,y:Oe,width:ue,height:18}}),[Ge,Ie]),Mt=useCallback((R,_,ue)=>{if(!ue){V([]),X(null);return}if(X({taskId:R,daysDelta:_}),_===0){V([]);return}let ve=Ne.calculateCascadePreview(e,R,_,Ge,n,Ee*o,r,48);V(ve);},[e,Ge,n,Ee,o,r,48]),Be=useCallback((R,_)=>{if(!O)return _;let ue=Ee*o,ve=O.daysDelta*ue;if(R===O.taskId)return {x:_.x+ve,width:_.width};let Oe=T.find(ye=>ye.taskId===R);return Oe?{x:Oe.previewX,width:Oe.width}:_},[O,T,Ee,o]),vt=useMemo(()=>{let R=[],_=new Date(n);for(;_<=s;){let Oe=(_.getTime()-n.getTime())/864e5*Ee*o;if(a==="day")R.push({date:new Date(_),label:_.toLocaleDateString(l,{day:"numeric",month:"short"}),x:Oe}),_.setDate(_.getDate()+1);else if(a==="week"){let ye=He(_);R.push({date:new Date(_),label:`${N.labels.week} ${ye}`,x:Oe}),_.setDate(_.getDate()+7);}else R.push({date:new Date(_),label:_.toLocaleDateString(l,{month:"short",year:"numeric"}),x:Oe}),_.setMonth(_.getMonth()+1);}return R},[n,s,a,Ee,o,l,N.labels.week]),L=useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*Ee*o,[n,Ee,o]),Q=Math.max(Ge.length*r,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max($e,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max($e,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),vt.map((R,_)=>jsxs("g",{children:[_>0&&jsx("line",{x1:R.x,y1:0,x2:R.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:R.x+8,y:48/2,fill:a==="day"&&!et(R.date)&&_e(R.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:R.label})]},`header-${_}`)),L>=0&&L<=$e&&jsxs("g",{children:[jsx("circle",{cx:L,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:L,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${L-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:N.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:P,width:Math.max($e,1e3),height:Q,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($e,1e3),height:Q,fill:t.bgPrimary}),Ge.map((R,_)=>jsx("rect",{x:0,y:_*r,width:Math.max($e,1e3),height:r,fill:_%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${R.id}`)),vt.map((R,_)=>_>0?jsx("line",{x1:R.x,y1:0,x2:R.x,y2:Ge.length*r,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${_}`):null),vt.map((R,_)=>{let ue=vt[_+1]?.x||$e,ve=w&&et(R.date),Oe=a==="day"&&!et(R.date)&&_e(R.date);return ve||Oe?jsxs("g",{children:[jsx("rect",{x:R.x,y:0,width:ue-R.x,height:Ge.length*r,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsx("rect",{x:R.x,y:0,width:ue-R.x,height:Ge.length*r,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${_}`):null}),Ge.map((R,_)=>{let ue=R.startDate&&R.endDate;return jsx("g",{children:!ue&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:_*r,width:$e,height:r,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:ve=>Re(ve,R),onMouseMove:ve=>ut(ve,R,_),onMouseLeave:()=>{Et();}},`clickable-${R.id}`),Ue&&Ue.taskId===R.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:Ue.x,y1:_*r+4,x2:Ue.x,y2:_*r+r-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:Ue.x,cy:Ue.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:Ue.x,cy:Ue.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${Ue.x}, ${_*r-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:Ue.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!Ue||Ue.taskId!==R.id)&&jsx("text",{x:L>0?L:100,y:_*r+r/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:N.labels.clickToSetDates},`placeholder-${R.id}`)]})},`row-group-${R.id}`)}),Ge.map((R,_)=>{if(!R.startDate||!R.endDate)return null;let{x:ue,width:ve}=Ie(R),Oe=_*r+(r-18)/2,ye=R.subtasks&&R.subtasks.length>0&&!R.isMilestone;if(R.isMilestone)return jsx(il,{task:R,x:ue+ve/2,y:Oe+12,theme:t,onClick:p},R.id);if(ye){let ft=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),ie=8,ge=Oe+(r-18)/2+(18-ie)/2,Ze=4,Xe=R.progress||0,kt=new Date;kt.setHours(0,0,0,0);let Je=R.startDate&&kt>=R.startDate,At=R.endDate&&(()=>{let or=new Date(R.endDate);return or.setHours(0,0,0,0),kt>or})(),Yt=R.startDate&&kt<R.startDate,pr=1;if(Je&&R.startDate&&R.endDate&&!Yt){let or=new Date(R.startDate);or.setHours(0,0,0,0);let ha=new Date(R.endDate);ha.setHours(0,0,0,0);let pa=Math.max(1,(ha.getTime()-or.getTime())/(1e3*60*60*24)),Ye=Math.min((kt.getTime()-or.getTime())/(1e3*60*60*24),pa)/pa*100;pr=Ye>0?Xe/Ye:1;}let It;Xe>=100?It="#00E5CC":Yt?It="#4B5563":At&&Xe<100?It="#EF4444":pr>=.95?It="#22C55E":pr>=.8?It="#F59E0B":It="#EF4444";let Ur=Math.max(Xe/100*ve,Xe>0?Ze*2:0),Ht=ve>100&&Xe>0,vr=R.isCriticalPath;return jsxs("g",{onClick:()=>p?.(R),onContextMenu:or=>{or.preventDefault(),or.stopPropagation(),m?.(R,or);},onMouseMove:or=>{J({task:R,x:ue,y:ge,width:ve,height:ie,showBelow:ge<100,mouseX:or.clientX,mouseY:or.clientY});},onMouseLeave:()=>J(null),style:{cursor:"default",opacity:y?vr?1:.25:1,transition:"opacity 300ms ease"},children:[jsx("rect",{x:ue,y:Oe,width:ve,height:r,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:ue,y:ge,width:ve,height:ie,rx:Ze,fill:ft?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),Xe>0&&jsx("rect",{x:ue,y:ge,width:Ur,height:ie,rx:Ze,fill:It}),y&&vr&&jsx("rect",{x:ue,y:ge,width:ve,height:ie,rx:Ze,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Ht&&jsxs("text",{x:ue+Ur+6,y:ge+ie/2,dominantBaseline:"central",fill:ft?"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(Xe),"%"]})]},R.id)}return jsx(rl,{task:R,x:ue,y:Oe,width:ve,theme:t,dayWidth:Ee*o,startDate:n,templates:c,onClick:p,onDoubleClick:d,onContextMenu:m,onDateChange:f,onDependencyCreate:v,allTaskPositions:dt,onDragMove:Mt,onHoverChange:J,showBaseline:b,showTaskBarLabels:u,showCriticalPath:y,readOnly:k?!k(R):false,onProgressChange:M},R.id)}),x&&Ge.map((R,_)=>!R.dependencies||R.dependencies.length===0||!R.startDate||!R.endDate?null:R.dependencies.map(ue=>{let ve=Ge.find(It=>It.id===ue);if(!ve||!ve.startDate||!ve.endDate)return null;let Oe=Ge.findIndex(It=>It.id===ue),ye=Be(ve.id,Ie(ve)),ft=Be(R.id,Ie(R)),ie=ye.x+ye.width,ge=Oe*r+26,Ze=ft.x,Xe=_*r+26,kt=`dep-${ue}-${R.id}`;if(z.has(kt))return null;let Je=y&&R.isCriticalPath&&ve.isCriticalPath;return jsx(Js,{x1:ie,y1:ge,x2:Ze,y2:Xe,theme:t,lineStyle:i,colorOverride:y?Je?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:y?Je?2:1:void 0,glowFilter:Je?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.(R.id,ue),onHoverChange:It=>{B.current=It,It&&De({key:kt,fromId:ue,toId:R.id,exitX:ie,exitY:ge,enterX:Ze,enterY:Xe});}},kt)})),T.map(R=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:R.previewX,y:R.y-48,width:R.width,height:18,rx:6,fill:R.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(R.daysDelta)>0&&jsx("text",{x:R.previewX+R.width/2,y:R.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:R.daysDelta>0?`+${R.daysDelta}d`:`${R.daysDelta}d`})]},`cascade-preview-${R.taskId}`)),x&&U&&jsx(Js,{x1:U.exitX,y1:U.exitY,x2:U.enterX,y2:U.enterY,theme:t,lineStyle:i,onDelete:()=>{let R=U.key;De(null),B.current=false,Me(_=>new Set(_).add(R)),h?.(U.toId,U.fromId);},hoverOverlayOnly:true,onHoverChange:R=>{B.current=R,R||De(null);}},`${U.key}-hover-overlay`),L>=0&&L<=$e&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:L,y1:0,x2:L,y2:Q,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:L,y1:0,x2:L,y2:Q,stroke:t.today,strokeWidth:1,opacity:1})]})]}),F&&jsx(eg,{tooltipData:F,theme:t,locale:l==="es"?"es":"en",workingDaysConfig:I})]})}var Cw=['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"'],ag=({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"})}),Tw=()=>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"})}),Nw=()=>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"})}),Dw=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Sw=()=>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 ul({tasks:e,theme:t,config:r,onTasksUpdate:a,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:l,onDependencyDelete:c}){let[i,u]=useState(false),[p,d]=useState(false),[m,f]=useState([]),[v,h]=useState(""),[b,y]=useState(false),[x,w]=useState(true),[k,M]=useState(""),[I,C]=useState(-1),[N,P]=useState(false),[T,V]=useState(0),O=useRef(null),X=useRef(null),F=useRef(null),Fe=useRef(null),{enabled:U=true,placeholder:De='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:z,suggestions:Me=Cw,maxHistory:Ue=50,persistHistory:ce,mentionableUsers:Le=[]}=r,J=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Pe=J?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Ee=J?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",$e=J?"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)",He=J?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",et=J?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",se=J?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",_e=J?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",qe=J?"rgba(0, 229, 204, 0.9)":"#00E5CC",Re=J?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",ut=J?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Et=J?"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)",Ge=J?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",Ie=J?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",dt=J?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",Mt=J?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Be=J?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",vt=J?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",L=J?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",Q=J?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",R=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",_="rgba(0, 229, 204, 0.04)",ue=J?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",ve=J?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Oe=J?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",ye=J?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",ft=J?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",ie=J?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",ge=J?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",Ze=J?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",Xe="rgba(0, 229, 204, 0.06)",kt=J?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",Je=J?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",At=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Yt=J?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",pr=J?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",It=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Ur=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Ht=J?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",vr=J?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",jt=J?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",or=J?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",ha=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",pa=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",tt=J?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Ye=J?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",ea=ce?.storageKey||"gantt-ai-history",_r=ce?.maxMessages??5,sa=Le.filter($=>{if(!k)return true;let ee=k.toLowerCase();return $.name.toLowerCase().includes(ee)||$.email&&$.email.toLowerCase().includes(ee)}).slice(0,5),wr=useCallback($=>{if(h($),Le.length===0)return;let ee=O.current;if(!ee)return;let ke=ee.selectionStart||$.length,D=$.slice(0,ke),W=D.lastIndexOf("@");if(W>=0&&((W>0?D[W-1]:" ")===" "||W===0)){let we=D.slice(W+1);if(we.length<=40){M(we),C(W),P(true),V(0);return}}P(false),M(""),C(-1);},[Le.length]),Wr=useCallback($=>{let ee=v.slice(0,I),ke=v.slice(I+1+k.length),D=`${ee}@${$.name} ${ke}`;h(D),P(false),M(""),C(-1),setTimeout(()=>O.current?.focus(),0);},[v,I,k]),le=useCallback($=>{if(!N||sa.length===0)return false;if($.key==="ArrowDown")return $.preventDefault(),V(ee=>ee<sa.length-1?ee+1:0),true;if($.key==="ArrowUp")return $.preventDefault(),V(ee=>ee>0?ee-1:sa.length-1),true;if($.key==="Enter"||$.key==="Tab"){$.preventDefault();let ee=sa[T];return ee&&Wr(ee),true}return $.key==="Escape"?(P(false),true):false},[N,sa,T,Wr]);useEffect(()=>{if(ce?.enabled)try{let $=localStorage.getItem(ea);if($){let ke=JSON.parse($).map(D=>({...D,timestamp:new Date(D.timestamp)}));f(ke.slice(-_r));}}catch($){console.warn("[GanttAIAssistant] Failed to load persisted history:",$);}},[ce?.enabled,ea,_r]),useEffect(()=>{if(ce?.enabled&&m.length>0)try{let $=m.filter(ee=>!ee.isLoading).slice(-_r);localStorage.setItem(ea,JSON.stringify($));}catch($){console.warn("[GanttAIAssistant] Failed to persist history:",$);}},[m,ce?.enabled,ea,_r]),useEffect(()=>{X.current&&X.current.scrollIntoView({behavior:"smooth"});},[m]),useEffect(()=>{i&&!p&&O.current&&setTimeout(()=>O.current?.focus(),100);},[i,p]);let de=useCallback($=>{if($.success)switch($.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":$.taskId&&$.updates&&n?.($.taskId,$.updates);break;case "create_task":$.newTask&&s?.($.newTask);break;case "delete_task":$.taskId&&o?.($.taskId);break;case "link_tasks":$.dependencyFrom&&$.dependencyTo&&l?.($.dependencyFrom,$.dependencyTo);break;case "unlink_tasks":$.taskId&&$.dependencyFrom&&c?.($.taskId,$.dependencyFrom);break}},[n,s,o,l,c]),pt=useCallback(async $=>{if(!$.trim()||b)return;let ee={id:`user-${Date.now()}`,role:"user",content:$,timestamp:new Date};f(D=>[...D.slice(-(Ue-1)),ee]),h(""),w(false),y(true);let ke={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(D=>[...D,ke]);try{if(z){let D=m.filter(pe=>!pe.isLoading&&pe.content).slice(-6).map(pe=>({role:pe.role,content:pe.content})),W=await z($,e,D);f(pe=>{let we=pe.filter(fe=>!fe.isLoading),rt={id:`assistant-${Date.now()}`,role:"assistant",content:W.message,timestamp:new Date,command:W};return [...we,rt]}),de(W);}else f(D=>[...D.filter(pe=>!pe.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(D){f(W=>[...W.filter(we=>!we.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${D instanceof Error?D.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[b,Ue,z,e,de]),j=$=>{$.preventDefault(),pt(v);},be=$=>{h($),O.current?.focus();};if(useEffect(()=>{let $=ee=>{(ee.metaKey||ee.ctrlKey)&&ee.key==="k"&&(ee.preventDefault(),u(ke=>!ke),i||d(false)),ee.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[i]),useEffect(()=>{if(!i)return;let $=ke=>{let D=ke.target;F.current&&!F.current.contains(D)&&u(false);},ee=setTimeout(()=>{document.addEventListener("mousedown",$);},100);return ()=>{clearTimeout(ee),document.removeEventListener("mousedown",$);}},[i]),!U)return null;let te={"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(ir,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${te[B]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Pe,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Ee}`,color:"#00E5CC",cursor:"pointer",boxShadow:$e,overflow:"visible"},onClick:()=>u(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${He}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${et}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(ag,{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:qe,background:se,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${_e}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
|
|
361
|
+
</Project>`,u=new Blob([i],{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=De.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,n=i=>{if(r.has(i.id))return;let u=i.startDate&&i.endDate?De.calculateDuration(i.startDate,i.endDate):0,p=0;if(i.dependencies&&i.dependencies.length>0)for(let m of i.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(i.id,{es:p,ef:d});};a.forEach(n);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),o=new Map,l=i=>{if(o.has(i.id))return;let u=i.startDate&&i.endDate?De.calculateDuration(i.startDate,i.endDate):0,p=t.filter(f=>f.dependencies&&f.dependencies.includes(i.id)),d=s;if(p.length>0)for(let f of p){l(f);let v=o.get(f.id)?.ls||0;d=Math.min(d,v);}let m=d-u;o.set(i.id,{ls:m,lf:d});};a.forEach(l);let c=[];for(let i of a){let u=r.get(i.id),p=o.get(i.id);if(u&&p){let d=p.ls-u.es;Math.abs(d)<.01&&c.push(i.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=De.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 l=new Map,c=[],i=[];for(let d of r)(o.get(d.id)||0)===0&&i.push(d.id);for(;i.length>0;){let d=i.shift();c.push(d);let m=n.get(d);if(!m||!m.startDate||!m.endDate)continue;let f=De.calculateDuration(m.startDate,m.endDate),v=0;if(m.dependencies)for(let b of m.dependencies){let y=l.get(b);y&&(v=Math.max(v,y.ef));}l.set(d,{es:v,ef:v+f});let h=s.get(d)||[];for(let b of h){let y=(o.get(b)||1)-1;o.set(b,y),y===0&&i.push(b);}}if(c.length<r.length)return t;let u=Math.max(...Array.from(l.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=De.calculateDuration(f.startDate,f.endDate),h=s.get(m)||[],b=u;if(h.length>0)for(let y of h){let x=p.get(y);x&&(b=Math.min(b,x.ls));}p.set(m,{ls:b-v,lf:b});}for(let d of c){let m=l.get(d),f=p.get(d),v=f.ls-m.es,h=s.get(d)||[],b;h.length>0?b=Math.min(...h.map(y=>l.get(y).es))-m.ef:b=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(b*100)/100),isCritical:v<=.01});}return t},calculateSlack:(e,t)=>{let a=De.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(De.calculateCriticalPath(e).includes(t))return 0;let n=De.getDependentTasks(e,t);if(n.length===0){let l=De.getLatestEndDate(e);if(!l)return null;let c=De.calculateDuration(a.endDate,l);return Math.max(0,c)}let s=n.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,c)=>l-c)[0];if(!s)return null;let o=De.calculateDuration(a.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>De.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=De.findTaskById(e,t);if(!s||!s.endDate)return e;let o=De.getDependentTasks(e,t);if(o.length===0)return e;let l=[...e];for(let c of o){if(n.has(c.id)||!c.startDate||!c.endDate)continue;let i=De.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=De.calculateEndDate(u,i),d=m=>m.map(f=>f.id===c.id?{...f,startDate:u,endDate:p}:f.subtasks?{...f,subtasks:d(f.subtasks)}:f);l=d(l),l=De.autoScheduleDependents(l,c.id,a,n);}return l},calculateCascadePreview:(e,t,a,r,n,s,o,l)=>{if(a===0)return [];let c=[],i=n.getTime(),u=1e3*60*60*24,p=De.findTaskById(e,t);if(!p||!p.endDate)return [];let d=(m,f,v=new Set)=>{if(v.has(m))return;v.add(m);let h=De.getDependentTasks(e,m);for(let b of h){if(!b.startDate||!b.endDate)continue;let y=r.findIndex(T=>T.id===b.id);if(y===-1)continue;let x=b.startDate.getTime(),k=(b.endDate.getTime()-x)/u,I=(x-i)/u*s,C=I+f*s,N=Math.max(k*s,s),P=l+y*o+(o-18)/2;c.push({taskId:b.id,taskName:b.name,originalX:I,previewX:C,width:N,y:P,rowIndex:y,daysDelta:f,color:b.color}),d(b.id,f,v);}};return d(t,a),c},splitTask:(e,t,a,r=3)=>{let n=De.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(a<=n.startDate||a>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let o=new Date(a);o.setDate(o.getDate()+r);let l=new Date(n.endDate);l.setDate(l.getDate()+r);let c=[{startDate:new Date(n.startDate),endDate:s},{startDate:o,endDate:l}],i=u=>u.map(p=>p.id===n.id?{...p,endDate:l,segments:c}:p.subtasks?{...p,subtasks:i(p.subtasks)}:p);return i(e)}};function ll({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:n,endDate:s,zoom:o,locale:l="en",templates:c,dependencyLineStyle:i="curved",showTaskBarLabels:u=true,onTaskClick:p,onTaskDblClick:d,onTaskContextMenu:m,onTaskDateChange:f,onDependencyCreate:v,onDependencyDelete:h,showBaseline:b,showCriticalPath:y=true,showDependencies:x=true,highlightWeekends:w=true,weekHeaderFormat:k="number",canEditTask:M,onTaskProgressDrag:I,workingDaysConfig:C}){let P=Kr(),T=useRef(null),[V,O]=useState([]),[J,L]=useState(null),[Ie,G]=useState(null),[ke,R]=useState(null),U=useRef(false),[Pe,Ze]=useState(new Set),[oe,Fe]=useState(null),Q=useCallback(B=>{if(ke&&!U.current){let q=B.target,he=false;for(;q&&q!==B.currentTarget;){if(q.getAttribute?.("data-dependency-line")==="true"||q.getAttribute?.("data-dependency-hover-overlay")==="true"){he=true;break}q=q.parentElement;}he||R(null);}},[ke]),Se=useCallback(B=>{G(B);},[]),Ue=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),Le=r==="day"?60:r==="week"?20:8,Be=Ue*Le*o,ot=B=>{let q=new Date(Date.UTC(B.getFullYear(),B.getMonth(),B.getDate())),he=q.getUTCDay()||7;q.setUTCDate(q.getUTCDate()+4-he);let Ae=new Date(Date.UTC(q.getUTCFullYear(),0,1));return Math.ceil(((q.getTime()-Ae.getTime())/864e5+1)/7)},se=B=>{let q=B.getDay();return q===0||q===6},je=useMemo(()=>{let B=C?.holidayDates;return B?B instanceof Set?B:new Set(B):null},[C?.holidayDates]),Xe=B=>{if(!je)return false;let q=`${B.getFullYear()}-${String(B.getMonth()+1).padStart(2,"0")}-${String(B.getDate()).padStart(2,"0")}`;return je.has(q)},$e=useCallback(B=>{let q=Math.round(B/(Le*o)),he=new Date(n);return he.setDate(he.getDate()+q),he},[n,Le,o]),mt=useCallback((B,q)=>{if(q.startDate&&q.endDate)return;let he=B.currentTarget.ownerSVGElement;if(!he)return;let Ae=he.createSVGPoint();Ae.x=B.clientX,Ae.y=B.clientY;let ye=Ae.matrixTransform(he.getScreenCTM()?.inverse()),tt=$e(ye.x),ie=new Date(tt);ie.setDate(ie.getDate()+1),Fe(null),f?.(q,tt,ie);},[$e,f]),Et=useCallback((B,q,he)=>{let Ae=B.currentTarget.ownerSVGElement;if(!Ae)return;let ye=Ae.createSVGPoint();ye.x=B.clientX,ye.y=B.clientY;let tt=ye.matrixTransform(Ae.getScreenCTM()?.inverse()),ie=$e(tt.x),He=Math.round(tt.x/(Le*o))*Le*o;Fe({taskId:q.id,x:He,y:he*a+a/2,date:ie});},[$e,Le,o,a]),st=useCallback(()=>{Fe(null);},[]),Ne=useMemo(()=>{let B=ye=>ye.map(tt=>{if(tt.subtasks&&tt.subtasks.length>0){let ie=B(tt.subtasks),ce=ie.filter(He=>He.startDate&&He.endDate);if(ce.length>0){let He=ce.map(vt=>vt.startDate.getTime()),at=ce.map(vt=>vt.endDate.getTime()),ft=new Date(Math.min(...He)),Ye=new Date(Math.max(...at));return {...tt,subtasks:ie,startDate:ft,endDate:Ye}}return {...tt,subtasks:ie}}return tt}),q=(ye,tt=[])=>{let ie=[...ye].sort((ce,He)=>(ce.position??0)-(He.position??0));for(let ce of ie)tt.push(ce),ce.subtasks&&ce.subtasks.length>0&&(ce.isExpanded===void 0||ce.isExpanded)&&q(ce.subtasks,tt);return tt},he=B(e);return q(he)},[e]),lt=useCallback(B=>{if(!B.startDate||!B.endDate)return {x:0,width:0};let q=B.startDate.getTime(),he=B.endDate.getTime(),Ae=n.getTime(),ye=(q-Ae)/(1e3*60*60*24),tt=(he-q)/(1e3*60*60*24)+1,ie=ye*Le*o,ce=Math.max(Le*o,40),He=Math.max(tt*Le*o,ce);return {x:ie,width:He}},[n,Le,o]),Mt=useMemo(()=>Ne.filter(B=>B.startDate&&B.endDate).map(B=>{let{x:q,width:he}=lt(B),ye=Ne.findIndex(tt=>tt.id===B.id)*a+(a-18)/2;return {id:B.id,x:q,y:ye,width:he,height:18}}),[Ne,lt]),Oe=useCallback((B,q,he)=>{if(!he){O([]),L(null);return}if(L({taskId:B,daysDelta:q}),q===0){O([]);return}let Ae=De.calculateCascadePreview(e,B,q,Ne,n,Le*o,a,48);O(Ae);},[e,Ne,n,Le,o,a,48]),xt=useCallback((B,q)=>{if(!J)return q;let he=Le*o,Ae=J.daysDelta*he;if(B===J.taskId)return {x:q.x+Ae,width:q.width};let ye=V.find(tt=>tt.taskId===B);return ye?{x:ye.previewX,width:ye.width}:q},[J,V,Le,o]),A=useMemo(()=>{let B=[],q=new Date(n);for(;q<=s;){let ye=(q.getTime()-n.getTime())/864e5*Le*o;if(r==="day")B.push({date:new Date(q),label:q.toLocaleDateString(l,{day:"numeric",month:"short"}),x:ye}),q.setDate(q.getDate()+1);else if(r==="week"){let tt=ot(q);B.push({date:new Date(q),label:k==="range"?(()=>{let ie=new Date(q);ie.setDate(ie.getDate()+6);let ce=He=>He.toLocaleDateString(l,{month:"short"});return ce(q)===ce(ie)?`${ce(q)} ${q.getDate()}\u2013${ie.getDate()}`:`${ce(q)} ${q.getDate()}\u2013${ce(ie)} ${ie.getDate()}`})():`${P.labels.week} ${tt}`,x:ye}),q.setDate(q.getDate()+7);}else B.push({date:new Date(q),label:q.toLocaleDateString(l,{month:"short",year:"numeric"}),x:ye}),q.setMonth(q.getMonth()+1);}return B},[n,s,r,Le,o,l,P.labels.week,k]),X=useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*Le*o,[n,Le,o]),we=Math.max(Ne.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(Be,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(Be,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),A.map((B,q)=>jsxs("g",{children:[q>0&&jsx("line",{x1:B.x,y1:0,x2:B.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:B.x+8,y:48/2,fill:r==="day"&&!se(B.date)&&Xe(B.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:B.label})]},`header-${q}`)),X>=0&&X<=Be&&jsxs("g",{"data-hoy":"cabecera",children:[jsx("circle",{cx:X,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:X,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${X-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:P.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:T,width:Math.max(Be,1e3),height:we,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Q,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(Be,1e3),height:we,fill:t.bgPrimary}),Ne.map((B,q)=>jsx("rect",{x:0,y:q*a,width:Math.max(Be,1e3),height:a,fill:q%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${B.id}`)),A.map((B,q)=>q>0?jsx("line",{x1:B.x,y1:0,x2:B.x,y2:Ne.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${q}`):null),A.map((B,q)=>{let he=A[q+1]?.x||Be,Ae=w&&se(B.date),ye=r==="day"&&!se(B.date)&&Xe(B.date);return Ae||ye?jsxs("g",{"data-finde":"true",children:[jsx("rect",{x:B.x,y:0,width:he-B.x,height:Ne.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsx("rect",{x:B.x,y:0,width:he-B.x,height:Ne.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${q}`):null}),Ne.map((B,q)=>{let he=B.startDate&&B.endDate;return jsx("g",{children:!he&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:q*a,width:Be,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Ae=>mt(Ae,B),onMouseMove:Ae=>Et(Ae,B,q),onMouseLeave:()=>{st();}},`clickable-${B.id}`),oe&&oe.taskId===B.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:oe.x,y1:q*a+4,x2:oe.x,y2:q*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}, ${q*a-8})`,children:[jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:oe.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!oe||oe.taskId!==B.id)&&jsx("text",{x:X>0?X:100,y:q*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:P.labels.clickToSetDates},`placeholder-${B.id}`)]})},`row-group-${B.id}`)}),Ne.map((B,q)=>{if(!B.startDate||!B.endDate)return null;let{x:he,width:Ae}=lt(B),ye=q*a+(a-18)/2,tt=B.subtasks&&B.subtasks.length>0&&!B.isMilestone;if(B.isMilestone)return jsx(il,{task:B,x:he+Ae/2,y:ye+12,theme:t,onClick:p},B.id);if(tt){let ie=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),ce=8,He=ye+(a-18)/2+(18-ce)/2,at=4,ft=B.progress||0,Ye=new Date;Ye.setHours(0,0,0,0);let vt=B.startDate&&Ye>=B.startDate,Yt=B.endDate&&(()=>{let da=new Date(B.endDate);return da.setHours(0,0,0,0),Ye>da})(),ba=B.startDate&&Ye<B.startDate,ca=1;if(vt&&B.startDate&&B.endDate&&!ba){let da=new Date(B.startDate);da.setHours(0,0,0,0);let pr=new Date(B.endDate);pr.setHours(0,0,0,0);let et=Math.max(1,(pr.getTime()-da.getTime())/(1e3*60*60*24)),Aa=Math.min((Ye.getTime()-da.getTime())/(1e3*60*60*24),et)/et*100;ca=Aa>0?ft/Aa:1;}let Gt;ft>=100?Gt="#00E5CC":ba?Gt="#4B5563":Yt&&ft<100?Gt="#EF4444":ca>=.95?Gt="#22C55E":ca>=.8?Gt="#F59E0B":Gt="#EF4444";let Bt=Math.max(ft/100*Ae,ft>0?at*2:0),Da=Ae>100&&ft>0,Ht=B.isCriticalPath;return jsxs("g",{onClick:()=>p?.(B),onContextMenu:da=>{da.preventDefault(),da.stopPropagation(),m?.(B,da);},onMouseMove:da=>{Se({task:B,x:he,y:He,width:Ae,height:ce,showBelow:He<100,mouseX:da.clientX,mouseY:da.clientY});},onMouseLeave:()=>Se(null),style:{cursor:"default",opacity:y?Ht?1:.25:1,transition:"opacity 300ms ease"},"data-barra-resumen":"true","data-estado":ft>=100?"completed":Yt?"overdue":"planned",children:[jsx("rect",{x:he,y:ye,width:Ae,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:he,y:He,width:Ae,height:ce,rx:at,fill:ie?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)","data-parte":"pista"}),ft>0&&jsx("rect",{x:he,y:He,width:Bt,height:ce,rx:at,fill:Gt,"data-parte":"avance"}),y&&Ht&&jsx("rect",{x:he,y:He,width:Ae,height:ce,rx:at,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Da&&jsxs("text",{x:he+Bt+6,y:He+ce/2,dominantBaseline:"central",fill:ie?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(ft),"%"]})]},B.id)}return jsx(al,{task:B,x:he,y:ye,width:Ae,theme:t,dayWidth:Le*o,startDate:n,templates:c,onClick:p,onDoubleClick:d,onContextMenu:m,onDateChange:f,onDependencyCreate:v,allTaskPositions:Mt,onDragMove:Oe,onHoverChange:Se,showBaseline:b,showTaskBarLabels:u,showCriticalPath:y,readOnly:M?!M(B):false,onProgressChange:I},B.id)}),x&&Ne.map((B,q)=>!B.dependencies||B.dependencies.length===0||!B.startDate||!B.endDate?null:B.dependencies.map(he=>{let Ae=Ne.find(Gt=>Gt.id===he);if(!Ae||!Ae.startDate||!Ae.endDate)return null;let ye=Ne.findIndex(Gt=>Gt.id===he),tt=xt(Ae.id,lt(Ae)),ie=xt(B.id,lt(B)),ce=tt.x+tt.width,He=ye*a+26,at=ie.x,ft=q*a+26,Ye=`dep-${he}-${B.id}`;if(Pe.has(Ye))return null;let vt=y&&B.isCriticalPath&&Ae.isCriticalPath;return jsx(Js,{x1:ce,y1:He,x2:at,y2:ft,theme:t,lineStyle:i,colorOverride:y?vt?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:y?vt?2:1:void 0,glowFilter:vt?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.(B.id,he),onHoverChange:Gt=>{U.current=Gt,Gt&&R({key:Ye,fromId:he,toId:B.id,exitX:ce,exitY:He,enterX:at,enterY:ft});}},Ye)})),V.map(B=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:B.previewX,y:B.y-48,width:B.width,height:18,rx:6,fill:B.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(B.daysDelta)>0&&jsx("text",{x:B.previewX+B.width/2,y:B.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:B.daysDelta>0?`+${B.daysDelta}d`:`${B.daysDelta}d`})]},`cascade-preview-${B.taskId}`)),x&&ke&&jsx(Js,{x1:ke.exitX,y1:ke.exitY,x2:ke.enterX,y2:ke.enterY,theme:t,lineStyle:i,onDelete:()=>{let B=ke.key;R(null),U.current=false,Ze(q=>new Set(q).add(B)),h?.(ke.toId,ke.fromId);},hoverOverlayOnly:true,onHoverChange:B=>{U.current=B,B||R(null);}},`${ke.key}-hover-overlay`),X>=0&&X<=Be&&jsxs("g",{"data-hoy":"linea",style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:X,y1:0,x2:X,y2:we,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:X,y1:0,x2:X,y2:we,stroke:t.today,strokeWidth:1,opacity:1})]})]}),Ie&&jsx(eg,{tooltipData:Ie,theme:t,locale:l==="es"?"es":"en",workingDaysConfig:C})]})}var Nw=['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"'],rg=({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"})}),Dw=()=>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"})}),Sw=()=>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"})}),Ew=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Mw=()=>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 ul({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:l,onDependencyDelete:c}){let[i,u]=useState(false),[p,d]=useState(false),[m,f]=useState([]),[v,h]=useState(""),[b,y]=useState(false),[x,w]=useState(true),[k,M]=useState(""),[I,C]=useState(-1),[N,P]=useState(false),[T,V]=useState(0),O=useRef(null),J=useRef(null),L=useRef(null),Ie=useRef(null),{enabled:G=true,placeholder:ke='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:U,suggestions:Pe=Nw,maxHistory:Ze=50,persistHistory:oe,mentionableUsers:Fe=[]}=a,Q=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Se=Q?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Ue=Q?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",Le=Q?"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)",Be=Q?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",ot=Q?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",se=Q?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",je=Q?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",Xe=Q?"rgba(0, 229, 204, 0.9)":"#00E5CC",$e=Q?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",mt=Q?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Et=Q?"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)",st=Q?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",Ne=Q?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",lt=Q?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",Mt=Q?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Oe=Q?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",xt=Q?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",A=Q?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",X=Q?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",we=Q?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",B="rgba(0, 229, 204, 0.04)",q=Q?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",he=Q?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ae=Q?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",ye=Q?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",tt=Q?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",ie=Q?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",ce=Q?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",He=Q?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",at="rgba(0, 229, 204, 0.06)",ft=Q?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",Ye=Q?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",vt=Q?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Yt=Q?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",ba=Q?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",ca=Q?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Gt=Q?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Bt=Q?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Da=Q?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Ht=Q?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",kr=Q?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",da=Q?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",pr=Q?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",et=Q?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Je=Q?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Aa=oe?.storageKey||"gantt-ai-history",ja=oe?.maxMessages??5,or=Fe.filter($=>{if(!k)return true;let ee=k.toLowerCase();return $.name.toLowerCase().includes(ee)||$.email&&$.email.toLowerCase().includes(ee)}).slice(0,5),Ca=useCallback($=>{if(h($),Fe.length===0)return;let ee=O.current;if(!ee)return;let Ce=ee.selectionStart||$.length,D=$.slice(0,Ce),W=D.lastIndexOf("@");if(W>=0&&((W>0?D[W-1]:" ")===" "||W===0)){let ve=D.slice(W+1);if(ve.length<=40){M(ve),C(W),P(true),V(0);return}}P(false),M(""),C(-1);},[Fe.length]),Wa=useCallback($=>{let ee=v.slice(0,I),Ce=v.slice(I+1+k.length),D=`${ee}@${$.name} ${Ce}`;h(D),P(false),M(""),C(-1),setTimeout(()=>O.current?.focus(),0);},[v,I,k]),de=useCallback($=>{if(!N||or.length===0)return false;if($.key==="ArrowDown")return $.preventDefault(),V(ee=>ee<or.length-1?ee+1:0),true;if($.key==="ArrowUp")return $.preventDefault(),V(ee=>ee>0?ee-1:or.length-1),true;if($.key==="Enter"||$.key==="Tab"){$.preventDefault();let ee=or[T];return ee&&Wa(ee),true}return $.key==="Escape"?(P(false),true):false},[N,or,T,Wa]);useEffect(()=>{if(oe?.enabled)try{let $=localStorage.getItem(Aa);if($){let Ce=JSON.parse($).map(D=>({...D,timestamp:new Date(D.timestamp)}));f(Ce.slice(-ja));}}catch($){console.warn("[GanttAIAssistant] Failed to load persisted history:",$);}},[oe?.enabled,Aa,ja]),useEffect(()=>{if(oe?.enabled&&m.length>0)try{let $=m.filter(ee=>!ee.isLoading).slice(-ja);localStorage.setItem(Aa,JSON.stringify($));}catch($){console.warn("[GanttAIAssistant] Failed to persist history:",$);}},[m,oe?.enabled,Aa,ja]),useEffect(()=>{J.current&&J.current.scrollIntoView({behavior:"smooth"});},[m]),useEffect(()=>{i&&!p&&O.current&&setTimeout(()=>O.current?.focus(),100);},[i,p]);let ue=useCallback($=>{if($.success)switch($.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":$.taskId&&$.updates&&n?.($.taskId,$.updates);break;case "create_task":$.newTask&&s?.($.newTask);break;case "delete_task":$.taskId&&o?.($.taskId);break;case "link_tasks":$.dependencyFrom&&$.dependencyTo&&l?.($.dependencyFrom,$.dependencyTo);break;case "unlink_tasks":$.taskId&&$.dependencyFrom&&c?.($.taskId,$.dependencyFrom);break}},[n,s,o,l,c]),gt=useCallback(async $=>{if(!$.trim()||b)return;let ee={id:`user-${Date.now()}`,role:"user",content:$,timestamp:new Date};f(D=>[...D.slice(-(Ze-1)),ee]),h(""),w(false),y(true);let Ce={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(D=>[...D,Ce]);try{if(U){let D=m.filter(pe=>!pe.isLoading&&pe.content).slice(-6).map(pe=>({role:pe.role,content:pe.content})),W=await U($,e,D);f(pe=>{let ve=pe.filter(ge=>!ge.isLoading),rt={id:`assistant-${Date.now()}`,role:"assistant",content:W.message,timestamp:new Date,command:W};return [...ve,rt]}),ue(W);}else f(D=>[...D.filter(pe=>!pe.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(D){f(W=>[...W.filter(ve=>!ve.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${D instanceof Error?D.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[b,Ze,U,e,ue]),j=$=>{$.preventDefault(),gt(v);},fe=$=>{h($),O.current?.focus();};if(useEffect(()=>{let $=ee=>{(ee.metaKey||ee.ctrlKey)&&ee.key==="k"&&(ee.preventDefault(),u(Ce=>!Ce),i||d(false)),ee.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[i]),useEffect(()=>{if(!i)return;let $=Ce=>{let D=Ce.target;L.current&&!L.current.contains(D)&&u(false);},ee=setTimeout(()=>{document.addEventListener("mousedown",$);},100);return ()=>{clearTimeout(ee),document.removeEventListener("mousedown",$);}},[i]),!G)return null;let ae={"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(ia,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${ae[R]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Se,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Ue}`,color:"#00E5CC",cursor:"pointer",boxShadow:Le,overflow:"visible"},onClick:()=>u(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${Be}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${ot}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(rg,{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:Xe,background:se,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${je}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
|
|
362
362
|
@keyframes ai-fab-pulse {
|
|
363
363
|
0%, 100% { transform: scale(1); opacity: 0.4; }
|
|
364
364
|
50% { transform: scale(1.15); opacity: 0; }
|
|
365
365
|
}
|
|
366
|
-
`})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:F,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 ${te[B]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:Re,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${ut}`,boxShadow:Et},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Ge,borderBottom:`1px solid ${Ie}`},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 ${Mt}`,color:"#00E5CC"},children:jsx(ag,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Be},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>d($=>!$),className:"p-1.5 rounded-lg transition-colors",style:{color:vt},onMouseEnter:$=>{$.currentTarget.style.background=Q,$.currentTarget.style.color=L;},onMouseLeave:$=>{$.currentTarget.style.background="transparent",$.currentTarget.style.color=vt;},children:jsx(Dw,{})}),jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg transition-colors",style:{color:vt},onMouseEnter:$=>{$.currentTarget.style.background=Q,$.currentTarget.style.color=L;},onMouseLeave:$=>{$.currentTarget.style.background="transparent",$.currentTarget.style.color=vt;},children:jsx(Nw,{})})]})]}),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:R,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:Me.slice(0,4).map(($,ee)=>jsx("button",{onClick:()=>be($),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:_,color:ve,border:`1px solid ${ue}`},onMouseEnter:ke=>{ke.currentTarget.style.borderColor=Oe,ke.currentTarget.style.color="#00E5CC";},onMouseLeave:ke=>{ke.currentTarget.style.borderColor=ue,ke.currentTarget.style.color=ve;},children:$.length>30?$.slice(0,30)+"...":$},ee))})]}),m.map($=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${$.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${$.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:$.role==="user"?ye:ie,color:$.role==="user"?"#00E5CC":Ze,border:$.role==="user"?`1px solid ${ft}`:`1px solid ${ge}`},children:[$.isLoading?jsx(Sw,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:$.content}),$.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:$.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:$.command.success?"#10B981":"#EF4444",border:`1px solid ${$.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[$.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:$.command.type.replace(/_/g," ")})]})]})},$.id)),jsx("div",{ref:X})]}),jsxs("form",{onSubmit:$=>{if(N&&sa.length>0){$.preventDefault();return}j($);},className:"p-3 relative",style:{borderTop:`1px solid ${Xe}`},children:[jsx(AnimatePresence,{children:N&&sa.length>0&&jsx(motion.div,{ref:Fe,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:Ht,border:`1px solid ${vr}`,boxShadow:jt,backdropFilter:"blur(12px)"},children:sa.map(($,ee)=>jsxs("button",{type:"button",onClick:()=>Wr($),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:ee===T?or:"transparent",color:ha},onMouseEnter:()=>V(ee),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:tt,border:`1px solid ${Ye}`,color:"#00E5CC"},children:$.name.split(" ").map(ke=>ke[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:$.name}),$.email&&jsx("div",{className:"text-xs truncate",style:{color:pa},children:$.email})]})]},$.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:kt,border:`1px solid ${Je}`},children:[jsx("input",{ref:O,type:"text",value:v,onChange:$=>wr($.target.value),onKeyDown:$=>{le($);},placeholder:De,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:At,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!v.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:v.trim()?Yt:"transparent",color:v.trim()?"#00E5CC":It,border:v.trim()?`1px solid ${pr}`:"1px solid transparent"},children:jsx(Tw,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Ur,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function ng(e,t=50){let[r,a]=useState({past:[],present:e,future:[]}),n=useRef(false),s=useCallback((i,u=true)=>{a(p=>{let d=typeof i=="function"?i(p.present):i;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(()=>{a(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],p=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:p,present:u,future:[i.present,...i.future]}});},[]),l=useCallback(()=>{a(i=>{if(i.future.length===0)return i;let u=i.future[0],p=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:u,future:p}});},[]),c=useCallback(()=>{a(i=>({past:[],present:i.present,future:[]}));},[]);return {state:r.present,setState:s,undo:o,redo:l,canUndo:r.past.length>0,canRedo:r.future.length>0,clearHistory:c}}function og({undo:e,redo:t,canUndo:r,canRedo:a,enabled:n=true}){useEffect(()=>{if(!n)return;let s=o=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?o.metaKey:o.ctrlKey;if(c&&o.key==="z"&&!o.shiftKey&&r){o.preventDefault(),e();return}if(a){if(!l&&c&&o.key==="y"){o.preventDefault(),t();return}if(l&&c&&o.shiftKey&&o.key==="z"){o.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,r,a,n]);}var Fw={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Ne.formatDate(e.startDate)} - ${Ne.formatDate(e.endDate)}`);let r=Ne.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${r} 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 r=e.assignees.map(a=>a.name).join(", ");t.push(`Assigned: ${r}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,r)=>r,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>Ne.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function sg(e){return {...Fw,...e}}var Hw=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},ug=forwardRef(function({tasks:t,config:r={},onTasksChange:a},n){let{theme:s,timeScale:o="week",rowDensity:l="comfortable",showThemeSelector:c=true,showExportButton:i=true,onExportSuccess:u,projectName:p,availableUsers:d=[],templates:m,enableAutoCriticalPath:f=true,persistExpandedState:v,persistFilter:h,persistColumns:b,clearFiltersKey:y,aiAssistant:x,locale:w="en",customTranslations:k,showCreateTaskButton:M=false,createTaskLabel:I,onCreateTask:C,taskFilter:N,onTaskFilterChange:P,toolbarRightContent:T,toolbarContainer:V,hideWbsLevel:O,showBaseline:X,viewMode:F,onViewModeChange:Fe,projectForecast:U,hideForecastHud:De,onThemeChange:B,onTaskClick:z,onTaskSelectionChange:Me,selectedTaskId:Ue,onTaskDblClick:ce,onTaskContextMenu:Le,onTaskUpdate:J,onDependentTasksScheduled:Pe,onProgressChange:Ee,onTaskEdit:$e,onTaskAddSubtask:He,onTaskMarkIncomplete:et,onTaskSetInProgress:se,onDependencyCreate:_e,onDependencyDelete:qe,onBeforeTaskAdd:Re,onAfterTaskAdd:ut,onBeforeTaskUpdate:Et,onAfterTaskUpdate:Ge,onBeforeTaskDelete:Ie,onAfterTaskDelete:dt,permissions:Mt,onCopySnapshotLink:Be}=r,L=useContext(Xi)?.theme,[Q,R]=useState(L||s||"dark"),[_,ue]=useState(o),[ve,Oe]=useState(l),[ye,ft]=useState(1),[ie,ge]=useState("all"),[Ze,Xe]=useState(F||"execution"),kt=F??Ze,Je=useCallback(E=>{Xe(E),Fe?.(E);},[Fe]),At=X??kt==="oracle",[Yt,pr]=useState(r.showCriticalPath!==false),[It,Ur]=useState(r.showDependencies!==false),[Ht,vr]=useState(r.highlightWeekends!==false),jt=useCallback(E=>{pr(E),r.onShowCriticalPathChange?.(E);},[r.onShowCriticalPathChange]),or=useCallback(E=>{Ur(E),r.onShowDependenciesChange?.(E);},[r.onShowDependenciesChange]),ha=useCallback(E=>{vr(E),r.onHighlightWeekendsChange?.(E);},[r.onHighlightWeekendsChange]);useEffect(()=>{r.onTimeScaleChange?.(_);},[_]),useEffect(()=>{r.onZoomChange?.(ye);},[ye]);let pa=useRef(r.onDateRangeChange);pa.current=r.onDateRangeChange;let tt=useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[Ye,ea]=useState(()=>{if(!h)return "all";try{let E=typeof h=="string"?h:"gantt-filter-state",A=localStorage.getItem(E);if(A){let H=JSON.parse(A);if(H.taskFilter)return H.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),_r=N??Ye,sa=P??ea,[wr,Wr]=useState(()=>{if(!h)return false;try{let E=typeof h=="string"?h:"gantt-filter-state",A=localStorage.getItem(E);if(A){let H=JSON.parse(A);if(typeof H.hideCompleted=="boolean")return H.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});useEffect(()=>{let E=tt();if(E)try{let A={taskFilter:_r,hideCompleted:wr};localStorage.setItem(E,JSON.stringify(A));}catch(A){console.warn("[GanttBoard] Error saving filter state to localStorage:",A);}},[_r,wr,tt]);let le=useRef(y);useEffect(()=>{if(le.current!==y&&y!==void 0){ea("all"),Wr(false);let E=tt();if(E)try{localStorage.removeItem(E);}catch(A){console.warn("[GanttBoard] Error clearing filter state from localStorage:",A);}}le.current=y;},[y,tt]);let[de,pt]=useState(0),[j,be]=useState(false),[te,$]=useState(null),[ee,ke]=useState({isOpen:false,x:0,y:0,task:null}),[D,W]=useState(null),[pe,we]=useState(null);useEffect(()=>{L&&L!==Q&&R(L);},[L]),useEffect(()=>{s&&s!==Q&&R(s);},[s]);let rt=useCallback(E=>{R(E),B?.(E);},[B]),{state:fe,setState:q,undo:it,redo:bt,canUndo:Pt,canRedo:Zt,clearHistory:ya}=ng(t,50),Kr=useMemo(()=>{let E=(A,H=0)=>{let K=H;for(let ae of A)ae.subtasks?.length&&(K=Math.max(K,E(ae.subtasks,H+1)));return K};return E(fe)+1},[fe]),Za=useCallback(()=>v?typeof v=="string"?v:"gantt-expanded-tasks":null,[v]),er=useRef(new Map),yo=useRef(false);if(!yo.current&&v){yo.current=true;let E=typeof v=="string"?v:"gantt-expanded-tasks";try{let A=localStorage.getItem(E);if(A){let H=JSON.parse(A);Array.isArray(H)&&(er.current=new Map(H));}}catch(A){console.warn("[GanttBoard] Error loading expanded state from localStorage:",A);}}let Vn=useCallback(()=>{let E=Za();if(E)try{let A=Array.from(er.current.entries());localStorage.setItem(E,JSON.stringify(A));}catch(A){console.warn("[GanttBoard] Error saving expanded state to localStorage:",A);}},[Za]),Wa=useRef(0),jn=useRef(fe);useEffect(()=>{jn.current=fe;},[fe]);let _n=useRef(false),bi=useCallback(E=>{ge(E),Wa.current+=1,q(A=>{let H=(ae,me=0)=>ae.map(Ve=>{let je=E==="all"||me<E-1;return Ve.subtasks?.length&&er.current.set(Ve.id,je),{...Ve,isExpanded:je,subtasks:Ve.subtasks?H(Ve.subtasks,me+1):void 0}}),K=H(A);return Vn(),K});},[q,Vn]);useEffect(()=>{if(Wa.current>0){Wa.current-=1;return}let E=H=>{let K=new Map;for(let ae of H){let me=ae.id;K.get(me)||K.set(me,ae);}return Array.from(K.values())},A=H=>H.map(K=>{let ae=er.current.get(K.id),me=ae!==void 0?{...K,isExpanded:ae}:K;if(me.subtasks?.length){let Ve=E(me.subtasks);return {...me,subtasks:A(Ve)}}return me});if(er.current.size>0)q(Ka(A(t)));else {let H=K=>K.map(ae=>ae.subtasks?.length?{...ae,subtasks:E(H(ae.subtasks))}:ae);q(Ka(H(t)));}},[t,q]);let _o=useRef(t),hi=useRef(true);useEffect(()=>{if(hi.current){hi.current=false,_o.current=fe;return}if(_n.current){_n.current=false,_o.current=fe;return}if(!a)return;let E=JSON.stringify(_o.current),A=JSON.stringify(fe);E!==A&&(_o.current=fe,a(fe));},[fe,a]);let qr=useMemo(()=>td(w,k),[w,k]),xo=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}],[]),ma=useMemo(()=>b?typeof b=="string"?b:"gantt-columns-state":null,[b]),[za,en]=useState(()=>{let E=xo(qr);if(!b)return E;try{let A=typeof b=="string"?b:"gantt-columns-state",H=localStorage.getItem(A);if(!H)return E;let K=JSON.parse(H),ae=new Map(K.map(me=>[me.id,me]));return E.map(me=>{let Ve=ae.get(me.id);return Ve?{...me,visible:Ve.visible??me.visible,width:Ve.width??me.width}:me})}catch(A){return console.warn("[GanttBoard] Error loading columns state from localStorage:",A),E}}),Kn=useRef(ma);useEffect(()=>{if(Kn.current===ma)return;Kn.current=ma;let E=xo(qr);if(!ma){en(E);return}try{let A=localStorage.getItem(ma);if(!A){en(E);return}let H=JSON.parse(A),K=new Map(H.map(ae=>[ae.id,ae]));en(E.map(ae=>{let me=K.get(ae.id);return me?{...ae,visible:me.visible??ae.visible,width:me.width??ae.width}:ae}));}catch(A){console.warn("[GanttBoard] Error reloading columns state from localStorage:",A),en(E);}},[ma,xo,qr]),useEffect(()=>{if(ma&&Kn.current===ma)try{let E=za.map(A=>({id:A.id,visible:A.visible,width:A.width}));localStorage.setItem(ma,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving columns state to localStorage:",E);}},[za,ma]),useEffect(()=>{en(E=>E.map(A=>({...A,label:qr.columns[A.id==="name"?"taskName":A.id]||A.label})));},[qr]);let S=useMemo(()=>za.filter(A=>A.visible).reduce((A,H)=>A+H.width,0),[za]),Y=useRef(za.filter(E=>E.visible).map(E=>E.id).join(","));useEffect(()=>{let E=za.filter(K=>K.visible),A=E.map(K=>K.id).join(","),H=Y.current;if(A!==H){let K=E.some(me=>me.id!=="name"),ae=H.includes(",");K?!ae&&K&&$(null):$(null),Y.current=A;}},[za]);let re=60,xe=.6,Ce=useMemo(()=>{let A=S+re,H=typeof window<"u"?window.innerWidth*xe:800,K=Math.max(A,H);return te!==null?Math.max(200,Math.min(te,K)):Math.max(200,A)},[te,S]),We=useRef(null),oe=useRef(null),Te=useRef(null),Ke=useRef(null),at=useRef(null),nt=useMemo(()=>Tm(Q),[Q]),mt=useMemo(()=>({theme:nt,themeName:Q}),[nt,Q]),gt=useMemo(()=>sg(m),[m]),mr=useMemo(()=>{if(!f||!Yt)return fe;let E=Ne.calculateCriticalPathFull(fe),A=H=>H.map(K=>{let ae=E.get(K.id),me=K.subtasks?A(K.subtasks):void 0,Ve=me?.some(tr=>tr.isCriticalPath||tr.subtasks&&tr.subtasks.some(Wt=>Wt.isCriticalPath))||false,je=ae?ae.isCritical:Ve;return {...K,isCriticalPath:je,cpmData:ae||void 0,subtasks:me}});return A(fe)},[fe,f,Yt]),kr=useMemo(()=>Ne.flattenTasks(fe).some(A=>A.dependencies&&A.dependencies.length>0),[fe]),zr=useMemo(()=>{let E=(A,H="")=>[...A].sort((ae,me)=>(ae.position??0)-(me.position??0)).map((ae,me)=>{let Ve=me+1,je=H?`${H}.${Ve}`:`${Ve}.0`,tr=H?`${H}.${Ve}`:`${Ve}`;return {...ae,wbsCode:je,subtasks:ae.subtasks?.length?E(ae.subtasks,tr):ae.subtasks}});return E(mr)},[mr]),Ut=useMemo(()=>{if(_r==="all"&&!wr)return zr;let E=A=>{let H=[];for(let K of A){let ae=K.subtasks?.length?E(K.subtasks):void 0,me=false;if(wr)me=K.progress<100;else switch(_r){case "all":me=true;break;case "incomplete":me=K.progress<100;break;case "in_progress":me=K.progress>0&&K.progress<100;break;case "completed":me=K.progress===100;break}(me||ae&&ae.length>0)&&H.push({...K,subtasks:ae});}return H};return E(zr)},[zr,_r,wr]),Gt=Hw(ve);og({undo:it,redo:bt,canUndo:Pt,canRedo:Zt,enabled:true});let yt=useRef(null),Ft=(E,A="start")=>{let H=Te.current,K=at.current;if(!H||!K)return;let ae=(E.getTime()-K.startDate.getTime())/(1e3*60*60*24),me=K.timeScale==="day"?60:K.timeScale==="week"?20:8,Ve=ae*me*K.zoom,je=A==="center"?Ve-H.clientWidth/2:Ve-me*K.zoom*2;H.scrollTo({left:Math.max(0,je),behavior:"auto"});};useImperativeHandle(n,()=>({getTask:E=>Ne.findTaskById(fe,E),addTask:(E,A)=>{q(H=>{if(!A)return [...H,{...E,level:0}];let K=ae=>ae.map(me=>me.id===A?{...me,subtasks:[...me.subtasks||[],{...E,parentId:A,level:(me.level||0)+1}],isExpanded:true}:me.subtasks?{...me,subtasks:K(me.subtasks)}:me);return K(H)});},updateTask:(E,A)=>{q(H=>{let K=ae=>ae.map(me=>me.id===E?{...me,...A}:me.subtasks?{...me,subtasks:K(me.subtasks)}:me);return K(H)});},deleteTask:E=>{q(A=>{let H=K=>K.filter(ae=>ae.id===E?false:(ae.subtasks&&(ae.subtasks=H(ae.subtasks)),true));return H(A)});},deleteTasks:E=>{q(A=>md(A,E));},duplicateTask:E=>{if(r.onTaskDuplicate){let A=Ne.findTaskById(fe,E);A&&r.onTaskDuplicate(A);}else q(A=>Ys(A,[E]).tasks);},splitTask:(E,A,H=3)=>{q(K=>Ne.splitTask(K,E,A,H));},calculateEndDate:Ne.calculateEndDate,calculateDuration:Ne.calculateDuration,validateDependency:(E,A)=>!Ne.validateDependencies(fe,E,A),getAllTasks:()=>Ne.flattenTasks(fe),getTasksByStatus:E=>Ne.flattenTasks(fe).filter(A=>A.status===E),getTasksByParent:E=>E?Ne.findTaskById(fe,E)?.subtasks||[]:fe.filter(H=>!H.parentId),getCriticalPath:()=>Ne.flattenTasks(fe).filter(E=>E.isCriticalPath),indentTask:E=>{q(A=>Ka(dd(A,[E])));},outdentTask:E=>{q(A=>Ka(ud(A,[E])));},moveTask:(E,A)=>{q(H=>pd(H,[E],A));},createSubtask:async E=>{let{tasks:A,newTask:H}=bd(fe,E);if(Re){let K=Re({...H,parentId:E});if((K instanceof Promise?await K:K)===false)return}q(Ka(A)),ut&&ut({...H,parentId:E});},scrollToTask:E=>{let H=Ne.flattenTasks(fe).findIndex(K=>K.id===E);if(H!==-1&&We.current){let K=H*Gt;We.current.scrollTo({top:K,behavior:"smooth"}),Te.current&&Te.current.scrollTo({top:K,behavior:"smooth"});}},highlightTask:(E,A=2e3)=>{},expandTask:E=>{q(A=>{let H=K=>K.map(ae=>ae.id===E?{...ae,isExpanded:true}:ae.subtasks?{...ae,subtasks:H(ae.subtasks)}:ae);return H(A)});},collapseTask:E=>{q(A=>{let H=K=>K.map(ae=>ae.id===E?{...ae,isExpanded:false}:ae.subtasks?{...ae,subtasks:H(ae.subtasks)}:ae);return H(A)});},expandAll:()=>{q(E=>{let A=H=>H.map(K=>({...K,isExpanded:true,subtasks:K.subtasks?A(K.subtasks):void 0}));return A(E)});},collapseAll:()=>{q(E=>{let A=H=>H.map(K=>({...K,isExpanded:false,subtasks:K.subtasks?A(K.subtasks):void 0}));return A(E)});},collapseToLevel:E=>{bi(E);},undo:it,redo:bt,canUndo:()=>Pt,canRedo:()=>Zt,clearHistory:ya,exportToPNG:async()=>{if(!Ke.current||!We.current||!Te.current)throw new Error("Gantt container not found");let E=Ke.current,A=We.current,H=oe.current||A.querySelector(".gantt-grid-scroll"),K=Te.current,ae=H?.scrollTop||0,me=K.scrollTop,Ve=E.style.overflow,je=E.style.height,tr=A.style.overflow;try{let Wt=H?.querySelector(".gantt-taskgrid-content"),sr=K.querySelector("svg"),ga=Wt?.scrollHeight||H?.scrollHeight||600,$a=sr?.getBoundingClientRect().height||K.scrollHeight,ko=(E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(ga,$a)+20;H&&(H.scrollTop=0),K.scrollTop=0,E.style.overflow="visible",E.style.height=`${ko}px`,A.style.overflow="visible",await new Promise(Yo=>setTimeout(Yo,100));let kn=await toPng(E,{backgroundColor:nt.bgPrimary,pixelRatio:2,filter:Yo=>{if(!(Yo instanceof Element))return !0;let yi=window.getComputedStyle(Yo),Ms=parseInt(yi.zIndex,10);return (isNaN(Ms)||Ms<50)&&yi.position!=="fixed"}});return await(await fetch(kn)).blob()}finally{E.style.overflow=Ve,E.style.height=je,A.style.overflow=tr,H&&(H.scrollTop=ae),K.scrollTop=me;}},exportToPDF:async E=>{await Ne.exportToPDF(fe,E);},exportToExcel:async E=>{await Ne.exportToExcel(fe,E,Jl.current);},exportToJSON:()=>Ne.exportToJSON(fe),exportToCSV:()=>Ne.exportToCSV(fe),importFromJSON:E=>{let A=Ne.importFromJSON(E);q(A);},getTasks:()=>fe,refresh:()=>{q(E=>[...E]);},clearAll:()=>{q([]);},scrollToDate:(E,A="start")=>Ft(E,A),fitToDates:(E,A)=>{let H=Math.max(1,(A.getTime()-E.getTime())/864e5),K=H<=21?"day":H<=122?"week":"month";yt.current=E,ue(K),K===at.current?.timeScale&&requestAnimationFrame(()=>{let ae=yt.current;yt.current=null,ae&&Ft(ae);});},scrollToToday:()=>{let E=Te.current,A=at.current;if(!E||!A)return;let K=(new Date().getTime()-A.startDate.getTime())/(1e3*60*60*24),ae=A.timeScale==="day"?60:A.timeScale==="week"?20:8,me=K*ae*A.zoom,Ve=E.clientWidth,je=Math.max(0,me-Ve/2);E.scrollTo({left:je,behavior:"smooth"});}}),[fe,it,bt,Pt,Zt,ya,nt,Gt]);let Lr=useCallback(E=>{en(A=>A.map(H=>H.id===E?{...H,visible:!H.visible}:H));},[]),xa=useCallback((E,A)=>{en(H=>H.map(K=>{if(K.id!==E)return K;let ae=K.minWidth??100,me=K.maxWidth??800,Ve=Math.max(ae,Math.min(me,A));return {...K,width:Ve}}));},[]),Ta=useCallback(E=>{q(A=>{let H=fd(A,E),K=ae=>{for(let me of ae){if(me.id===E){er.current.set(E,me.isExpanded??true);return}me.subtasks?.length&&K(me.subtasks);}};return K(H),Vn(),H}),r.onTaskToggleExpand?.(E);},[r,Vn]),Cr=useCallback((E,A)=>{if(Et&&Et(E,A)===false)return;let K=Ne.findTaskById(fe,E)?.progress,ae=Ve=>Ve.map(je=>je.id===E?{...je,...A}:je.subtasks?{...je,subtasks:ae(je.subtasks)}:je);q(Ve=>ae(Ve));let me=Ne.findTaskById(ae(fe),E);me&&(J?.(me),Ge?.(me),A.progress!==void 0&&K!==void 0&&A.progress!==K&&Ee?.(E,K,A.progress));},[fe,J,Et,Ge,Ee]),Yr=useCallback((E,A,H)=>{if(E.length===0)return;let K=new Set(E),ae=me=>me.map(Ve=>{let je=K.has(Ve.id)?{...Ve,[A]:H}:Ve;return je.subtasks?{...je,subtasks:ae(je.subtasks)}:je});q(me=>{let Ve=ae(me);return r.onBulkFill?.(E,A,H,Ve),Ve});},[r]),vo=useCallback(E=>{E.length!==0&&(Wa.current+=1,_n.current=true,q(A=>Ka(dd(A,E))),r.onTaskIndent?.(E[0]));},[r]),Ss=useCallback(E=>{E.length!==0&&(Wa.current+=1,_n.current=true,q(A=>Ka(ud(A,E))),r.onTaskOutdent?.(E[0]));},[r]),wo=useCallback((E,A,H)=>{Wa.current+=1,_n.current=true,q(K=>Ka(jm(K,E,A,H))),r.onTaskReparent?.(E,A,H);},[r]),fb=useCallback((E,A)=>{E.length!==0&&(Wa.current+=1,_n.current=true,q(H=>pd(H,E,A)),r.onTaskMove?.(E[0],A));},[r]),ql=useCallback(async E=>{let A=[];for(let H of E)Ie&&await Promise.resolve(Ie(H))===false||A.push(H);A.length!==0&&(r.onMultiTaskDelete?r.onMultiTaskDelete(A):(q(H=>Ka(md(H,A))),A.forEach(H=>r.onTaskDelete?.(H))),dt&&A.forEach(H=>dt(H)));},[r,Ie,dt]),bb=useCallback(E=>{r.onTaskDuplicate?E.forEach(A=>{let H=Ne.findTaskById(fe,A);H&&r.onTaskDuplicate(H);}):q(A=>Ys(A,E).tasks);},[r,fe]),hb=useCallback((E,A)=>{q(H=>{let{tasks:K,newTask:ae}=Vm(H,E,A);return Re&&Re(ae)===false?H:(r.onTaskCreate?.(ae.parentId,ae.position||0),ut?.(ae),K)});},[r,Re,ut]),yb=useCallback((E,A)=>{q(H=>gd(H,E,A)),r.onTaskRename?.(E,A);},[r]),Yl=useCallback(E=>{let{onTaskAddSubtask:A}=r;if(A){let H=ds(fe,E);if(H){A(H);return}}q(H=>{let{tasks:K}=bd(H,E);return r.onTaskCreate?.(E,0),K});},[r,fe]),xb=useCallback((E,A)=>{let H=Math.max(0,Math.min(100,Math.round(A))),K={progress:H};H===100?K.status="completed":H>0?K.status="in-progress":K.status="todo",Cr(E.id,K);},[Cr]),vb=useCallback((E,A,H)=>{let K=!E.startDate&&!E.endDate,ae=E.startDate?Math.round((A.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,me=Wt=>Wt.map(sr=>sr.id===E.id?{...sr,startDate:A,endDate:H,...E.segments&&{segments:E.segments}}:sr.subtasks?{...sr,subtasks:me(sr.subtasks)}:sr),Ve=me(fe),je=Ve;Ve=Ne.autoScheduleDependents(Ve,E.id,ae),Ve=Ka(Ve),q(Ve);let tr={...E,startDate:A,endDate:H};if(K&&r?.onTaskDateChange?r.onTaskDateChange(E,A,H):J?.(tr),Pe&&ae!==0){let Wt=Ne.flattenTasks(je),sr=Ne.flattenTasks(Ve),ga=[];for(let $a of sr){if($a.id===E.id)continue;let qn=Wt.find(kn=>kn.id===$a.id);if(!qn)continue;let qo=$a.startDate?.getTime()!==qn.startDate?.getTime(),ko=$a.endDate?.getTime()!==qn.endDate?.getTime();(qo||ko)&&ga.push($a);}ga.length>0&&Pe(ga);}},[fe,J,Pe,r]),wb=useCallback((E,A)=>{Le?.(E,A),ke({isOpen:true,x:A.clientX,y:A.clientY,task:E});},[Le]),kb=useCallback((E,A)=>{let H=Ne.splitTask(fe,E.id,A);q(H),ke({isOpen:false,x:0,y:0,task:null});},[fe]),Fu=useCallback(E=>{let A=Ne.findTaskById(fe,E.id)||E;ce?.(A),$e||W(A);},[fe,ce,$e]),Lu=useCallback((E,A,H)=>{let K=new Map,ae=Wt=>{Wt.forEach(sr=>{sr.dependencies&&K.set(sr.id,sr.dependencies),sr.subtasks&&ae(sr.subtasks);});};ae(H);let me=K.get(A)||[];K.set(A,[...me,E]);let Ve=new Set,je=new Set,tr=Wt=>{if(!Ve.has(Wt)){Ve.add(Wt),je.add(Wt);let sr=K.get(Wt)||[];for(let ga of sr){if(!Ve.has(ga)&&tr(ga))return true;if(je.has(ga))return true}}return je.delete(Wt),false};return tr(A)},[]),Au=useCallback((E,A)=>{if(Lu(E.id,A,jn.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
366
|
+
`})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:L,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:p?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${ae[R]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:$e,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${mt}`,boxShadow:Et},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:st,borderBottom:`1px solid ${Ne}`},children:[jsxs("div",{className:"flex items-center gap-2.5",children:[jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:lt,border:`1px solid ${Mt}`,color:"#00E5CC"},children:jsx(rg,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Oe},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>d($=>!$),className:"p-1.5 rounded-lg transition-colors",style:{color:xt},onMouseEnter:$=>{$.currentTarget.style.background=X,$.currentTarget.style.color=A;},onMouseLeave:$=>{$.currentTarget.style.background="transparent",$.currentTarget.style.color=xt;},children:jsx(Ew,{})}),jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg transition-colors",style:{color:xt},onMouseEnter:$=>{$.currentTarget.style.background=X,$.currentTarget.style.color=A;},onMouseLeave:$=>{$.currentTarget.style.background="transparent",$.currentTarget.style.color=xt;},children:jsx(Sw,{})})]})]}),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:we,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:Pe.slice(0,4).map(($,ee)=>jsx("button",{onClick:()=>fe($),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:B,color:he,border:`1px solid ${q}`},onMouseEnter:Ce=>{Ce.currentTarget.style.borderColor=Ae,Ce.currentTarget.style.color="#00E5CC";},onMouseLeave:Ce=>{Ce.currentTarget.style.borderColor=q,Ce.currentTarget.style.color=he;},children:$.length>30?$.slice(0,30)+"...":$},ee))})]}),m.map($=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${$.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${$.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:$.role==="user"?ye:ie,color:$.role==="user"?"#00E5CC":He,border:$.role==="user"?`1px solid ${tt}`:`1px solid ${ce}`},children:[$.isLoading?jsx(Mw,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:$.content}),$.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:$.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:$.command.success?"#10B981":"#EF4444",border:`1px solid ${$.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[$.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:$.command.type.replace(/_/g," ")})]})]})},$.id)),jsx("div",{ref:J})]}),jsxs("form",{onSubmit:$=>{if(N&&or.length>0){$.preventDefault();return}j($);},className:"p-3 relative",style:{borderTop:`1px solid ${at}`},children:[jsx(AnimatePresence,{children:N&&or.length>0&&jsx(motion.div,{ref:Ie,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:Bt,border:`1px solid ${Da}`,boxShadow:Ht,backdropFilter:"blur(12px)"},children:or.map(($,ee)=>jsxs("button",{type:"button",onClick:()=>Wa($),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:ee===T?kr:"transparent",color:da},onMouseEnter:()=>V(ee),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:et,border:`1px solid ${Je}`,color:"#00E5CC"},children:$.name.split(" ").map(Ce=>Ce[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:$.name}),$.email&&jsx("div",{className:"text-xs truncate",style:{color:pr},children:$.email})]})]},$.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:ft,border:`1px solid ${Ye}`},children:[jsx("input",{ref:O,type:"text",value:v,onChange:$=>Ca($.target.value),onKeyDown:$=>{de($);},placeholder:ke,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:vt,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!v.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:v.trim()?Yt:"transparent",color:v.trim()?"#00E5CC":ca,border:v.trim()?`1px solid ${ba}`:"1px solid transparent"},children:jsx(Dw,{})})]}),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 ng(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),n=useRef(false),s=useCallback((i,u=true)=>{r(p=>{let d=typeof i=="function"?i(p.present):i;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(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],p=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:p,present:u,future:[i.present,...i.future]}});},[]),l=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],p=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:u,future:p}});},[]),c=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:o,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function og({undo:e,redo:t,canUndo:a,canRedo:r,enabled:n=true}){useEffect(()=>{if(!n)return;let s=o=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?o.metaKey:o.ctrlKey;if(c&&o.key==="z"&&!o.shiftKey&&a){o.preventDefault(),e();return}if(r){if(!l&&c&&o.key==="y"){o.preventDefault(),t();return}if(l&&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 Aw={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${De.formatDate(e.startDate)} - ${De.formatDate(e.endDate)}`);let a=De.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=>De.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function sg(e){return {...Aw,...e}}var Ww=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},ug=forwardRef(function({tasks:t,config:a={},onTasksChange:r},n){let{theme:s,timeScale:o="week",rowDensity:l="comfortable",showThemeSelector:c=true,showExportButton:i=true,onExportSuccess:u,projectName:p,availableUsers:d=[],templates:m,enableAutoCriticalPath:f=true,persistExpandedState:v,persistFilter:h,persistColumns:b,clearFiltersKey:y,aiAssistant:x,locale:w="en",customTranslations:k,showCreateTaskButton:M=false,createTaskLabel:I,onCreateTask:C,taskFilter:N,onTaskFilterChange:P,toolbarRightContent:T,toolbarContainer:V,hideWbsLevel:O,showBaseline:J,viewMode:L,onViewModeChange:Ie,projectForecast:G,hideForecastHud:ke,onThemeChange:R,onTaskClick:U,onTaskSelectionChange:Pe,selectedTaskId:Ze,onTaskDblClick:oe,onTaskContextMenu:Fe,onTaskUpdate:Q,onDependentTasksScheduled:Se,onProgressChange:Ue,onTaskEdit:Le,onTaskAddSubtask:Be,onTaskMarkIncomplete:ot,onTaskSetInProgress:se,onDependencyCreate:je,onDependencyDelete:Xe,onBeforeTaskAdd:$e,onAfterTaskAdd:mt,onBeforeTaskUpdate:Et,onAfterTaskUpdate:st,onBeforeTaskDelete:Ne,onAfterTaskDelete:lt,permissions:Mt,onCopySnapshotLink:Oe}=a,A=useContext(Xi)?.theme,[X,we]=useState(A||s||"dark"),[B,q]=useState(o),[he,Ae]=useState(l),[ye,tt]=useState(1),[ie,ce]=useState("all"),[He,at]=useState(L||"execution"),ft=L??He,Ye=useCallback(E=>{at(E),Ie?.(E);},[Ie]),vt=J??ft==="oracle",[Yt,ba]=useState(a.showCriticalPath!==false),[ca,Gt]=useState(a.showDependencies!==false),[Bt,Da]=useState(a.highlightWeekends!==false),Ht=useCallback(E=>{ba(E),a.onShowCriticalPathChange?.(E);},[a.onShowCriticalPathChange]),kr=useCallback(E=>{Gt(E),a.onShowDependenciesChange?.(E);},[a.onShowDependenciesChange]),da=useCallback(E=>{Da(E),a.onHighlightWeekendsChange?.(E);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(B);},[B]),useEffect(()=>{a.onZoomChange?.(ye);},[ye]);let pr=useRef(a.onDateRangeChange);pr.current=a.onDateRangeChange;let et=useCallback(()=>h?typeof h=="string"?h:"gantt-filter-state":null,[h]),[Je,Aa]=useState(()=>{if(!h)return "all";try{let E=typeof h=="string"?h:"gantt-filter-state",F=localStorage.getItem(E);if(F){let H=JSON.parse(F);if(H.taskFilter)return H.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),ja=N??Je,or=P??Aa,[Ca,Wa]=useState(()=>{if(!h)return false;try{let E=typeof h=="string"?h:"gantt-filter-state",F=localStorage.getItem(E);if(F){let H=JSON.parse(F);if(typeof H.hideCompleted=="boolean")return H.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});useEffect(()=>{let E=et();if(E)try{let F={taskFilter:ja,hideCompleted:Ca};localStorage.setItem(E,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving filter state to localStorage:",F);}},[ja,Ca,et]);let de=useRef(y);useEffect(()=>{if(de.current!==y&&y!==void 0){Aa("all"),Wa(false);let E=et();if(E)try{localStorage.removeItem(E);}catch(F){console.warn("[GanttBoard] Error clearing filter state from localStorage:",F);}}de.current=y;},[y,et]);let[ue,gt]=useState(0),[j,fe]=useState(false),[ae,$]=useState(null),[ee,Ce]=useState({isOpen:false,x:0,y:0,task:null}),[D,W]=useState(null),[pe,ve]=useState(null);useEffect(()=>{A&&A!==X&&we(A);},[A]),useEffect(()=>{s&&s!==X&&we(s);},[s]);let rt=useCallback(E=>{we(E),R?.(E);},[R]),{state:ge,setState:K,undo:ct,redo:bt,canUndo:Pt,canRedo:Zt,clearHistory:hr}=ng(t,50),_a=useMemo(()=>{let E=(F,H=0)=>{let _=H;for(let re of F)re.subtasks?.length&&(_=Math.max(_,E(re.subtasks,H+1)));return _};return E(ge)+1},[ge]),en=useCallback(()=>v?typeof v=="string"?v:"gantt-expanded-tasks":null,[v]),ea=useRef(new Map),yo=useRef(false);if(!yo.current&&v){yo.current=true;let E=typeof v=="string"?v:"gantt-expanded-tasks";try{let F=localStorage.getItem(E);if(F){let H=JSON.parse(F);Array.isArray(H)&&(ea.current=new Map(H));}}catch(F){console.warn("[GanttBoard] Error loading expanded state from localStorage:",F);}}let jn=useCallback(()=>{let E=en();if(E)try{let F=Array.from(ea.current.entries());localStorage.setItem(E,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving expanded state to localStorage:",F);}},[en]),Gr=useRef(0),_n=useRef(ge);useEffect(()=>{_n.current=ge;},[ge]);let Kn=useRef(false),bi=useCallback(E=>{ce(E),Gr.current+=1,K(F=>{let H=(re,me=0)=>re.map(Ge=>{let Ve=E==="all"||me<E-1;return Ge.subtasks?.length&&ea.current.set(Ge.id,Ve),{...Ge,isExpanded:Ve,subtasks:Ge.subtasks?H(Ge.subtasks,me+1):void 0}}),_=H(F);return jn(),_});},[K,jn]);useEffect(()=>{if(Gr.current>0){Gr.current-=1;return}let E=H=>{let _=new Map;for(let re of H){let me=re.id;_.get(me)||_.set(me,re);}return Array.from(_.values())},F=H=>H.map(_=>{let re=ea.current.get(_.id),me=re!==void 0?{..._,isExpanded:re}:_;if(me.subtasks?.length){let Ge=E(me.subtasks);return {...me,subtasks:F(Ge)}}return me});if(ea.current.size>0)K(qr(F(t)));else {let H=_=>_.map(re=>re.subtasks?.length?{...re,subtasks:E(H(re.subtasks))}:re);K(qr(H(t)));}},[t,K]);let jo=useRef(t),hi=useRef(true);useEffect(()=>{if(hi.current){hi.current=false,jo.current=ge;return}if(Kn.current){Kn.current=false,jo.current=ge;return}if(!r)return;let E=JSON.stringify(jo.current),F=JSON.stringify(ge);E!==F&&(jo.current=ge,r(ge));},[ge,r]);let Ka=useMemo(()=>td(w,k),[w,k]),xo=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}],[]),wn=a.defaultVisibleColumns,_o=useCallback(E=>wn?E.map(F=>F.id==="name"?F:{...F,visible:wn.includes(F.id)}):E,[wn]),Pr=useMemo(()=>b?typeof b=="string"?b:"gantt-columns-state":null,[b]),[Or,S]=useState(()=>{let E=_o(xo(Ka));if(!b)return E;try{let F=typeof b=="string"?b:"gantt-columns-state",H=localStorage.getItem(F);if(!H)return E;let _=JSON.parse(H),re=new Map(_.map(me=>[me.id,me]));return E.map(me=>{let Ge=re.get(me.id);return Ge?{...me,visible:Ge.visible??me.visible,width:Ge.width??me.width}:me})}catch(F){return console.warn("[GanttBoard] Error loading columns state from localStorage:",F),E}}),Y=useRef(Pr);useEffect(()=>{if(Y.current===Pr)return;Y.current=Pr;let E=_o(xo(Ka));if(!Pr){S(E);return}try{let F=localStorage.getItem(Pr);if(!F){S(E);return}let H=JSON.parse(F),_=new Map(H.map(re=>[re.id,re]));S(E.map(re=>{let me=_.get(re.id);return me?{...re,visible:me.visible??re.visible,width:me.width??re.width}:re}));}catch(F){console.warn("[GanttBoard] Error reloading columns state from localStorage:",F),S(E);}},[Pr,xo,Ka]),useEffect(()=>{if(Pr&&Y.current===Pr)try{let E=Or.map(F=>({id:F.id,visible:F.visible,width:F.width}));localStorage.setItem(Pr,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving columns state to localStorage:",E);}},[Or,Pr]),useEffect(()=>{S(E=>E.map(F=>({...F,label:Ka.columns[F.id==="name"?"taskName":F.id]||F.label})));},[Ka]);let te=useMemo(()=>Or.filter(F=>F.visible).reduce((F,H)=>F+H.width,0),[Or]),xe=useRef(Or.filter(E=>E.visible).map(E=>E.id).join(","));useEffect(()=>{let E=Or.filter(_=>_.visible),F=E.map(_=>_.id).join(","),H=xe.current;if(F!==H){let _=E.some(me=>me.id!=="name"),re=H.includes(",");_?!re&&_&&$(null):$(null),xe.current=F;}},[Or]);let Te=60,_e=.6,le=useMemo(()=>{let F=te+Te,H=typeof window<"u"?window.innerWidth*_e:800,_=Math.max(F,H);return ae!==null?Math.max(200,Math.min(ae,_)):Math.max(200,F)},[ae,te]),Me=useRef(null),Ke=useRef(null),qe=useRef(null),At=useRef(null),ut=useRef(null),We=useMemo(()=>Tm(X),[X]),ha=useMemo(()=>({theme:We,themeName:X}),[We,X]),ya=useMemo(()=>sg(m),[m]),Za=useMemo(()=>{if(!f||!Yt)return ge;let E=De.calculateCriticalPathFull(ge),F=H=>H.map(_=>{let re=E.get(_.id),me=_.subtasks?F(_.subtasks):void 0,Ge=me?.some(ta=>ta.isCriticalPath||ta.subtasks&&ta.subtasks.some(Wt=>Wt.isCriticalPath))||false,Ve=re?re.isCritical:Ge;return {..._,isCriticalPath:Ve,cpmData:re||void 0,subtasks:me}});return F(ge)},[ge,f,Yt]),Ut=useMemo(()=>De.flattenTasks(ge).some(F=>F.dependencies&&F.dependencies.length>0),[ge]),Vt=useMemo(()=>{let E=(F,H="")=>[...F].sort((re,me)=>(re.position??0)-(me.position??0)).map((re,me)=>{let Ge=me+1,Ve=H?`${H}.${Ge}`:`${Ge}.0`,ta=H?`${H}.${Ge}`:`${Ge}`;return {...re,wbsCode:Ve,subtasks:re.subtasks?.length?E(re.subtasks,ta):re.subtasks}});return E(Za)},[Za]),Tt=useMemo(()=>{if(ja==="all"&&!Ca)return Vt;let E=F=>{let H=[];for(let _ of F){let re=_.subtasks?.length?E(_.subtasks):void 0,me=false;if(Ca)me=_.progress<100&&_.status!=="completed";else switch(ja){case "all":me=true;break;case "incomplete":me=_.progress<100;break;case "in_progress":me=_.progress>0&&_.progress<100;break;case "completed":me=_.progress===100;break}(me||re&&re.length>0)&&H.push({..._,subtasks:re});}return H};return E(Vt)},[Vt,ja,Ca]),Ft=Ww(he);og({undo:ct,redo:bt,canUndo:Pt,canRedo:Zt,enabled:true});let ma=useRef(null),sr=(E,F="start")=>{let H=qe.current,_=ut.current;if(!H||!_)return;let re=(E.getTime()-_.startDate.getTime())/(1e3*60*60*24),me=_.timeScale==="day"?60:_.timeScale==="week"?20:8,Ge=re*me*_.zoom,Ve=F==="center"?Ge-H.clientWidth/2:Ge-me*_.zoom*2;H.scrollTo({left:Math.max(0,Ve),behavior:"auto"});};useImperativeHandle(n,()=>({getTask:E=>De.findTaskById(ge,E),addTask:(E,F)=>{K(H=>{if(!F)return [...H,{...E,level:0}];let _=re=>re.map(me=>me.id===F?{...me,subtasks:[...me.subtasks||[],{...E,parentId:F,level:(me.level||0)+1}],isExpanded:true}:me.subtasks?{...me,subtasks:_(me.subtasks)}:me);return _(H)});},updateTask:(E,F)=>{K(H=>{let _=re=>re.map(me=>me.id===E?{...me,...F}:me.subtasks?{...me,subtasks:_(me.subtasks)}:me);return _(H)});},deleteTask:E=>{K(F=>{let H=_=>_.filter(re=>re.id===E?false:(re.subtasks&&(re.subtasks=H(re.subtasks)),true));return H(F)});},deleteTasks:E=>{K(F=>md(F,E));},duplicateTask:E=>{if(a.onTaskDuplicate){let F=De.findTaskById(ge,E);F&&a.onTaskDuplicate(F);}else K(F=>Ys(F,[E]).tasks);},splitTask:(E,F,H=3)=>{K(_=>De.splitTask(_,E,F,H));},calculateEndDate:De.calculateEndDate,calculateDuration:De.calculateDuration,validateDependency:(E,F)=>!De.validateDependencies(ge,E,F),getAllTasks:()=>De.flattenTasks(ge),getTasksByStatus:E=>De.flattenTasks(ge).filter(F=>F.status===E),getTasksByParent:E=>E?De.findTaskById(ge,E)?.subtasks||[]:ge.filter(H=>!H.parentId),getCriticalPath:()=>De.flattenTasks(ge).filter(E=>E.isCriticalPath),indentTask:E=>{K(F=>qr(dd(F,[E])));},outdentTask:E=>{K(F=>qr(ud(F,[E])));},moveTask:(E,F)=>{K(H=>pd(H,[E],F));},createSubtask:async E=>{let{tasks:F,newTask:H}=bd(ge,E);if($e){let _=$e({...H,parentId:E});if((_ instanceof Promise?await _:_)===false)return}K(qr(F)),mt&&mt({...H,parentId:E});},scrollToTask:E=>{let H=De.flattenTasks(ge).findIndex(_=>_.id===E);if(H!==-1&&Me.current){let _=H*Ft;Me.current.scrollTo({top:_,behavior:"smooth"}),qe.current&&qe.current.scrollTo({top:_,behavior:"smooth"});}},highlightTask:(E,F=2e3)=>{},expandTask:E=>{K(F=>{let H=_=>_.map(re=>re.id===E?{...re,isExpanded:true}:re.subtasks?{...re,subtasks:H(re.subtasks)}:re);return H(F)});},collapseTask:E=>{K(F=>{let H=_=>_.map(re=>re.id===E?{...re,isExpanded:false}:re.subtasks?{...re,subtasks:H(re.subtasks)}:re);return H(F)});},expandAll:()=>{K(E=>{let F=H=>H.map(_=>({..._,isExpanded:true,subtasks:_.subtasks?F(_.subtasks):void 0}));return F(E)});},collapseAll:()=>{K(E=>{let F=H=>H.map(_=>({..._,isExpanded:false,subtasks:_.subtasks?F(_.subtasks):void 0}));return F(E)});},collapseToLevel:E=>{bi(E);},undo:ct,redo:bt,canUndo:()=>Pt,canRedo:()=>Zt,clearHistory:hr,exportToPNG:async()=>{if(!At.current||!Me.current||!qe.current)throw new Error("Gantt container not found");let E=At.current,F=Me.current,H=Ke.current||F.querySelector(".gantt-grid-scroll"),_=qe.current,re=H?.scrollTop||0,me=_.scrollTop,Ge=E.style.overflow,Ve=E.style.height,ta=F.style.overflow;try{let Wt=H?.querySelector(".gantt-taskgrid-content"),sa=_.querySelector("svg"),gr=Wt?.scrollHeight||H?.scrollHeight||600,Hr=sa?.getBoundingClientRect().height||_.scrollHeight,wo=(E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(gr,Hr)+20;H&&(H.scrollTop=0),_.scrollTop=0,E.style.overflow="visible",E.style.height=`${wo}px`,F.style.overflow="visible",await new Promise(Yo=>setTimeout(Yo,100));let Cn=await toPng(E,{backgroundColor:We.bgPrimary,pixelRatio:2,filter:Yo=>{if(!(Yo instanceof Element))return !0;let yi=window.getComputedStyle(Yo),Ms=parseInt(yi.zIndex,10);return (isNaN(Ms)||Ms<50)&&yi.position!=="fixed"}});return await(await fetch(Cn)).blob()}finally{E.style.overflow=Ge,E.style.height=Ve,F.style.overflow=ta,H&&(H.scrollTop=re),_.scrollTop=me;}},exportToPDF:async E=>{await De.exportToPDF(ge,E);},exportToExcel:async E=>{await De.exportToExcel(ge,E,Jl.current);},exportToJSON:()=>De.exportToJSON(ge),exportToCSV:()=>De.exportToCSV(ge),importFromJSON:E=>{let F=De.importFromJSON(E);K(F);},getTasks:()=>ge,refresh:()=>{K(E=>[...E]);},clearAll:()=>{K([]);},scrollToDate:(E,F="start")=>sr(E,F),fitToDates:(E,F)=>{let H=Math.max(1,(F.getTime()-E.getTime())/864e5),_=H<=21?"day":H<=122?"week":"month";ma.current=E,q(_),_===ut.current?.timeScale&&requestAnimationFrame(()=>{let re=ma.current;ma.current=null,re&&sr(re);});},scrollToToday:()=>{let E=qe.current,F=ut.current;if(!E||!F)return;let _=(new Date().getTime()-F.startDate.getTime())/(1e3*60*60*24),re=F.timeScale==="day"?60:F.timeScale==="week"?20:8,me=_*re*F.zoom,Ge=E.clientWidth,Ve=Math.max(0,me-Ge/2);E.scrollTo({left:Ve,behavior:"smooth"});}}),[ge,ct,bt,Pt,Zt,hr,We,Ft]);let Cr=useCallback(E=>{S(F=>F.map(H=>H.id===E?{...H,visible:!H.visible}:H));},[]),mr=useCallback((E,F)=>{S(H=>H.map(_=>{if(_.id!==E)return _;let re=_.minWidth??100,me=_.maxWidth??800,Ge=Math.max(re,Math.min(me,F));return {..._,width:Ge}}));},[]),qa=useCallback(E=>{K(F=>{let H=fd(F,E),_=re=>{for(let me of re){if(me.id===E){ea.current.set(E,me.isExpanded??true);return}me.subtasks?.length&&_(me.subtasks);}};return _(H),jn(),H}),a.onTaskToggleExpand?.(E);},[a,jn]),Fr=useCallback((E,F)=>{if(Et&&Et(E,F)===false)return;let _=De.findTaskById(ge,E)?.progress,re=Ge=>Ge.map(Ve=>Ve.id===E?{...Ve,...F}:Ve.subtasks?{...Ve,subtasks:re(Ve.subtasks)}:Ve);K(Ge=>re(Ge));let me=De.findTaskById(re(ge),E);me&&(Q?.(me),st?.(me),F.progress!==void 0&&_!==void 0&&F.progress!==_&&Ue?.(E,_,F.progress));},[ge,Q,Et,st,Ue]),Ss=useCallback((E,F,H)=>{if(E.length===0)return;let _=new Set(E),re=me=>me.map(Ge=>{let Ve=_.has(Ge.id)?{...Ge,[F]:H}:Ge;return Ve.subtasks?{...Ve,subtasks:re(Ve.subtasks)}:Ve});K(me=>{let Ge=re(me);return a.onBulkFill?.(E,F,H,Ge),Ge});},[a]),vo=useCallback(E=>{E.length!==0&&(Gr.current+=1,Kn.current=true,K(F=>qr(dd(F,E))),a.onTaskIndent?.(E[0]));},[a]),fb=useCallback(E=>{E.length!==0&&(Gr.current+=1,Kn.current=true,K(F=>qr(ud(F,E))),a.onTaskOutdent?.(E[0]));},[a]),bb=useCallback((E,F,H)=>{Gr.current+=1,Kn.current=true,K(_=>qr(jm(_,E,F,H))),a.onTaskReparent?.(E,F,H);},[a]),hb=useCallback((E,F)=>{E.length!==0&&(Gr.current+=1,Kn.current=true,K(H=>pd(H,E,F)),a.onTaskMove?.(E[0],F));},[a]),ql=useCallback(async E=>{let F=[];for(let H of E)Ne&&await Promise.resolve(Ne(H))===false||F.push(H);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(K(H=>qr(md(H,F))),F.forEach(H=>a.onTaskDelete?.(H))),lt&&F.forEach(H=>lt(H)));},[a,Ne,lt]),yb=useCallback(E=>{a.onTaskDuplicate?E.forEach(F=>{let H=De.findTaskById(ge,F);H&&a.onTaskDuplicate(H);}):K(F=>Ys(F,E).tasks);},[a,ge]),xb=useCallback((E,F)=>{K(H=>{let{tasks:_,newTask:re}=Vm(H,E,F);return $e&&$e(re)===false?H:(a.onTaskCreate?.(re.parentId,re.position||0),mt?.(re),_)});},[a,$e,mt]),vb=useCallback((E,F)=>{K(H=>gd(H,E,F)),a.onTaskRename?.(E,F);},[a]),Yl=useCallback(E=>{let{onTaskAddSubtask:F}=a;if(F){let H=ds(ge,E);if(H){F(H);return}}K(H=>{let{tasks:_}=bd(H,E);return a.onTaskCreate?.(E,0),_});},[a,ge]),wb=useCallback((E,F)=>{let H=Math.max(0,Math.min(100,Math.round(F))),_={progress:H};H===100?_.status="completed":H>0?_.status="in-progress":_.status="todo",Fr(E.id,_);},[Fr]),kb=useCallback((E,F,H)=>{let _=!E.startDate&&!E.endDate,re=E.startDate?Math.round((F.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,me=Wt=>Wt.map(sa=>sa.id===E.id?{...sa,startDate:F,endDate:H,...E.segments&&{segments:E.segments}}:sa.subtasks?{...sa,subtasks:me(sa.subtasks)}:sa),Ge=me(ge),Ve=Ge;Ge=De.autoScheduleDependents(Ge,E.id,re),Ge=qr(Ge),K(Ge);let ta={...E,startDate:F,endDate:H};if(_&&a?.onTaskDateChange?a.onTaskDateChange(E,F,H):Q?.(ta),Se&&re!==0){let Wt=De.flattenTasks(Ve),sa=De.flattenTasks(Ge),gr=[];for(let Hr of sa){if(Hr.id===E.id)continue;let qn=Wt.find(Cn=>Cn.id===Hr.id);if(!qn)continue;let qo=Hr.startDate?.getTime()!==qn.startDate?.getTime(),wo=Hr.endDate?.getTime()!==qn.endDate?.getTime();(qo||wo)&&gr.push(Hr);}gr.length>0&&Se(gr);}},[ge,Q,Se,a]),Cb=useCallback((E,F)=>{Fe?.(E,F),Ce({isOpen:true,x:F.clientX,y:F.clientY,task:E});},[Fe]),Tb=useCallback((E,F)=>{let H=De.splitTask(ge,E.id,F);K(H),Ce({isOpen:false,x:0,y:0,task:null});},[ge]),Fu=useCallback(E=>{let F=De.findTaskById(ge,E.id)||E;oe?.(F),Le||W(F);},[ge,oe,Le]),Lu=useCallback((E,F,H)=>{let _=new Map,re=Wt=>{Wt.forEach(sa=>{sa.dependencies&&_.set(sa.id,sa.dependencies),sa.subtasks&&re(sa.subtasks);});};re(H);let me=_.get(F)||[];_.set(F,[...me,E]);let Ge=new Set,Ve=new Set,ta=Wt=>{if(!Ge.has(Wt)){Ge.add(Wt),Ve.add(Wt);let sa=_.get(Wt)||[];for(let gr of sa){if(!Ge.has(gr)&&ta(gr))return true;if(Ve.has(gr))return true}}return Ve.delete(Wt),false};return ta(F)},[]),Au=useCallback((E,F)=>{if(Lu(E.id,F,_n.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 H=K=>K.map(ae=>{if(ae.id===A){let me=ae.dependencies||[];if(!me.includes(E.id))return {...ae,dependencies:[...me,E.id]}}return ae.subtasks?{...ae,subtasks:H(ae.subtasks)}:ae});Wa.current+=1,q(K=>H(K)),_e?.(E.id,A);},[_e,Lu]),Iu=useCallback((E,A)=>{let H=K=>K.map(ae=>{if(ae.id===E&&ae.dependencies){let me=ae.dependencies.filter(Ve=>Ve!==A);return {...ae,dependencies:me}}return ae.subtasks?{...ae,subtasks:H(ae.subtasks)}:ae});Wa.current+=1,q(K=>H(K)),qe?.(E,A);},[qe]),{startDate:wn,endDate:Xl}=useMemo(()=>{let E=fe.filter(me=>me.startDate&&me.endDate);if(E.length===0){let me=new Date,Ve=new Date(me);Ve.setDate(Ve.getDate()-30);let je=new Date(me);return je.setDate(je.getDate()+60),{startDate:Ve,endDate:je}}let A=E.flatMap(me=>[me.startDate,me.endDate]).filter(me=>me!==void 0),H=new Date(Math.min(...A.map(me=>me.getTime()))),K=new Date(Math.max(...A.map(me=>me.getTime()))),ae=_==="day"?7:_==="week"?14:30;return H.setDate(H.getDate()-ae),K.setDate(K.getDate()+ae),{startDate:H,endDate:K}},[fe,_]);useEffect(()=>{pa.current?.(wn,Xl);},[wn,Xl]);let Cb=useCallback(async()=>{if(!Ke.current||!We.current||!Te.current)return;await new Promise(ko=>setTimeout(ko,200));let E=Ke.current,A=We.current,H=oe.current||A.querySelector(".gantt-grid-scroll"),K=Te.current,ae=H?.scrollTop||0,me=H?.scrollLeft||0,Ve=K.scrollTop,je=K.scrollLeft,tr=E.style.overflow,Wt=E.style.height,sr=H?.style.overflow||"",ga=K.style.overflow,$a=A.style.overflow,qn=E.style.width,qo=K.style.width;try{let ko=H?.querySelector(".gantt-taskgrid-content"),kn=K.querySelector("svg"),ec=kn?.getAttribute("height")?parseInt(kn.getAttribute("height"),10):kn?.getBoundingClientRect().height||0,Yo=ko?.scrollHeight||H?.scrollHeight||600,yi=Math.max(ec,K.scrollHeight),Ms=kn?.getAttribute("width")?parseInt(kn.getAttribute("width"),10):kn?.getBoundingClientRect().width||K.scrollWidth,Fb=E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,tc=Math.max(Yo,yi,ec),Ou=Fb+tc+50,Hu=(H?.offsetWidth||A.offsetWidth||300)+Ms+10;H&&(H.scrollTop=0,H.scrollLeft=0),K.scrollTop=0,K.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Ou}px`,E.style.width=`${Hu}px`,A.style.overflow="visible",H&&(H.style.overflow="visible",H.style.height=`${tc+50}px`),K.style.overflow="visible",K.style.height=`${tc+50}px`,K.style.width=`${Ms+10}px`,await new Promise(xi=>setTimeout(xi,150));let Lb=await toPng(E,{backgroundColor:nt.bgPrimary,pixelRatio:2,width:Hu,height:Ou,skipFonts:!1,filter:xi=>{if(!(xi instanceof Element))return !0;let Uu=window.getComputedStyle(xi),Wu=parseInt(Uu.zIndex,10);return !(!isNaN(Wu)&&Wu>=50||Uu.position==="fixed")}}),rc=document.createElement("a");rc.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,rc.href=Lb,rc.click();}finally{E.style.overflow=tr,E.style.height=Wt,E.style.width=qn,A.style.overflow=$a,H&&(H.style.overflow=sr,H.style.height="",H.scrollTop=ae,H.scrollLeft=me),K.style.overflow=ga,K.style.height="",K.style.width=qo,K.scrollTop=Ve,K.scrollLeft=je;}u?.("png");},[nt,u]),Tb=useCallback(async()=>{await Ne.exportToPDF(fe),u?.("pdf");},[fe,u]),Jl=useRef({rateMap:r.rateMap,defaultRate:r.defaultRate,projectName:p});Jl.current={rateMap:r.rateMap,defaultRate:r.defaultRate,projectName:p};let Nb=useCallback(async()=>{if(r.onExportExcel){await r.onExportExcel(),u?.("excel");return}let E=new Date,A=ae=>String(ae).padStart(2,"0"),H=`${E.getFullYear()}-${A(E.getMonth()+1)}-${A(E.getDate())}_${A(E.getHours())}${A(E.getMinutes())}`,K=p?p.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Ne.exportToExcel(fe,`${K}_${H}.xlsx`,Jl.current),u?.("excel");},[fe,p,u,r.onExportExcel]),Db=useCallback(()=>{let E=Ne.exportToCSV(fe),A=new Blob([E],{type:"text/csv;charset=utf-8;"}),H=document.createElement("a");H.href=URL.createObjectURL(A),H.download="gantt-chart.csv",H.click(),URL.revokeObjectURL(H.href),u?.("csv");},[fe,u]),Sb=useCallback(()=>{let E=Ne.exportToJSON(fe),A=new Blob([E],{type:"application/json;charset=utf-8;"}),H=document.createElement("a");H.href=URL.createObjectURL(A),H.download="gantt-chart.json",H.click(),URL.revokeObjectURL(H.href),u?.("json");},[fe,u]),Eb=useCallback(()=>{Ne.exportToMSProject(fe,"Gantt Project","project.xml"),u?.("msproject");},[fe,u]),Mb=E=>{E.preventDefault(),be(true);},Ko=useRef(false),[Ql,Ru]=useState(false),Es=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let E=Te.current,A=We.current?.querySelector(".gantt-grid-scroll");if(!E||!A)return;let H=()=>{if(Ko.current)return;Ko.current=true;let je=E.scrollTop;pt(je),A.scrollTop=je,requestAnimationFrame(()=>{Ko.current=false;});},K=()=>{if(Ko.current)return;Ko.current=true;let je=A.scrollTop;pt(je),E.scrollTop=je,requestAnimationFrame(()=>{Ko.current=false;});},ae=je=>{if(j&&A){let Wt=A.parentElement?.getBoundingClientRect()?.left||0,sr=je.clientX-Wt,ga=200,$a=S+re,qn=window.innerWidth*xe,qo=Math.max($a,qn);sr>=ga&&sr<=qo&&$(sr);}if(Ql&&E){let tr=je.clientX-Es.current.x,Wt=je.clientY-Es.current.y;E.scrollLeft=Es.current.scrollLeft-tr,E.scrollTop=Es.current.scrollTop-Wt;}},me=()=>{be(false),Ru(false);},Ve=je=>{if(je.button!==0)return;let tr=je.target;tr.closest("[data-task-bar]")||tr.closest("[data-dependency-line]")||tr.closest("button")||tr.closest('[role="button"]')||tr.tagName==="rect"&&tr.getAttribute("data-clickable")==="true"||(Ru(true),Es.current={x:je.clientX,y:je.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},je.preventDefault());};return E.addEventListener("scroll",H),A.addEventListener("scroll",K),E.addEventListener("mousedown",Ve),document.addEventListener("mousemove",ae),document.addEventListener("mouseup",me),()=>{E.removeEventListener("scroll",H),A.removeEventListener("scroll",K),E.removeEventListener("mousedown",Ve),document.removeEventListener("mousemove",ae),document.removeEventListener("mouseup",me);}},[j,Ql,S]),at.current={startDate:wn,timeScale:_,zoom:ye};let Zl=r.onTodayVisibilityChange,Bu=useRef(null);useEffect(()=>{if(!Zl)return;let E=Te.current;if(!E)return;let A=_==="day"?60:_==="week"?20:8,H=()=>{let me=(new Date().getTime()-wn.getTime())/(1e3*60*60*24)*A*ye,Ve=E.scrollLeft,je=Ve+E.clientWidth,tr=me>=Ve&&me<=je;Bu.current!==tr&&(Bu.current=tr,Zl(tr));};return H(),E.addEventListener("scroll",H,{passive:true}),window.addEventListener("resize",H),()=>{E.removeEventListener("scroll",H),window.removeEventListener("resize",H);}},[Zl,wn,_,ye]);let $u=useRef(false),Pb=useRef(null);return useLayoutEffect(()=>{if($u.current||fe.length===0||!Te.current)return;$u.current=true,Pb.current=wn;let E=Te.current,A=new Date,H=_==="day"?60:_==="week"?20:8,K=(A.getTime()-wn.getTime())/(1e3*60*60*24),ae=E.clientWidth,Ve=K*H*ye-ae/2;K>=0&&ae>0&&(E.scrollLeft=Math.max(0,Ve));},[fe.length,wn,_,ye]),useLayoutEffect(()=>{let E=yt.current;!E||at.current?.timeScale!==_||(yt.current=null,Ft(E));},[_,wn,ye]),jsx(ls.Provider,{value:qr,children:jsx(ic.Provider,{value:mt,children:jsxs("div",{ref:Ke,className:"flex flex-col h-full w-full",style:{backgroundColor:nt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...nt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${nt.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[(()=>{let E=jsx(Qi,{enCabecera:!!V,theme:nt,timeScale:_,onTimeScaleChange:ue,zoom:ye,onZoomChange:ft,currentTheme:Q,onThemeChange:rt,rowDensity:ve,onRowDensityChange:Oe,showThemeSelector:c,showCreateTaskButton:M&&Mt?.canCreateTask!==false&&!Mt?.canCreateSubtaskOnly,createTaskLabel:I,onCreateTask:C,taskFilter:_r,onTaskFilterChange:sa,hideCompleted:wr,onHideCompletedChange:Wr,toolbarRightContent:T,wbsLevel:ie,onWbsLevelChange:O?void 0:bi,maxWbsDepth:Kr,viewMode:kt,onViewModeChange:Fe?Je:void 0,projectForecast:U,hideForecastHud:De,onExportPNG:i?Cb:void 0,onExportPDF:i?Tb:void 0,onExportExcel:i?Nb:void 0,onExportCSV:i?Db:void 0,onExportJSON:i?Sb:void 0,onExportMSProject:i?Eb:void 0,showCriticalPath:Yt,onShowCriticalPathChange:jt,showDependencies:It,onShowDependenciesChange:or,highlightWeekends:Ht,onHighlightWeekendsChange:ha,showBaseline:At,onShowBaselineChange:A=>{A&&kt!=="oracle"&&Je("oracle"),!A&&kt==="oracle"&&Je("execution");},onCopySnapshotLink:Be,hasDependencies:kr});return V?createPortal(E,V):jsx("div",{style:{position:"relative",zIndex:100},children:E})})(),jsxs("div",{ref:We,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:oe,className:"gantt-grid-scroll flex-shrink-0",style:{width:Ce,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(tl,{tasks:Ut,allTasks:zr,theme:nt,rowHeight:Gt,availableUsers:d,templates:gt,showCriticalPath:Yt,onTaskClick:z,onTaskSelectionChange:Me,selectedTaskId:Ue,onTaskDblClick:Fu,onTaskContextMenu:Le,onTaskToggle:Ta,scrollTop:de,columns:za,onToggleColumn:Lr,onColumnResize:xa,onTaskUpdate:Cr,onBulkFill:Yr,onTaskIndent:vo,onTaskOutdent:Ss,onTaskMove:fb,onMultiTaskDelete:ql,onTaskDuplicate:bb,onTaskCreate:hb,onTaskRename:yb,onCreateSubtask:Yl,onOpenTaskModal:z?E=>z(E):void 0,onDeleteRequest:(E,A)=>we({taskIds:E,taskName:A}),onTaskReparent:wo,scrollContainerRef:oe})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:nt.border,zIndex:15},onMouseDown:Mb}),jsx("div",{ref:Te,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Ql?"grabbing":"grab",...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(ll,{tasks:Ut,theme:nt,rowHeight:Gt,timeScale:_,startDate:wn,endDate:Xl,zoom:ye,locale:w,templates:gt,dependencyLineStyle:r?.dependencyLineStyle,showTaskBarLabels:r?.showTaskBarLabels!==false,onTaskClick:z,onTaskDblClick:Fu,onTaskContextMenu:wb,onTaskDateChange:vb,onTaskProgressDrag:xb,onDependencyCreate:Au,onDependencyDelete:Iu,showBaseline:At,showCriticalPath:Yt,showDependencies:It,highlightWeekends:Ht,canEditTask:Mt?.canEditTask,workingDaysConfig:r?.workingDaysConfig})})]}),ee.task&&jsx(cs,{isOpen:ee.isOpen,x:ee.x,y:ee.y,theme:nt,onClose:()=>ke({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=ee.task;if(!E)return [];let A=Ne.findTaskById(fe,E.id)||E,H=A.subtasks&&A.subtasks.length>0,K=Mt?.canCreateTask!==false,ae=Mt?.canDeleteTask!==false;if(H){let Wt=[],sr=Mt?.canDuplicateTask!==false;return K&&Wt.push({id:"addSubtask",label:qr.contextMenu?.addSubtask||"Add Subtask",icon:ar.Add,onClick:()=>{He?He(A):Yl(A.id);}}),sr&&Wt.push({id:"duplicate",label:qr.contextMenu?.duplicateTask||"Duplicate Task",icon:ar.Duplicate,onClick:()=>{r.onTaskDuplicate?r.onTaskDuplicate(A):q(ga=>Ys(ga,[A.id]).tasks),ke({isOpen:false,x:0,y:0,task:null});}}),ae&&(Wt.length>0&&Wt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Wt.push({id:"delete",label:qr.contextMenu?.deleteTask||"Delete Task",icon:ar.Delete,onClick:()=>{we({taskIds:[A.id],taskName:A.name});}})),Wt}let me=Mt?.canUpdateTask!==false,Ve=Mt?.canDuplicateTask!==false,je=[];return me&&je.push({id:"edit",label:qr.contextMenu?.editTask||"Edit Task",icon:ar.Pencil,onClick:()=>{$e?$e(A):W(A);}}),K&&je.push({id:"addSubtask",label:qr.contextMenu?.addSubtask||"Add Subtask",icon:ar.Add,onClick:()=>{He?He(A):Yl(A.id);}}),je.length>0&&me&&je.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),me&&(je.push({id:"markIncomplete",label:qr.contextMenu?.markIncomplete||"Mark Incomplete",icon:ar.MarkIncomplete,onClick:()=>{et?et(A):Cr(A.id,{status:"todo",progress:0});},disabled:A.status==="todo"}),je.push({id:"setInProgress",label:qr.contextMenu?.setInProgress||"Set In Progress",icon:ar.SetInProgress,onClick:()=>{se?se(A):Cr(A.id,{status:"in-progress"});},disabled:A.status==="in-progress"}),je.push({id:"markComplete",label:qr.contextMenu?.markComplete||"Mark Complete",icon:ar.MarkComplete,onClick:()=>{Cr(A.id,{status:"completed",progress:100});},disabled:A.status==="completed"})),(Ve||me&&A.startDate&&A.endDate)&&je.length>0&&je.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Ve&&je.push({id:"duplicate",label:qr.contextMenu?.duplicateTask||"Duplicate Task",icon:ar.Duplicate,onClick:()=>{r.onTaskDuplicate?r.onTaskDuplicate(A):q(Wt=>Ys(Wt,[A.id]).tasks),ke({isOpen:false,x:0,y:0,task:null});}}),me&&A.startDate&&A.endDate&&je.push({id:"split",label:qr.contextMenu?.splitTask||"Split Task",icon:ar.Split,onClick:()=>{let Wt=A.startDate.getTime(),sr=A.endDate.getTime(),ga=Wt+(sr-Wt)/2,$a=new Date(ga);kb(A,$a);}}),ae&&(je.length>0&&je.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),je.push({id:"delete",label:qr.contextMenu?.deleteTask||"Delete Task",icon:ar.Delete,onClick:()=>{we({taskIds:[A.id],taskName:A.name});}})),je})()}),jsx(Mo,{task:D,isOpen:!!D,onClose:()=>W(null),onTaskUpdate:E=>{D&&(Cr(D.id,E),W(null));},theme:Q==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsx(AnimatePresence,{children:pe&&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:()=>we(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:nt.bgSecondary,border:`1px solid ${nt.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${nt.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:nt.textPrimary,fontFamily:"Inter, sans-serif"},children:[qr.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:nt.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:nt.textSecondary,fontFamily:"Inter, sans-serif"},children:pe.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:nt.textPrimary},children:[pe.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:nt.textPrimary},children:['"',pe.taskName,'"']}),"."]})})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:nt.bgPrimary,borderTop:`1px solid ${nt.border}`},children:[jsx("button",{onClick:()=>we(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:nt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=nt.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{ql(pe.taskIds),we(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(ul,{tasks:fe,theme:nt,config:x,onTasksUpdate:q,onTaskUpdate:Cr,onTaskCreate:E=>{q(A=>[...A,E]);},onTaskDelete:E=>{ql([E]);},onDependencyCreate:(E,A)=>{let H=Ne.findTaskById(fe,E);H&&Au(H,A);},onDependencyDelete:Iu})]})})})});function Xw(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function Jw(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),r=t.match(/(\d+)h\s*(\d+)m/);if(r&&r[1]&&r[2]){let l=parseInt(r[1],10),c=parseInt(r[2],10);return l*60+c}let a=t.match(/(\d+)h/);if(a&&a[1])return parseInt(a[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 xd=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],vd=[{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 gg({isOpen:e,onClose:t,task:r,availableTasks:a=[],availableUsers:n=[],onSubmit:s,isLoading:o=false,mode:l=r?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:p,attachments:d=[],onUploadAttachments:m,onDeleteAttachment:f,defaultStatus:v}){let h=[...xd,...i.filter(L=>!xd.some(Q=>Q.id===L.id))],b=ct[c]||ct.dark,[y,x]=useState(false),[w,k]=useState(false),[M,I]=useState(false),[C,N]=useState(false),[P,T]=useState({top:0,left:0}),[V,O]=useState(null),[X$1,F]=useState(new Date),[Fe,U]=useState({top:0,left:0}),[De,B]=useState(false),[z,Me]=useState([]),[Ue,ce]=useState(false),[Le,J]=useState(""),Pe=useRef(null),Ee=useRef(null),$e=useRef(null),He=useRef(null),et=useRef(null),[se,_e]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[qe,Re]=useState({});useEffect(()=>{r?(_e({name:r.name,description:r.description||"",startDate:r.startDate,endDate:r.endDate,progress:r.progress,status:r.status||"todo",priority:r.priority||"medium",isMilestone:r.isMilestone||false,color:r.color||"#00E5CC",assignees:r.assignees||[],dependencies:r.dependencies||[],tags:r.tags||[],parentId:r.parentId||null,location:r.location||"",equipment:r.equipment||""}),(r.dependencies&&r.dependencies.length>0||r.isMilestone)&&B(true)):(_e({name:"",description:"",progress:0,status:v||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),B(false),Me([]));},[r,e,v]),useEffect(()=>{let L=Q=>{Pe.current&&!Pe.current.contains(Q.target)&&x(false),Ee.current&&!Ee.current.contains(Q.target)&&k(false),$e.current&&!$e.current.contains(Q.target)&&I(false),He.current&&!He.current.contains(Q.target)&&N(false);};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[]);let ut=()=>{let L={};return se.name.trim()||(L.name="El nombre es requerido"),se.startDate&&se.endDate&&se.startDate>se.endDate&&(L.endDate="La fecha de fin debe ser posterior a la de inicio"),Re(L),Object.keys(L).length===0},Et=async L=>{if(L.preventDefault(),!!ut())try{let Q=l==="create"&&z.length>0?{...se,pendingFiles:z}:se;await s(Q),Me([]),t();}catch(Q){console.error("Error submitting task:",Q);}},Ge=(L,Q)=>{_e(R=>{let _={...R,[L]:Q};if(L==="status"){let ue=Q;ue==="todo"?_.progress=0:ue==="in-progress"?(R.progress===0||R.progress===100)&&(_.progress=50):ue==="completed"||ue==="closed"?_.progress=100:(ue==="in-review"||ue==="review")&&(_.progress=75);}if(L==="progress"){let ue=typeof Q=="number"?Q:parseInt(Q,10);ue===100&&R.status!=="completed"?_.status="completed":ue>0&&ue<100&&R.status==="todo"?_.status="in-progress":ue===0&&R.status!=="todo"&&(_.status="todo");}return _}),qe[L]&&Re(R=>{let _={...R};return delete _[L],_});},Ie=h.find(L=>L.id===se.status)??xd[0],dt=vd.find(L=>L.id===se.priority)??vd[1],Mt=Eo.find(L=>L.value===se.color)??Eo[0],Be=c==="dark",vt={backgroundColor:Be?"#1d1f27":b.bgSecondary,border:`1px solid ${Be?"rgba(65,71,84,0.1)":b.borderLight}`,color:b.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:Be?"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:Be?"#0a0a0a":b.bgPrimary,border:`1px solid ${Be?"rgba(65,71,84,0.1)":b.border}`,boxShadow:Be?"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:Et,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:se.name,onChange:L=>Ge("name",L.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:b.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:o,autoFocus:true}),qe.name&&jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),qe.name]}),jsx("textarea",{value:se.description||"",onChange:L=>Ge("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:b.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":b.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:o})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:Pe,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:{...vt,borderColor:Ie.color,backgroundColor:`${Ie.color}15`},disabled:o,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:Ie.color}}),jsx("span",{style:{color:Ie.color},children:Ie.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:Ie.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:Be?"#0a0a0a":b.bgPrimary,backdropFilter:Be?"blur(16px)":void 0,border:`1px solid ${Be?"#262626":b.border}`,boxShadow:Be?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(L=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:Q=>Q.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:Q=>Q.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ge("status",L.id),x(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:L.color}}),L.title,se.status===L.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},L.id))})})]}),jsxs("div",{ref:Ee,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&k(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:vt,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:b.textTertiary}})]}),jsx(AnimatePresence,{children:w&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:Be?"#0a0a0a":b.bgPrimary,backdropFilter:Be?"blur(16px)":void 0,border:`1px solid ${Be?"#262626":b.border}`,boxShadow:Be?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:vd.map(L=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:Q=>Q.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:Q=>Q.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ge("priority",L.id),k(false);},children:[jsx("span",{children:L.icon}),L.label,se.priority===L.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},L.id))})})]}),n.length>0&&jsxs("div",{ref:$e,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&I(!M),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:vt,disabled:o,children:[se.assignees&&se.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:se.assignees.slice(0,3).map((L,Q)=>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||b.accent,borderColor:b.bgSecondary},children:L.initials},Q))}),se.assignees.length>3&&jsxs("span",{style:{color:b.textTertiary},children:["+",se.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:b.textTertiary}}),jsx("span",{style:{color:b.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:M&&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:Be?"#0a0a0a":b.bgPrimary,backdropFilter:Be?"blur(16px)":void 0,border:`1px solid ${Be?"#262626":b.border}`,boxShadow:Be?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(L=>{let Q=se.assignees?.some(R=>R.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:b.textPrimary},onMouseEnter:R=>R.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:R=>R.currentTarget.style.backgroundColor="transparent",onClick:()=>{let R=Q?(se.assignees||[]).filter(_=>_.name!==L.name):[...se.assignees||[],{name:L.name,avatar:L.avatar,initials:L.name.split(" ").map(_=>_[0]).join("").toUpperCase().slice(0,2),color:b.accent}];Ge("assignees",R);},children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:b.accent},children: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:Q&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:b.accent}})})]},L.id)})})})]}),jsxs("div",{ref:He,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!o)if(C)N(false);else {if(He.current){let L=He.current.getBoundingClientRect(),Q=window.innerHeight,R=120,ue=Q-L.bottom<R?L.top-R-8:L.bottom+8;T({top:ue,left:L.left});}N(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:vt,disabled:o,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:se.color}}),jsx("span",{children:Mt.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:C&&jsxs(ir,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>N(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${P.top}px`,left:`${P.left}px`,zIndex:99999,backgroundColor:Be?"#0a0a0a":b.bgPrimary,backdropFilter:Be?"blur(16px)":void 0,border:`1px solid ${Be?"#262626":b.border}`,boxShadow:Be?"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:Eo.slice(0,18).map(L=>{let Q=se.color===L.value;return jsx("button",{type:"button",onClick:R=>{R.preventDefault(),R.stopPropagation(),Ge("color",L.value),N(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:Q?`2px solid ${L.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},L.value)})})})})]})})]}),u.length>0||p?jsx(Zo,{selectedTags:se.tags||[],availableTags:u,onChange:L=>Ge("tags",L),onCreateTag:p,theme:b,disabled:o}):null]}),jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxs("div",{className:"space-y-3",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:Be?"#191b22":b.bgSecondary,borderRadius:8,border:`1px solid ${Be?"rgba(65,71,84,0.05)":b.borderLight}`,padding:"10px 16px"},children:[jsx(Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxs("div",{ref:et,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!o&&!se.isMilestone)if(V==="start")O(null);else {if(et.current){let L=et.current.getBoundingClientRect();U({top:L.bottom+8,left:Math.max(16,L.left-40)});}O("start"),F(se.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...vt,opacity:se.isMilestone?.5:1,cursor:se.isMilestone?"not-allowed":"pointer"},disabled:o||se.isMilestone,children:se.startDate?se.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:b.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!o&&!se.isMilestone)if(V==="end")O(null);else {if(et.current){let L=et.current.getBoundingClientRect();U({top:L.bottom+8,left:Math.max(16,L.left-40)});}O("end"),F(se.endDate||se.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...vt,opacity:se.isMilestone?.5:1,cursor:se.isMilestone?"not-allowed":"pointer"},disabled:o||se.isMilestone,children:se.endDate?se.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:V&&jsxs(ir,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>O(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:`${Fe.top}px`,left:`${Fe.left}px`,zIndex:99999,backgroundColor:Be?"#0a0a0a":b.bgPrimary,border:`1px solid ${Be?"#262626":b.border}`,boxShadow:Be?"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 ${Be?"#262626":b.border}`},children:[(()=>{let L=new Date,Q=new Date(L);Q.setDate(L.getDate()+1);let R=new Date(L);R.setDate(L.getDate()+7);let _=new Date(L);return _.setDate(L.getDate()+14),[{label:"Hoy",date:L},{label:"Ma\xF1ana",date:Q},{label:"Pr\xF3xima semana",date:R},{label:"2 semanas",date:_}].map((ve,Oe)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:ye=>ye.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:ye=>ye.currentTarget.style.backgroundColor="transparent",onClick:()=>{V==="start"?(Ge("startDate",ve.date),(!se.endDate||ve.date>se.endDate)&&Ge("endDate",ve.date),O("end")):(Ge("endDate",ve.date),(!se.startDate||ve.date<se.startDate)&&Ge("startDate",ve.date),O(null));},children:ve.label},Oe))})(),jsx("div",{style:{borderTop:`1px solid ${b.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:L=>L.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",onClick:()=>{Ge("startDate",void 0),Ge("endDate",void 0),O(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>F(new Date(X$1.getFullYear(),X$1.getMonth()-1)),className:"p-1 rounded",onMouseEnter:L=>L.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:b.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:b.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:X$1.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>F(new Date(X$1.getFullYear(),X$1.getMonth()+1)),className:"p-1 rounded",onMouseEnter:L=>L.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:b.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((L,Q)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:b.textTertiary},children:L},Q))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let L=X$1.getFullYear(),Q=X$1.getMonth(),R=new Date(L,Q,1).getDay(),_=new Date(L,Q+1,0).getDate(),ue=new Date,ve=[];for(let ye=R-1;ye>=0;ye--)ve.push({day:new Date(L,Q,-ye).getDate(),date:new Date(L,Q-1,new Date(L,Q,-ye).getDate()),isCurrentMonth:false});for(let ye=1;ye<=_;ye++)ve.push({day:ye,date:new Date(L,Q,ye),isCurrentMonth:true});let Oe=42-ve.length;for(let ye=1;ye<=Oe;ye++)ve.push({day:ye,date:new Date(L,Q+1,ye),isCurrentMonth:false});return ve.map((ye,ft)=>{let ie=ye.date.toDateString()===ue.toDateString(),ge=se.startDate?.toDateString()===ye.date.toDateString(),Ze=se.endDate?.toDateString()===ye.date.toDateString(),Xe=se.startDate&&se.endDate&&ye.date>=se.startDate&&ye.date<=se.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:ye.isCurrentMonth?ge||Ze?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:ge?b.accent:Ze?"#7C3AED":Xe?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:ie&&!ge&&!Ze?`inset 0 0 0 1px ${b.accent}`:"none"},onClick:()=>{V==="start"?(Ge("startDate",ye.date),se.endDate&&ye.date>se.endDate&&Ge("endDate",ye.date),O("end")):(Ge("endDate",ye.date),se.startDate&&ye.date<se.startDate&&Ge("startDate",ye.date),O(null));},children:ye.day},ft)})})()})]})]})]})})]}),qe.endDate&&jsx("span",{className:"text-xs text-red-400",children:qe.endDate})]})]}),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary},children:"Progreso Inicial"}),jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[se.progress,"%"]})]}),jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Be?"#33343c":"#E5E7EB"},onClick:L=>{if(o)return;let Q=L.currentTarget.getBoundingClientRect(),R=Math.round((L.clientX-Q.left)/Q.width*100/5)*5;Ge("progress",Math.max(0,Math.min(100,R)));},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${se.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxs("div",{style:{borderTop:`1px solid ${Be?"rgba(65,71,84,0.05)":b.borderLight}`,paddingTop:16},children:[jsxs("button",{type:"button",onClick:()=>B(!De),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:b.textPrimary},children:[jsx(ChevronDown,{className:`w-4 h-4 transition-transform ${De?"":"-rotate-90"}`,style:{color:b.textTertiary}}),jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsx(AnimatePresence,{children:De&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Horas Estimadas"})]}),jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:se.effortMinutes?Xw(se.effortMinutes):"",onChange:L=>{let Q=Jw(L.target.value);Ge("effortMinutes",Q);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`}})]}),a.length>0&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Fase Padre"})]}),jsxs("select",{value:se.parentId||"",onChange:L=>Ge("parentId",L.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o,children:[jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),a.filter(L=>L.id!==r?.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:b.textTertiary},children:"Ubicaci\xF3n"})]}),jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:se.location||"",onChange:L=>Ge("location",L.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Activo / Equipo"})]}),jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:se.equipment||"",onChange:L=>Ge("equipment",L.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]})]}),(m||d.length>0||l==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxs("span",{className:"text-xs",style:{color:b.textTertiary},children:["Adjuntos ",l==="create"?z.length>0&&`(${z.length})`:d.length>0&&`(${d.length})`]})]}),l==="create"?jsx(as,{cardId:"pending",attachments:z.map((L,Q)=>({id:`pending-${Q}`,cardId:"pending",name:L.name,size:L.size,type:L.type,url:URL.createObjectURL(L),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:L=>Me(Q=>[...Q,...L]),onDelete:L=>{let Q=parseInt(L.replace("pending-",""),10);Me(R=>R.filter((_,ue)=>ue!==Q));},maxSizeMB:10,maxFiles:20}):jsx(as,{cardId:r?.id||"new",attachments:d,onUpload:m&&r?.id?L=>m(r.id,L):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),l==="create"&&z.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:b.textTertiary},children:[z.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=b.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:se.isMilestone,onChange:L=>Ge("isMilestone",L.target.checked),className:"w-4 h-4 rounded",style:{accentColor:b.accent},disabled:o}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:b.textPrimary},children:"Marcar como hito"})]}),a.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:b.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),se.dependencies&&se.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:se.dependencies.map(L=>{let Q=a.find(R=>R.id===L);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${b.accent}20`,color:b.accent},children:[Q?.name||L.slice(0,8),jsx("button",{type:"button",onClick:()=>{let R=(se.dependencies||[]).filter(_=>_!==L);Ge("dependencies",R);},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:()=>{ce(!Ue),J("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textSecondary},disabled:o,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:Ue&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ce(false),J("");}}),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:Be?"#0a0a0a":b.bgPrimary,backdropFilter:Be?"blur(16px)":void 0,border:`1px solid ${Be?"#262626":b.border}`,boxShadow:Be?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${b.border}`},children:jsx("input",{type:"text",value:Le,onChange:L=>J(L.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:b.bgSecondary,color:b.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[a.filter(L=>L.id!==r?.id).filter(L=>Le===""||L.name.toLowerCase().includes(Le.toLowerCase())).map(L=>{let Q=se.dependencies?.includes(L.id);return jsxs("button",{type:"button",onClick:()=>{let R=se.dependencies||[],_;Q?_=R.filter(ue=>ue!==L.id):_=[...R,L.id],Ge("dependencies",_);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:Q?`${b.accent}10`:"transparent"},onMouseEnter:R=>{Q||(R.currentTarget.style.backgroundColor=b.hoverBg);},onMouseLeave:R=>{R.currentTarget.style.backgroundColor=Q?`${b.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:Q?b.accent:"transparent",borderColor:Q?b.accent:b.borderLight},children:Q&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:b.textPrimary},children:L.name}),jsx("span",{className:"text-[10px]",style:{color:b.textTertiary},children:L.id.slice(0,8)})]})]},L.id)}),a.filter(L=>L.id!==r?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:b.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${Be?"rgba(65,71,84,0.1)":b.border}`,backgroundColor:Be?"rgba(25,27,34,0.2)":void 0},children:[jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:b.textTertiary},onMouseEnter:L=>L.currentTarget.style.color=b.textPrimary,onMouseLeave:L=>L.currentTarget.style.color=b.textTertiary,disabled:o,children:"Cancelar"}),jsx("button",{type:"submit",disabled:o,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#00E5CC",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter: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:l==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var fg=`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 H=_=>_.map(re=>{if(re.id===F){let me=re.dependencies||[];if(!me.includes(E.id))return {...re,dependencies:[...me,E.id]}}return re.subtasks?{...re,subtasks:H(re.subtasks)}:re});Gr.current+=1,K(_=>H(_)),je?.(E.id,F);},[je,Lu]),Iu=useCallback((E,F)=>{let H=_=>_.map(re=>{if(re.id===E&&re.dependencies){let me=re.dependencies.filter(Ge=>Ge!==F);return {...re,dependencies:me}}return re.subtasks?{...re,subtasks:H(re.subtasks)}:re});Gr.current+=1,K(_=>H(_)),Xe?.(E,F);},[Xe]),{startDate:kn,endDate:Xl}=useMemo(()=>{let E=ge.filter(me=>me.startDate&&me.endDate);if(E.length===0){let me=new Date,Ge=new Date(me);Ge.setDate(Ge.getDate()-30);let Ve=new Date(me);return Ve.setDate(Ve.getDate()+60),{startDate:Ge,endDate:Ve}}let F=E.flatMap(me=>[me.startDate,me.endDate]).filter(me=>me!==void 0),H=new Date(Math.min(...F.map(me=>me.getTime()))),_=new Date(Math.max(...F.map(me=>me.getTime()))),re=B==="day"?7:B==="week"?14:30;return H.setDate(H.getDate()-re),_.setDate(_.getDate()+re),{startDate:H,endDate:_}},[ge,B]);useEffect(()=>{pr.current?.(kn,Xl);},[kn,Xl]);let Nb=useCallback(async()=>{if(!At.current||!Me.current||!qe.current)return;await new Promise(wo=>setTimeout(wo,200));let E=At.current,F=Me.current,H=Ke.current||F.querySelector(".gantt-grid-scroll"),_=qe.current,re=H?.scrollTop||0,me=H?.scrollLeft||0,Ge=_.scrollTop,Ve=_.scrollLeft,ta=E.style.overflow,Wt=E.style.height,sa=H?.style.overflow||"",gr=_.style.overflow,Hr=F.style.overflow,qn=E.style.width,qo=_.style.width;try{let wo=H?.querySelector(".gantt-taskgrid-content"),Cn=_.querySelector("svg"),ec=Cn?.getAttribute("height")?parseInt(Cn.getAttribute("height"),10):Cn?.getBoundingClientRect().height||0,Yo=wo?.scrollHeight||H?.scrollHeight||600,yi=Math.max(ec,_.scrollHeight),Ms=Cn?.getAttribute("width")?parseInt(Cn.getAttribute("width"),10):Cn?.getBoundingClientRect().width||_.scrollWidth,Ab=E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,tc=Math.max(Yo,yi,ec),Ou=Ab+tc+50,Hu=(H?.offsetWidth||F.offsetWidth||300)+Ms+10;H&&(H.scrollTop=0,H.scrollLeft=0),_.scrollTop=0,_.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Ou}px`,E.style.width=`${Hu}px`,F.style.overflow="visible",H&&(H.style.overflow="visible",H.style.height=`${tc+50}px`),_.style.overflow="visible",_.style.height=`${tc+50}px`,_.style.width=`${Ms+10}px`,await new Promise(xi=>setTimeout(xi,150));let Ib=await toPng(E,{backgroundColor:We.bgPrimary,pixelRatio:2,width:Hu,height:Ou,skipFonts:!1,filter:xi=>{if(!(xi instanceof Element))return !0;let Uu=window.getComputedStyle(xi),Wu=parseInt(Uu.zIndex,10);return !(!isNaN(Wu)&&Wu>=50||Uu.position==="fixed")}}),ac=document.createElement("a");ac.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,ac.href=Ib,ac.click();}finally{E.style.overflow=ta,E.style.height=Wt,E.style.width=qn,F.style.overflow=Hr,H&&(H.style.overflow=sa,H.style.height="",H.scrollTop=re,H.scrollLeft=me),_.style.overflow=gr,_.style.height="",_.style.width=qo,_.scrollTop=Ge,_.scrollLeft=Ve;}u?.("png");},[We,u]),Db=useCallback(async()=>{await De.exportToPDF(ge),u?.("pdf");},[ge,u]),Jl=useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:p});Jl.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:p};let Sb=useCallback(async()=>{if(a.onExportExcel){await a.onExportExcel(),u?.("excel");return}let E=new Date,F=re=>String(re).padStart(2,"0"),H=`${E.getFullYear()}-${F(E.getMonth()+1)}-${F(E.getDate())}_${F(E.getHours())}${F(E.getMinutes())}`,_=p?p.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await De.exportToExcel(ge,`${_}_${H}.xlsx`,Jl.current),u?.("excel");},[ge,p,u,a.onExportExcel]),Eb=useCallback(()=>{let E=De.exportToCSV(ge),F=new Blob([E],{type:"text/csv;charset=utf-8;"}),H=document.createElement("a");H.href=URL.createObjectURL(F),H.download="gantt-chart.csv",H.click(),URL.revokeObjectURL(H.href),u?.("csv");},[ge,u]),Mb=useCallback(()=>{let E=De.exportToJSON(ge),F=new Blob([E],{type:"application/json;charset=utf-8;"}),H=document.createElement("a");H.href=URL.createObjectURL(F),H.download="gantt-chart.json",H.click(),URL.revokeObjectURL(H.href),u?.("json");},[ge,u]),Pb=useCallback(()=>{De.exportToMSProject(ge,"Gantt Project","project.xml"),u?.("msproject");},[ge,u]),Fb=E=>{E.preventDefault(),fe(true);},Ko=useRef(false),[Ql,Ru]=useState(false),Es=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let E=qe.current,F=Me.current?.querySelector(".gantt-grid-scroll");if(!E||!F)return;let H=()=>{if(Ko.current)return;Ko.current=true;let Ve=E.scrollTop;gt(Ve),F.scrollTop=Ve,requestAnimationFrame(()=>{Ko.current=false;});},_=()=>{if(Ko.current)return;Ko.current=true;let Ve=F.scrollTop;gt(Ve),E.scrollTop=Ve,requestAnimationFrame(()=>{Ko.current=false;});},re=Ve=>{if(j&&F){let Wt=F.parentElement?.getBoundingClientRect()?.left||0,sa=Ve.clientX-Wt,gr=200,Hr=te+Te,qn=window.innerWidth*_e,qo=Math.max(Hr,qn);sa>=gr&&sa<=qo&&$(sa);}if(Ql&&E){let ta=Ve.clientX-Es.current.x,Wt=Ve.clientY-Es.current.y;E.scrollLeft=Es.current.scrollLeft-ta,E.scrollTop=Es.current.scrollTop-Wt;}},me=()=>{fe(false),Ru(false);},Ge=Ve=>{if(Ve.button!==0)return;let ta=Ve.target;ta.closest("[data-task-bar]")||ta.closest("[data-dependency-line]")||ta.closest("button")||ta.closest('[role="button"]')||ta.tagName==="rect"&&ta.getAttribute("data-clickable")==="true"||(Ru(true),Es.current={x:Ve.clientX,y:Ve.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},Ve.preventDefault());};return E.addEventListener("scroll",H),F.addEventListener("scroll",_),E.addEventListener("mousedown",Ge),document.addEventListener("mousemove",re),document.addEventListener("mouseup",me),()=>{E.removeEventListener("scroll",H),F.removeEventListener("scroll",_),E.removeEventListener("mousedown",Ge),document.removeEventListener("mousemove",re),document.removeEventListener("mouseup",me);}},[j,Ql,te]),ut.current={startDate:kn,timeScale:B,zoom:ye};let Zl=a.onTodayVisibilityChange,Bu=useRef(null);useEffect(()=>{if(!Zl)return;let E=qe.current;if(!E)return;let F=B==="day"?60:B==="week"?20:8,H=()=>{let me=(new Date().getTime()-kn.getTime())/(1e3*60*60*24)*F*ye,Ge=E.scrollLeft,Ve=Ge+E.clientWidth,ta=me>=Ge&&me<=Ve;Bu.current!==ta&&(Bu.current=ta,Zl(ta));};return H(),E.addEventListener("scroll",H,{passive:true}),window.addEventListener("resize",H),()=>{E.removeEventListener("scroll",H),window.removeEventListener("resize",H);}},[Zl,kn,B,ye]);let $u=useRef(false),Lb=useRef(null);return useLayoutEffect(()=>{if($u.current||ge.length===0||!qe.current)return;$u.current=true,Lb.current=kn;let E=qe.current,F=new Date,H=B==="day"?60:B==="week"?20:8,_=(F.getTime()-kn.getTime())/(1e3*60*60*24),re=E.clientWidth,Ge=_*H*ye-re/2;_>=0&&re>0&&(E.scrollLeft=Math.max(0,Ge));},[ge.length,kn,B,ye]),useLayoutEffect(()=>{let E=ma.current;!E||ut.current?.timeScale!==B||(ma.current=null,sr(E));},[B,kn,ye]),jsx(ls.Provider,{value:Ka,children:jsx(ic.Provider,{value:ha,children:jsxs("div",{ref:At,className:"flex flex-col h-full w-full",style:{backgroundColor:We.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...We.dotGrid&&{backgroundImage:`radial-gradient(circle, ${We.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[(()=>{let E=jsx(Qi,{enCabecera:!!V,theme:We,timeScale:B,onTimeScaleChange:q,zoom:ye,onZoomChange:tt,currentTheme:X,onThemeChange:rt,rowDensity:he,onRowDensityChange:Ae,showThemeSelector:c,showCreateTaskButton:M&&Mt?.canCreateTask!==false&&!Mt?.canCreateSubtaskOnly,createTaskLabel:I,onCreateTask:C,taskFilter:ja,onTaskFilterChange:or,hideCompleted:Ca,onHideCompletedChange:Wa,toolbarRightContent:T,wbsLevel:ie,onWbsLevelChange:O?void 0:bi,maxWbsDepth:_a,viewMode:ft,onViewModeChange:Ie?Ye:void 0,projectForecast:G,hideForecastHud:ke,onExportPNG:i?Nb:void 0,onExportPDF:i?Db:void 0,onExportExcel:i?Sb:void 0,onExportCSV:i?Eb:void 0,onExportJSON:i?Mb:void 0,onExportMSProject:i?Pb:void 0,showCriticalPath:Yt,onShowCriticalPathChange:Ht,showDependencies:ca,onShowDependenciesChange:kr,highlightWeekends:Bt,onHighlightWeekendsChange:da,showBaseline:vt,onShowBaselineChange:F=>{F&&ft!=="oracle"&&Ye("oracle"),!F&&ft==="oracle"&&Ye("execution");},onCopySnapshotLink:Oe,hasDependencies:Ut});return V?createPortal(E,V):jsx("div",{style:{position:"relative",zIndex:100},children:E})})(),jsxs("div",{ref:Me,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:Ke,className:"gantt-grid-scroll flex-shrink-0",style:{width:le,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(tl,{tasks:Tt,allTasks:Vt,theme:We,rowHeight:Ft,availableUsers:d,templates:ya,showCriticalPath:Yt,onTaskClick:U,onTaskSelectionChange:Pe,selectedTaskId:Ze,onTaskDblClick:Fu,onTaskContextMenu:Fe,onTaskToggle:qa,scrollTop:ue,columns:Or,onToggleColumn:Cr,onColumnResize:mr,onTaskUpdate:Fr,onBulkFill:Ss,onTaskIndent:vo,onTaskOutdent:fb,onTaskMove:hb,onMultiTaskDelete:ql,onTaskDuplicate:yb,onTaskCreate:xb,onTaskRename:vb,onCreateSubtask:Yl,onOpenTaskModal:U?E=>U(E):void 0,onDeleteRequest:(E,F)=>ve({taskIds:E,taskName:F}),onTaskReparent:bb,scrollContainerRef:Ke})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:We.border,zIndex:15},onMouseDown:Fb}),jsx("div",{ref:qe,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Ql?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(ll,{tasks:Tt,theme:We,rowHeight:Ft,timeScale:B,startDate:kn,endDate:Xl,zoom:ye,locale:w,templates:ya,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:U,onTaskDblClick:Fu,onTaskContextMenu:Cb,onTaskDateChange:kb,onTaskProgressDrag:wb,onDependencyCreate:Au,onDependencyDelete:Iu,showBaseline:vt,showCriticalPath:Yt,showDependencies:ca,highlightWeekends:Bt,weekHeaderFormat:a.weekHeaderFormat,canEditTask:Mt?.canEditTask,workingDaysConfig:a?.workingDaysConfig})})]}),ee.task&&jsx(cs,{isOpen:ee.isOpen,x:ee.x,y:ee.y,theme:We,onClose:()=>Ce({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=ee.task;if(!E)return [];let F=De.findTaskById(ge,E.id)||E,H=F.subtasks&&F.subtasks.length>0,_=Mt?.canCreateTask!==false,re=Mt?.canDeleteTask!==false;if(H){let Wt=[],sa=Mt?.canDuplicateTask!==false;return _&&Wt.push({id:"addSubtask",label:Ka.contextMenu?.addSubtask||"Add Subtask",icon:ra.Add,onClick:()=>{Be?Be(F):Yl(F.id);}}),sa&&Wt.push({id:"duplicate",label:Ka.contextMenu?.duplicateTask||"Duplicate Task",icon:ra.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):K(gr=>Ys(gr,[F.id]).tasks),Ce({isOpen:false,x:0,y:0,task:null});}}),re&&(Wt.length>0&&Wt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Wt.push({id:"delete",label:Ka.contextMenu?.deleteTask||"Delete Task",icon:ra.Delete,onClick:()=>{ve({taskIds:[F.id],taskName:F.name});}})),Wt}let me=Mt?.canUpdateTask!==false,Ge=Mt?.canDuplicateTask!==false,Ve=[];return me&&Ve.push({id:"edit",label:Ka.contextMenu?.editTask||"Edit Task",icon:ra.Pencil,onClick:()=>{Le?Le(F):W(F);}}),_&&Ve.push({id:"addSubtask",label:Ka.contextMenu?.addSubtask||"Add Subtask",icon:ra.Add,onClick:()=>{Be?Be(F):Yl(F.id);}}),Ve.length>0&&me&&Ve.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),me&&(Ve.push({id:"markIncomplete",label:Ka.contextMenu?.markIncomplete||"Mark Incomplete",icon:ra.MarkIncomplete,onClick:()=>{ot?ot(F):Fr(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"}),Ve.push({id:"setInProgress",label:Ka.contextMenu?.setInProgress||"Set In Progress",icon:ra.SetInProgress,onClick:()=>{se?se(F):Fr(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"}),Ve.push({id:"markComplete",label:Ka.contextMenu?.markComplete||"Mark Complete",icon:ra.MarkComplete,onClick:()=>{Fr(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"})),(Ge||me&&F.startDate&&F.endDate)&&Ve.length>0&&Ve.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Ge&&Ve.push({id:"duplicate",label:Ka.contextMenu?.duplicateTask||"Duplicate Task",icon:ra.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):K(Wt=>Ys(Wt,[F.id]).tasks),Ce({isOpen:false,x:0,y:0,task:null});}}),me&&F.startDate&&F.endDate&&Ve.push({id:"split",label:Ka.contextMenu?.splitTask||"Split Task",icon:ra.Split,onClick:()=>{let Wt=F.startDate.getTime(),sa=F.endDate.getTime(),gr=Wt+(sa-Wt)/2,Hr=new Date(gr);Tb(F,Hr);}}),re&&(Ve.length>0&&Ve.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ve.push({id:"delete",label:Ka.contextMenu?.deleteTask||"Delete Task",icon:ra.Delete,onClick:()=>{ve({taskIds:[F.id],taskName:F.name});}})),Ve})()}),jsx(Eo,{task:D,isOpen:!!D,onClose:()=>W(null),onTaskUpdate:E=>{D&&(Fr(D.id,E),W(null));},theme:X==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsx(AnimatePresence,{children:pe&&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:()=>ve(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:We.bgSecondary,border:`1px solid ${We.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${We.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:We.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ka.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:We.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:We.textSecondary,fontFamily:"Inter, sans-serif"},children:pe.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:We.textPrimary},children:[pe.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:We.textPrimary},children:['"',pe.taskName,'"']}),"."]})})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:We.bgPrimary,borderTop:`1px solid ${We.border}`},children:[jsx("button",{onClick:()=>ve(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:We.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=We.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{ql(pe.taskIds),ve(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(ul,{tasks:ge,theme:We,config:x,onTasksUpdate:K,onTaskUpdate:Fr,onTaskCreate:E=>{K(F=>[...F,E]);},onTaskDelete:E=>{ql([E]);},onDependencyCreate:(E,F)=>{let H=De.findTaskById(ge,E);H&&Au(H,F);},onDependencyDelete:Iu})]})})})});function Qw(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 Zw(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*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 xd=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],vd=[{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 gg({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:n=[],onSubmit:s,isLoading:o=false,mode:l=a?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:p,attachments:d=[],onUploadAttachments:m,onDeleteAttachment:f,defaultStatus:v}){let h=[...xd,...i.filter(A=>!xd.some(X=>X.id===A.id))],b=pt[c]||pt.dark,[y,x]=useState(false),[w,k]=useState(false),[M,I]=useState(false),[C,N]=useState(false),[P,T]=useState({top:0,left:0}),[V,O]=useState(null),[J,L]=useState(new Date),[Ie,G]=useState({top:0,left:0}),[ke,R]=useState(false),[U,Pe]=useState([]),[Ze,oe]=useState(false),[Fe,Q]=useState(""),Se=useRef(null),Ue=useRef(null),Le=useRef(null),Be=useRef(null),ot=useRef(null),[se,je]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[Xe,$e]=useState({});useEffect(()=>{a?(je({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)):(je({name:"",description:"",progress:0,status:v||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),R(false),Pe([]));},[a,e,v]),useEffect(()=>{let A=X=>{Se.current&&!Se.current.contains(X.target)&&x(false),Ue.current&&!Ue.current.contains(X.target)&&k(false),Le.current&&!Le.current.contains(X.target)&&I(false),Be.current&&!Be.current.contains(X.target)&&N(false);};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]);let mt=()=>{let A={};return se.name.trim()||(A.name="El nombre es requerido"),se.startDate&&se.endDate&&se.startDate>se.endDate&&(A.endDate="La fecha de fin debe ser posterior a la de inicio"),$e(A),Object.keys(A).length===0},Et=async A=>{if(A.preventDefault(),!!mt())try{let X=l==="create"&&U.length>0?{...se,pendingFiles:U}:se;await s(X),Pe([]),t();}catch(X){console.error("Error submitting task:",X);}},st=(A,X)=>{je(we=>{let B={...we,[A]:X};if(A==="status"){let q=X;q==="todo"?B.progress=0:q==="in-progress"?(we.progress===0||we.progress===100)&&(B.progress=50):q==="completed"||q==="closed"?B.progress=100:(q==="in-review"||q==="review")&&(B.progress=75);}if(A==="progress"){let q=typeof X=="number"?X:parseInt(X,10);q===100&&we.status!=="completed"?B.status="completed":q>0&&q<100&&we.status==="todo"?B.status="in-progress":q===0&&we.status!=="todo"&&(B.status="todo");}return B}),Xe[A]&&$e(we=>{let B={...we};return delete B[A],B});},Ne=h.find(A=>A.id===se.status)??xd[0],lt=vd.find(A=>A.id===se.priority)??vd[1],Mt=So.find(A=>A.value===se.color)??So[0],Oe=c==="dark",xt={backgroundColor:Oe?"#1d1f27":b.bgSecondary,border:`1px solid ${Oe?"rgba(65,71,84,0.1)":b.borderLight}`,color:b.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:Oe?"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:Oe?"#0a0a0a":b.bgPrimary,border:`1px solid ${Oe?"rgba(65,71,84,0.1)":b.border}`,boxShadow:Oe?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:A=>A.stopPropagation(),children:jsxs("form",{onSubmit:Et,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:se.name,onChange:A=>st("name",A.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:b.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:o,autoFocus:true}),Xe.name&&jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Xe.name]}),jsx("textarea",{value:se.description||"",onChange:A=>st("description",A.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:b.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":b.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:o})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:Se,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:{...xt,borderColor:Ne.color,backgroundColor:`${Ne.color}15`},disabled:o,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:Ne.color}}),jsx("span",{style:{color:Ne.color},children:Ne.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:Ne.color}})]}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:Oe?"#0a0a0a":b.bgPrimary,backdropFilter:Oe?"blur(16px)":void 0,border:`1px solid ${Oe?"#262626":b.border}`,boxShadow:Oe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(A=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:X=>X.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{st("status",A.id),x(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:A.color}}),A.title,se.status===A.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},A.id))})})]}),jsxs("div",{ref:Ue,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&k(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:xt,disabled:o,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:lt.color}}),jsx("span",{children:lt.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:w&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:Oe?"#0a0a0a":b.bgPrimary,backdropFilter:Oe?"blur(16px)":void 0,border:`1px solid ${Oe?"#262626":b.border}`,boxShadow:Oe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:vd.map(A=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:X=>X.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:X=>X.currentTarget.style.backgroundColor="transparent",onClick:()=>{st("priority",A.id),k(false);},children:[jsx("span",{children:A.icon}),A.label,se.priority===A.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},A.id))})})]}),n.length>0&&jsxs("div",{ref:Le,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&I(!M),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:xt,disabled:o,children:[se.assignees&&se.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:se.assignees.slice(0,3).map((A,X)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:A.color||b.accent,borderColor:b.bgSecondary},children:A.initials},X))}),se.assignees.length>3&&jsxs("span",{style:{color:b.textTertiary},children:["+",se.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:b.textTertiary}}),jsx("span",{style:{color:b.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:M&&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:Oe?"#0a0a0a":b.bgPrimary,backdropFilter:Oe?"blur(16px)":void 0,border:`1px solid ${Oe?"#262626":b.border}`,boxShadow:Oe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(A=>{let X=se.assignees?.some(we=>we.name===A.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:we=>we.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:we=>we.currentTarget.style.backgroundColor="transparent",onClick:()=>{let we=X?(se.assignees||[]).filter(B=>B.name!==A.name):[...se.assignees||[],{name:A.name,avatar:A.avatar,initials:A.name.split(" ").map(B=>B[0]).join("").toUpperCase().slice(0,2),color:b.accent}];st("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:b.accent},children:A.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:A.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:X&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:b.accent}})})]},A.id)})})})]}),jsxs("div",{ref:Be,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!o)if(C)N(false);else {if(Be.current){let A=Be.current.getBoundingClientRect(),X=window.innerHeight,we=120,q=X-A.bottom<we?A.top-we-8:A.bottom+8;T({top:q,left:A.left});}N(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:xt,disabled:o,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:se.color}}),jsx("span",{children:Mt.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:C&&jsxs(ia,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>N(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${P.top}px`,left:`${P.left}px`,zIndex:99999,backgroundColor:Oe?"#0a0a0a":b.bgPrimary,backdropFilter:Oe?"blur(16px)":void 0,border:`1px solid ${Oe?"#262626":b.border}`,boxShadow:Oe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:A=>A.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:So.slice(0,18).map(A=>{let X=se.color===A.value;return jsx("button",{type:"button",onClick:we=>{we.preventDefault(),we.stopPropagation(),st("color",A.value),N(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:A.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:A.value,outline:X?`2px solid ${A.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},A.value)})})})})]})})]}),u.length>0||p?jsx(Zo,{selectedTags:se.tags||[],availableTags:u,onChange:A=>st("tags",A),onCreateTag:p,theme:b,disabled:o}):null]}),jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxs("div",{className:"space-y-3",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:Oe?"#191b22":b.bgSecondary,borderRadius:8,border:`1px solid ${Oe?"rgba(65,71,84,0.05)":b.borderLight}`,padding:"10px 16px"},children:[jsx(Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxs("div",{ref:ot,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!o&&!se.isMilestone)if(V==="start")O(null);else {if(ot.current){let A=ot.current.getBoundingClientRect();G({top:A.bottom+8,left:Math.max(16,A.left-40)});}O("start"),L(se.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...xt,opacity:se.isMilestone?.5:1,cursor:se.isMilestone?"not-allowed":"pointer"},disabled:o||se.isMilestone,children:se.startDate?se.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:b.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!o&&!se.isMilestone)if(V==="end")O(null);else {if(ot.current){let A=ot.current.getBoundingClientRect();G({top:A.bottom+8,left:Math.max(16,A.left-40)});}O("end"),L(se.endDate||se.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...xt,opacity:se.isMilestone?.5:1,cursor:se.isMilestone?"not-allowed":"pointer"},disabled:o||se.isMilestone,children:se.endDate?se.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:V&&jsxs(ia,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>O(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:`${Ie.top}px`,left:`${Ie.left}px`,zIndex:99999,backgroundColor:Oe?"#0a0a0a":b.bgPrimary,border:`1px solid ${Oe?"#262626":b.border}`,boxShadow:Oe?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:A=>A.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${Oe?"#262626":b.border}`},children:[(()=>{let A=new Date,X=new Date(A);X.setDate(A.getDate()+1);let we=new Date(A);we.setDate(A.getDate()+7);let B=new Date(A);return B.setDate(A.getDate()+14),[{label:"Hoy",date:A},{label:"Ma\xF1ana",date:X},{label:"Pr\xF3xima semana",date:we},{label:"2 semanas",date:B}].map((he,Ae)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:ye=>ye.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:ye=>ye.currentTarget.style.backgroundColor="transparent",onClick:()=>{V==="start"?(st("startDate",he.date),(!se.endDate||he.date>se.endDate)&&st("endDate",he.date),O("end")):(st("endDate",he.date),(!se.startDate||he.date<se.startDate)&&st("startDate",he.date),O(null));},children:he.label},Ae))})(),jsx("div",{style:{borderTop:`1px solid ${b.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",onClick:()=>{st("startDate",void 0),st("endDate",void 0),O(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>L(new Date(J.getFullYear(),J.getMonth()-1)),className:"p-1 rounded",onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:b.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:b.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:J.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>L(new Date(J.getFullYear(),J.getMonth()+1)),className:"p-1 rounded",onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:b.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((A,X)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:b.textTertiary},children:A},X))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let A=J.getFullYear(),X=J.getMonth(),we=new Date(A,X,1).getDay(),B=new Date(A,X+1,0).getDate(),q=new Date,he=[];for(let ye=we-1;ye>=0;ye--)he.push({day:new Date(A,X,-ye).getDate(),date:new Date(A,X-1,new Date(A,X,-ye).getDate()),isCurrentMonth:false});for(let ye=1;ye<=B;ye++)he.push({day:ye,date:new Date(A,X,ye),isCurrentMonth:true});let Ae=42-he.length;for(let ye=1;ye<=Ae;ye++)he.push({day:ye,date:new Date(A,X+1,ye),isCurrentMonth:false});return he.map((ye,tt)=>{let ie=ye.date.toDateString()===q.toDateString(),ce=se.startDate?.toDateString()===ye.date.toDateString(),He=se.endDate?.toDateString()===ye.date.toDateString(),at=se.startDate&&se.endDate&&ye.date>=se.startDate&&ye.date<=se.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:ye.isCurrentMonth?ce||He?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:ce?b.accent:He?"#7C3AED":at?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:ie&&!ce&&!He?`inset 0 0 0 1px ${b.accent}`:"none"},onClick:()=>{V==="start"?(st("startDate",ye.date),se.endDate&&ye.date>se.endDate&&st("endDate",ye.date),O("end")):(st("endDate",ye.date),se.startDate&&ye.date<se.startDate&&st("startDate",ye.date),O(null));},children:ye.day},tt)})})()})]})]})]})})]}),Xe.endDate&&jsx("span",{className:"text-xs text-red-400",children:Xe.endDate})]})]}),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary},children:"Progreso Inicial"}),jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[se.progress,"%"]})]}),jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Oe?"#33343c":"#E5E7EB"},onClick:A=>{if(o)return;let X=A.currentTarget.getBoundingClientRect(),we=Math.round((A.clientX-X.left)/X.width*100/5)*5;st("progress",Math.max(0,Math.min(100,we)));},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${se.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxs("div",{style:{borderTop:`1px solid ${Oe?"rgba(65,71,84,0.05)":b.borderLight}`,paddingTop:16},children:[jsxs("button",{type:"button",onClick:()=>R(!ke),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:b.textPrimary},children:[jsx(ChevronDown,{className:`w-4 h-4 transition-transform ${ke?"":"-rotate-90"}`,style:{color:b.textTertiary}}),jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsx(AnimatePresence,{children:ke&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Horas Estimadas"})]}),jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:se.effortMinutes?Qw(se.effortMinutes):"",onChange:A=>{let X=Zw(A.target.value);st("effortMinutes",X);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`}})]}),r.length>0&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Fase Padre"})]}),jsxs("select",{value:se.parentId||"",onChange:A=>st("parentId",A.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o,children:[jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(A=>A.id!==a?.id).map(A=>jsx("option",{value:A.id,children:A.name},A.id))]})]}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Ubicaci\xF3n"})]}),jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:se.location||"",onChange:A=>st("location",A.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Activo / Equipo"})]}),jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:se.equipment||"",onChange:A=>st("equipment",A.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]})]}),(m||d.length>0||l==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxs("span",{className:"text-xs",style:{color:b.textTertiary},children:["Adjuntos ",l==="create"?U.length>0&&`(${U.length})`:d.length>0&&`(${d.length})`]})]}),l==="create"?jsx(rs,{cardId:"pending",attachments:U.map((A,X)=>({id:`pending-${X}`,cardId:"pending",name:A.name,size:A.size,type:A.type,url:URL.createObjectURL(A),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:A=>Pe(X=>[...X,...A]),onDelete:A=>{let X=parseInt(A.replace("pending-",""),10);Pe(we=>we.filter((B,q)=>q!==X));},maxSizeMB:10,maxFiles:20}):jsx(rs,{cardId:a?.id||"new",attachments:d,onUpload:m&&a?.id?A=>m(a.id,A):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),l==="create"&&U.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:b.textTertiary},children:[U.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:se.isMilestone,onChange:A=>st("isMilestone",A.target.checked),className:"w-4 h-4 rounded",style:{accentColor:b.accent},disabled:o}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:b.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:b.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),se.dependencies&&se.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:se.dependencies.map(A=>{let X$1=r.find(we=>we.id===A);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${b.accent}20`,color:b.accent},children:[X$1?.name||A.slice(0,8),jsx("button",{type:"button",onClick:()=>{let we=(se.dependencies||[]).filter(B=>B!==A);st("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"})})]},A)})}),jsxs("button",{type:"button",onClick:()=>{oe(!Ze),Q("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textSecondary},disabled:o,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:Ze&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{oe(false),Q("");}}),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:Oe?"#0a0a0a":b.bgPrimary,backdropFilter:Oe?"blur(16px)":void 0,border:`1px solid ${Oe?"#262626":b.border}`,boxShadow:Oe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${b.border}`},children:jsx("input",{type:"text",value:Fe,onChange:A=>Q(A.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:b.bgSecondary,color:b.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(A=>A.id!==a?.id).filter(A=>Fe===""||A.name.toLowerCase().includes(Fe.toLowerCase())).map(A=>{let X=se.dependencies?.includes(A.id);return jsxs("button",{type:"button",onClick:()=>{let we=se.dependencies||[],B;X?B=we.filter(q=>q!==A.id):B=[...we,A.id],st("dependencies",B);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:X?`${b.accent}10`:"transparent"},onMouseEnter:we=>{X||(we.currentTarget.style.backgroundColor=b.hoverBg);},onMouseLeave:we=>{we.currentTarget.style.backgroundColor=X?`${b.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:X?b.accent:"transparent",borderColor:X?b.accent:b.borderLight},children:X&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:b.textPrimary},children:A.name}),jsx("span",{className:"text-[10px]",style:{color:b.textTertiary},children:A.id.slice(0,8)})]})]},A.id)}),r.filter(A=>A.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:b.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${Oe?"rgba(65,71,84,0.1)":b.border}`,backgroundColor:Oe?"rgba(25,27,34,0.2)":void 0},children:[jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:b.textTertiary},onMouseEnter:A=>A.currentTarget.style.color=b.textPrimary,onMouseLeave:A=>A.currentTarget.style.color=b.textTertiary,disabled:o,children:"Cancelar"}),jsx("button",{type:"submit",disabled:o,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#00E5CC",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:A=>!o&&(A.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:A=>!o&&(A.currentTarget.style.filter="brightness(1)"),children:o?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:l==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var fg=`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
|
|
@@ -407,19 +407,19 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
|
|
|
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
409
|
If ambiguous, ask for clarification in the message field.`;function bg(e){return `CURRENT TASKS:
|
|
410
|
-
${hg(e).map(
|
|
410
|
+
${hg(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 hg(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function Hn(e,t){let r=hg(e),a=t.toLowerCase().trim(),n=r.find(l=>l.name.toLowerCase()===a);if(n)return n;let s=r.find(l=>l.name.toLowerCase().includes(a));if(s)return s;let o=a.split(/\s+/);return r.find(l=>{let c=l.name.toLowerCase();return o.every(i=>c.includes(i))})}function wd(e,t=new Date){let r=e.toLowerCase().trim(),a=new Date(t);if(a.setHours(0,0,0,0),r==="today"||r==="hoy")return a;if(r==="tomorrow"||r==="ma\xF1ana"){let d=new Date(a);return d.setDate(d.getDate()+1),d}if(r==="yesterday"||r==="ayer"){let d=new Date(a);return d.setDate(d.getDate()-1),d}if(r==="next week"||r==="la pr\xF3xima semana"){let d=new Date(a);return d.setDate(d.getDate()+7),d}let n=r.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(n){let 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(a),v=f.getDay(),h=m-v;return h<=0&&(h+=7),f.setDate(f.getDate()+h),f}}let s=r.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let d=parseInt(s[1],10),m=s[2].toLowerCase(),f=new Date(a);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(r.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(r);let l=r.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let d=parseInt(l[1],10),m=parseInt(l[2],10)-1,f=parseInt(l[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},i=r.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let d=parseInt(i[1],10),m=c[i[2].toLowerCase()],f=i[3]?parseInt(i[3],10):a.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=r.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):a.getFullYear();if(d!==void 0)return new Date(f,d,m)}return null}function kd(e){let r=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(r&&r[1]&&r[2]){let a=parseInt(r[1],10),n=r[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return a;if(n==="week"||n==="semana"||n==="semanas")return a*7;if(n==="month"||n==="mes"||n==="meses")return a*30}return null}function Cd(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let r=parseInt(t[1],10);return Math.max(0,Math.min(100,r))}return null}function yg(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 xg(e,t){let r=e.toLowerCase().trim(),a=r.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(a&&a[1]&&a[2]){let i=a[1].trim(),u=a[2].trim(),p=Hn(t,i),d=wd(u);if(!p)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!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=r.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),u=n[2].trim(),p=Hn(t,i),d=kd(u);if(!p)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,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=r.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),u=s[2].trim(),p=Hn(t,i),d=Cd(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:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let o=r.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),u=o[2].trim(),p=Hn(t,i);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:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=r.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),u=l[2].trim(),p=Hn(t,i),d=Hn(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:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let c=r.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),u=Hn(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function vg(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 Qw(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 Zw(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function gl(e,t=[],r=[]){let a=e.assignedUserIds?.map(u=>{let p=r.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=>gl(u,t,r)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let o=u=>{if(u)return typeof u=="string"?new Date(u):u},l=o(e.startDate),c=o(e.endDate),i=e.metadata?.isMilestone===true||l&&c&&Math.abs(c.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:c,progress:e.progress||0,status:Qw(e.metadata?.status),assignees:a?.length?a:void 0,dependencies:s?.length?s:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function wg(e,t=[]){let r;return e.assignees&&e.assignees.length>0&&(r=e.assignees.map(a=>t.find(s=>s.name===a.name||s.initials===a.initials)?.id).filter(a=>a!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:r?.length?r:void 0,metadata:{status:Zw(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function kg(e,t=[]){return e.filter(a=>!a.metadata?.parentCardId).map(a=>gl(a,e,t))}var Td={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"}},Nd={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:Td,es:Nd};function Dd(e){return fl[e]||fl.en}function bl(e,t){let r=Dd(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},filters:{...r.filters,...t.filters},status:{...r.status,...t.status},actions:{...r.actions,...t.actions},empty:{...r.empty,...t.empty},pagination:{...r.pagination,...t.pagination},bulk:{...r.bulk,...t.bulk}}:r}var Sd=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function Cg(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 Tg({value:e,onChange:t,isDark:r,translations:a,disabled:n=false}){let[s,o]=useState(false),l=useRef(null);useEffect(()=>{let m=f=>{l.current&&!l.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let c=Cg(e),i=Sd[0],u=Sd.find(m=>m.value===c)??i,p=u.icon,d=m=>{switch(Cg(m)){case "completed":return a.completed;case "in-progress":return a.inProgress;default:return a.todo}};return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(p,{className:g("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:d(e)})]}):jsxs("div",{ref:l,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",r?"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",r?"text-white/60":"text-gray-500"),children:d(e)}),jsx(ChevronDown,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Sd.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",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===m.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(f,{className:g("w-4 h-4",m.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:d(m.value)})]},m.value)})})]})}function uo(e,t,r=320){let[a,n]=useState(false);return useLayoutEffect(()=>{if(!t)return;let s=e.current?.getBoundingClientRect();if(!s)return;let o=12,l=s.bottom+r+o<=window.innerHeight,c=s.top-r-o>=0;n(!l&&c);},[t,r,e]),a}var Ed=[{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 Dg({value:e="none",onChange:t,isDark:r,locale:a,disabled:n=false}){let[s,o]=useState(false),l=useRef(null),c=uo(l,s,180);useEffect(()=>{let p=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let i=Ed.find(p=>p.value===e)??Ed[4],u=a==="es"?"es":"en";return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:g("w-4 h-4",i.color)}),jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:i.label[u]})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:p=>{p.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:g("w-4 h-4",i.color)}),jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:i.label[u]}),jsx(ChevronDown,{className:g("w-3 h-3",r?"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]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Ed.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",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===p.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:g("w-2 h-2 rounded-full",p.bg)}),jsx("span",{className:r?"text-white":"text-gray-900",children:p.label[u]})]},p.value))})]})}function ri(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Md(e){let t=["bg-[#00E5CC]","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-[#00E5CC]"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"bg-[#00E5CC]"}function xl({value:e=[],availableUsers:t=[],onChange:r,isDark:a,locale:n,disabled:s=false}){let[o,l]=useState(false),[c,i]=useState(""),u=useRef(null),p=useRef(null),d=uo(u,o);useEffect(()=>{let h=b=>{u.current&&!u.current.contains(b.target)&&(l(false),i(""));};return o&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),useEffect(()=>{o&&p.current&&p.current.focus();},[o]);let m=t.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),f=h=>e.some(b=>b.name===h),v=h=>{if(r){if(f(h.name))r(e.filter(b=>b.name!==h.name));else {let b={name:h.name,initials:ri(h.name),color:h.color||Md(h.name).replace("bg-","").replace("-500",""),avatar:h.avatarUrl,id:h.id};r([...e,b]);}l(false),i("");}};return s||!r?e.length===0?jsx("span",{className:g("text-sm",a?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((h,b)=>jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",a?"border-[#0D0D0D]":"border-white",!h.avatar&&Md(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,title:h.name,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||ri(h.name)},`${h.name}-${b}`)),e.length>3&&jsxs("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",a?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:u,className:"relative",children:[jsx("button",{onClick:h=>{h.stopPropagation(),l(!o);},className:g("flex items-center gap-1 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:g("w-4 h-4",a?"text-white/30":"text-gray-400")}),jsx(Plus,{className:g("w-3 h-3",a?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((h,b)=>jsx("div",{className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",a?"border-[#0D0D0D]":"border-white",!h.avatar&&Md(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||ri(h.name)},`${h.name}-${b}`)),e.length>2&&jsxs("span",{className:g("text-xs ml-1",a?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),o&&jsxs("div",{className: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:a?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${a?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:a?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:a?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:p,type:"text",value:c,onChange:h=>i(h.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:h=>h.stopPropagation(),style:{flex:1,fontSize:12,color:a?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((h,b)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:h.color?`${h.color}20`:a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:h.color||(a?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:h.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||ri(h.name)}),h.name.split(" ")[0],jsx("button",{onClick:y=>{y.stopPropagation(),r(e.filter(x=>x.name!==h.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}})})]},`${h.name}-${b}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:a?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:n==="es"?"No se encontraron miembros":"No members found"}):m.map(h=>{let b=f(h.name);return jsxs("button",{onClick:y=>{y.stopPropagation(),v(h);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:b?a?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:a?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:y=>{b||(y.currentTarget.style.backgroundColor=a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:y=>{b||(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:h.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:h.avatarUrl?jsx("img",{src:h.avatarUrl,alt:h.name,className:"w-full h-full rounded-full object-cover"}):ri(h.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.name}),b&&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"}})})]},h.id)})})]})]})}function Lg({startDate:e,endDate:t,onChange:r,singleDateMode:a=false,singleDateField:n="end",isDark:s,locale:o,disabled:l=false,placeholder:c}){let[i,u]=useState(false),[p,d]=useState(n),[m,f]=useState(()=>{let T=n==="start"?e:t;if(T){let V=T instanceof Date?T:new Date(T);return new Date(V.getFullYear(),V.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),v=useRef(null),h=useRef(null),b=useRef(null),[y,x]=useState(null),w=e?e instanceof Date?e:new Date(e):null,k=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let T=V=>{let O=V.target;v.current&&v.current.contains(O)||b.current&&b.current.contains(O)||u(false);};return i&&document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[i]),useLayoutEffect(()=>{if(!i){x(null);return}let T=()=>{let V=h.current?.getBoundingClientRect();if(!V)return;let O=520,X=360,F=window.innerHeight-V.bottom,Fe=F<X&&V.top>F,U=Fe?V.top-4:V.bottom+4,De=Math.min(Math.max(V.left,8),window.innerWidth-O-8);x({top:U,left:De,flipUp:Fe});};return T(),window.addEventListener("scroll",T,true),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,true),window.removeEventListener("resize",T);}},[i]),useEffect(()=>{i&&d(a?n:"start");},[i,a,n]);let M=T=>T?T.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",I=useCallback(()=>{let T=m.getFullYear(),V=m.getMonth(),O=new Date(T,V,1),F=new Date(T,V+1,0).getDate(),Fe=O.getDay(),U=[],B=new Date(T,V,0).getDate();for(let Me=Fe-1;Me>=0;Me--)U.push({date:new Date(T,V-1,B-Me),isCurrentMonth:false});for(let Me=1;Me<=F;Me++)U.push({date:new Date(T,V,Me),isCurrentMonth:true});let z=42-U.length;for(let Me=1;Me<=z;Me++)U.push({date:new Date(T,V+1,Me),isCurrentMonth:false});return U},[m]),C=T=>{if(a)n==="start"?r(T,k||void 0):r(w||void 0,T),u(false);else if(p==="start"){let V=k&&T>k?T:k;r(T,V||void 0),d("end");}else {let V=w&&T<w?T:w;r(V||void 0,T),u(false);}},N=()=>{let T=new Date,V=new Date(T);V.setDate(T.getDate()+1);let O=new Date(T);O.setDate(T.getDate()+((6-T.getDay()+7)%7||7));let X=new Date(T);X.setDate(T.getDate()+((1-T.getDay()+7)%7||7));let F=new Date(T);F.setDate(T.getDate()+(6-T.getDay()+7)%7+7);let Fe=new Date(T);Fe.setDate(T.getDate()+14);let U=new Date(T);return U.setDate(T.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:T,display:T.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:V,display:V.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:O,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:X,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:F,display:F.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:U,display:U.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let T=a&&n==="start"?w:k;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:M(T)})]})}let P=a&&n==="start"?w:k;return jsxs("div",{ref:v,className:"relative",children:[jsxs("button",{ref:h,onClick:T=>{T.stopPropagation(),u(!i);let V=n==="start"?w:k;V&&f(new Date(V.getFullYear(),V.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:M(P)})]}),i&&y&&createPortal(jsxs("div",{ref:b,className:g("rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),style:{position:"fixed",top:y.flipUp?void 0:y.top,bottom:y.flipUp?window.innerHeight-y.top:void 0,left:y.left,zIndex:10001},onClick:T=>T.stopPropagation(),children:[jsxs("div",{className:g("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[N().map((T,V)=>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:()=>C(T.date),children:[jsx("span",{children:T.label}),jsx("span",{className:g("text-xs",s?"text-white/30":"text-gray-400"),children:T.display})]},V)),jsx("div",{className:g("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{a?n==="start"?r(void 0,k||void 0):r(w||void 0,void 0):r(void 0,void 0),u(false);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!a&&jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:p==="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(T=>jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:T},T))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:I().map((T,V)=>{let O=T.date.toDateString()===new Date().toDateString(),X=w?.toDateString()===T.date.toDateString(),F=k?.toDateString()===T.date.toDateString(),Fe=X||F,U=!a&&w&&k&&T.date>=w&&T.date<=k;return jsx("button",{onClick:()=>C(new Date(T.date)),className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!T.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),T.isCurrentMonth&&(s?"text-white":"text-gray-900"),O&&"ring-2 ring-[#00E5CC]",X&&"bg-[#00E5CC] text-white",F&&!X&&"bg-[#7C3AED] text-white",U&&!Fe&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!Fe&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:T.date.getDate()},V)})})]})]}),document.body)]})}function wl({value:e,onChange:t,isDark:r,locale:a,disabled:n=false,dateField:s="end",startDate:o,endDate:l}){let c=e?e instanceof Date?e:new Date(e):null;return jsx(Lg,{startDate:s==="start"?c:o||null,endDate:s==="end"?c:l||null,onChange:(d,m)=>{t&&t(s==="start"?d:m);},singleDateMode:true,singleDateField:s,isDark:r,locale:a,disabled:n||!t,placeholder:"-"})}function hs(e=600){let[t,r]=useState(false),a=useRef(null),n=useCallback(()=>{a.current&&clearTimeout(a.current),r(true),a.current=setTimeout(()=>{r(false);},e);},[e]);return useEffect(()=>()=>{a.current&&clearTimeout(a.current);},[]),{isFlashing:t,triggerFlash:n}}function kl(e,t={}){let{enabled:r=true,duration:a=400,steps:n=8}=t,[s,o]=useState(e),[l,c]=useState(false),i=useRef(e),u=useRef([]);return useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!r||e===i.current||e===void 0){o(e),i.current=e;return}let p=i.current??0,d=e,m=d-p,f=a/n;c(true);for(let v=1;v<=n;v++){let h=setTimeout(()=>{let b=v/n,y=1-Math.pow(1-b,3),x=Math.round(p+m*y);o(x),v===n&&(c(false),o(d));},f*v);u.current.push(h);}return i.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,r,a,n]),{displayValue:s,isAnimating:l}}function Ag(e,t={}){let{delay:r=1500,onCancel:a}=t,[n,s]=useState(null),[o,l]=useState(0),c=useRef(null),i=useRef(null),u=useCallback(m=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(m),l(0);let f=Date.now();i.current=setInterval(()=>{let v=Date.now()-f,h=Math.min(v/r*100,100);l(h);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(m),s(null),l(0);},r);},[r,e]),p=useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),l(0),a?.();},[a]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:u,cancelChange:p}}function Rg({value:e=0,onChange:t,isDark:r,disabled:a=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,l]=useState(false),[c,i]=useState(""),u=useRef(null),{isFlashing:p,triggerFlash:d}=hs(),{displayValue:m,isAnimating:f}=kl(e,{enabled:n,duration:300,steps:6}),v=w=>{if(a||!t)return;w.stopPropagation();let k=w.currentTarget.getBoundingClientRect(),M=w.clientX-k.left,I=Math.round(M/k.width*100),C=Math.max(0,Math.min(100,I));C!==e&&(t(C),s&&d());},h=useCallback(w=>{a||!t||(w.stopPropagation(),i(String(e)),l(true));},[a,t,e]);useEffect(()=>{o&&u.current&&(u.current.focus(),u.current.select());},[o]);let b=useCallback(()=>{l(false);let w=parseInt(c,10);if(!isNaN(w)&&t){let k=Math.max(0,Math.min(100,w));k!==e&&(t(k),s&&d());}},[c,t,e,s,d]),y=useCallback(w=>{w.key==="Enter"&&b(),w.key==="Escape"&&l(false);},[b]),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&&(r?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[x>0?jsx("div",{onClick:v,className:g("flex-1 h-2 rounded-full overflow-hidden",r?"bg-white/[0.05]":"bg-gray-200",!a&&t&&"cursor-pointer"),children:jsx("div",{className:g("h-full rounded-full transition-[width]",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:u,value:c,onChange:w=>i(w.target.value.replace(/[^0-9]/g,"")),onBlur:b,onKeyDown:y,maxLength:3,className:g("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",r?"bg-white/10 border-white/20 text-white focus:border-[#00E5CC]":"bg-white border-gray-300 text-gray-900 focus:border-[#00E5CC]")}),jsx("span",{className:g("text-xs font-mono",r?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:h,className:g("text-xs w-8 text-right tabular-nums font-mono rounded px-1",x===0?r?"text-[#6B7280]":"text-gray-400":r?"text-white/60":"text-gray-500",!a&&t&&"cursor-pointer hover:bg-white/[0.08]",f&&"font-medium scale-105"),title:!a&&t?"Click to edit":void 0,children:[x,"%"]})]})}function Og({value:e="",onChange:t,isDark:r,placeholder:a="-",disabled:n=false}){let[s,o]=useState(false),[l,c]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{c(e);},[e]);let u=()=>{l!==e&&t?.(l),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",r?"text-white/60":"text-gray-500"),children:e||a}):s?jsx("input",{ref:i,type:"text",value:l,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",r?"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",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(r?"text-white/30":"text-gray-400")),children:e||a})}function Wg({value:e,onChange:t,isDark:r,placeholder:a="-",min:n,max:s,disabled:o=false,enableSlotMachine:l=true,enableSaveFlash:c=true}){let[i,u]=useState(false),[p,d]=useState(e?.toString()||""),m=useRef(null),{isFlashing:f,triggerFlash:v}=hs(),{displayValue:h,isAnimating:b}=kl(e,{enabled:l&&!i});useEffect(()=>{i&&m.current&&(m.current.focus(),m.current.select());},[i]),useEffect(()=>{d(e?.toString()||"");},[e]);let y=()=>{let w=parseFloat(p);if(!isNaN(w)){let k=w;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=w=>{w.key==="Enter"?y():w.key==="Escape"&&(d(e?.toString()||""),u(false));};return o||!t?jsx("span",{className:g("text-sm font-mono",r?"text-white/60":"text-gray-500",b&&"font-medium"),children:h!==void 0?h:a}):i?jsx("input",{ref:m,type:"number",value:p,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",r?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:w=>{w.stopPropagation(),u(true);},className:g("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",h===void 0&&(r?"text-white/30":"text-gray-400"),f&&(r?"bg-green-500/30":"bg-green-500/20"),b&&"font-medium scale-105"),children:h!==void 0?h:a})}function zg({value:e,options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false}){let[o,l]=useState(false),c=useRef(null),i=uo(c,o,220);return useEffect(()=>{let u=p=>{c.current&&!c.current.contains(p.target)&&l(false);};return o&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[o]),s||!r?jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:e||n}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:u=>{u.stopPropagation(),l(!o);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:g("text-sm flex-1 text-left truncate",a?"text-white/60":"text-gray-500",!e&&(a?"text-white/30":"text-gray-400")),children:e||n}),jsx(ChevronDown,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")})]}),o&&jsx("div",{className:g("absolute z-50 left-0 "+(i?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:g("px-3 py-2 text-sm",a?"text-white/30":"text-gray-400"),children:"No options"}):t.map(u=>jsxs("button",{onClick:p=>{p.stopPropagation(),r(u),l(false);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===u&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:a?"text-white":"text-gray-900",children:u}),e===u&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},u))})]})}function Vg({value:e=false,onChange:t,isDark:r,disabled:a=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:l,progress:c,startChange:i,cancelChange:u}=Ag(t,{delay:s}),p=m=>{m.stopPropagation(),!a&&t&&(n?l?u():i(!e):t(!e));},d=l?o:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:p,disabled:a||!t,className:g("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",d?"bg-[#00E5CC] border-[#00E5CC]":r?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(a||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&d&&"ring-green-500/50",l&&!d&&"ring-red-500/50",l&&(r?"ring-offset-[#050505]":"ring-offset-white")),children:[l&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:d?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):d?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsx("button",{onClick:m=>{m.stopPropagation(),u();},className:g("w-4 h-4 rounded-full flex items-center justify-center transition-colors",r?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsx(X,{className:"w-3 h-3"})})]})}function jg({value:e=[],options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false,maxSelectable:o,maxVisible:l=2}){let[c,i]=useState(false),u=useRef(null),p=uo(u,c,220);useEffect(()=>{let b=y=>{u.current&&!u.current.contains(y.target)&&i(false);};return c&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[c]);let d=e.slice(0,l),m=e.length-d.length,f=e.length===0?n:d.join(", ")+(m>0?` +${m}`:"");if(s||!r)return jsx("span",{className:g("text-sm truncate",a?"text-white/60":"text-gray-500"),children:f});let v=b=>{let y=e.includes(b),x=y?e.filter(w=>w!==b):[...e,b];!y&&o!=null&&e.length>=o||r(x);},h=o!=null&&e.length>=o;return jsxs("div",{ref:u,className:"relative",children:[jsxs("button",{onClick:b=>{b.stopPropagation(),i(!c);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:g("text-sm flex-1 text-left truncate",a?"text-white/60":"text-gray-500",e.length===0&&(a?"text-white/30":"text-gray-400")),children:f}),jsx(ChevronDown,{className:g("w-3 h-3 flex-shrink-0",a?"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",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:g("px-3 py-2 text-sm",a?"text-white/30":"text-gray-400"),children:"No options"}):t.map(b=>{let y=e.includes(b),x=!y&&h;return jsxs("button",{disabled:x,onClick:w=>{w.stopPropagation(),v(b);},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":a?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:a?"text-white":"text-gray-900",children:b}),y&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},b)})})]})}function zk(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 qg({value:e,isDark:t,placeholder:r="-",onOpen:a}){let n=zk(e);if(n.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:r});let s=n[0],o=n.length-1,l=o>0?`${s.name} +${o}`:s.name;return a?jsxs("button",{onClick:c=>{c.stopPropagation(),a(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:l})]}):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"}),l]})}function Jg({value:e=[],isDark:t,maxVisible:r=2}){if(e.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let a=e.slice(0,r),n=e.length-r;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[a.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),n>0&&jsxs("span",{className:g("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",n]})]})}function jk(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let r=Math.floor(e/60),a=e%60;return r===0?`${a}m`:a===0?`${r}h`:`${r}h ${a}m`}function _k(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let r=t.match(/^(\d+):(\d+)$/);if(r&&r[1]&&r[2]){let l=parseInt(r[1],10),c=parseInt(r[2],10);return l*60+c}let a=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(a&&a[1]){let l=parseFloat(a[1]),c=a[2]?parseInt(a[2],10):0;return Math.round(l*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 Ra({value:e,onChange:t,isDark:r,locale:a="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:l=false,lens:c="hours",hourlyRate:i=0,financialOverride:u}){let[p,d]=useState(false),[m,f]=useState(""),v=useRef(null),{isFlashing:h,triggerFlash:b}=hs(),y=c==="financial"&&(i>0||u!=null),x=u??(e?e/60*i:0),w=y&&(u!=null?u>0:e)?`$${Math.round(x).toLocaleString("en-US")}`:jk(e,a);useEffect(()=>{p&&v.current&&(v.current.focus(),v.current.select());},[p]),useEffect(()=>{if(e){let C=Math.floor(e/60),N=e%60;C>0&&N>0?f(`${C}h ${N}m`):C>0?f(`${C}h`):f(`${N}m`);}else f("");},[e,p]);let k=()=>{let C=_k(m);C!==e&&(t?.(C),o&&b()),d(false);},M=C=>{C.key==="Enter"?k():C.key==="Escape"&&d(false);};if(l)return jsxs("div",{className:"flex items-center gap-1.5",title:a==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",r?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let I=y?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsx(I,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm font-mono",r?"text-white/60":"text-gray-500"),children:w})]}):p?jsx("input",{ref:v,type:"text",value:m,onChange:C=>f(C.target.value),onBlur:k,onKeyDown:M,onClick:C=>C.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:C=>{C.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",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?r?"text-white/60":"text-gray-600":r?"text-white/30":"text-gray-400",h&&(r?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(I,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:w})]})}function t0({startDate:e,endDate:t,scheduleVariance:r,isDark:a,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:g("text-[11px] font-mono",a?"text-white/30":"text-gray-400"),children:"-"});let o=c=>c.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),l=()=>{if(r==null)return null;let c=n==="es";return r===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:a?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):r>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",r,"d ",c?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[r,"d ",c?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:g("text-[11px] font-mono",a?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsx("span",{className:a?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),l()]})}function a0({task:e,isDark:t,locale:r="en",onLogTime:a,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:l="hours",hourlyRate:c=0}){let i=r==="es",u=l==="financial"&&c>0,p=U=>u?`$${Math.round(U*c).toLocaleString("en-US")}`:`${U}h`,[d,m]=useState(false),[f,v]=useState(false),[h,b]=useState(null),y=useRef(null),x=e.timeLoggedMinutes||0,w=e.effortMinutes||0,k=e.soldEffortMinutes||0,M=Math.round(x/60*10)/10,I=Math.round(w/60*10)/10,C=w>0?x/w*100:0,N=C>100?Math.round((x-w)/60*10)/10:0,P=C>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!f&&!h)return;let U=De=>{y.current&&!y.current.contains(De.target)&&(v(false),b(null));};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[f,h]);let T=U=>{if(U.stopPropagation(),a&&!n&&!s){b("log");return}if(a||n||s){v(De=>!De),b(null);return}o&&o(e);},V=U=>{v(false),b(U);},O=async(U,De)=>{h==="log"&&a&&U?a(e,U,De):h==="estimate"&&n?n(e,U):h==="quoted"&&s&&s(e,U),b(null);},X=a||n||s||o,F=[{mode:"log",icon:Clock,label:i?"Registrar tiempo":"Log time",show:!!a},{mode:"estimate",icon:Target,label:i?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(U=>U.show),Fe=h==="estimate"?w:h==="quoted"?k:void 0;return w===0&&x===0&&k===0?jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:U=>U.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&&X&&jsx("button",{onClick:T,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:U=>{U.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",U.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:U=>{U.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",U.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:F.map(U=>jsxs("button",{onClick:De=>{De.stopPropagation(),V(U.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:De=>{De.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:De=>{De.target.style.background="transparent";},children:[jsx(U.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),U.label]},U.mode))})}),jsx(AnimatePresence,{children:h&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(Tn,{mode:h,locale:r,isDark:t,currentValue:Fe||void 0,onSave:O,onClose:()=>b(null)})})})})]}):jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:U=>U.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 U=x===0,B=(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:U?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:p(M)}),w>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",p(I)]}),N>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:B?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:B?"rgba(239,68,68,0.15)":"transparent"},children:["+",p(N)," ",i?"Excedido":"Over"]})]})})(),w>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(C,100)}%`,backgroundColor:P,borderRadius:2,transition:"width 0.3s"}})})]}),X&&jsx("button",{onClick:T,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:U=>{U.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",U.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:U=>{U.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",U.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:F.map(U=>jsxs("button",{onClick:De=>{De.stopPropagation(),V(U.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:De=>{De.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:De=>{De.target.style.background="transparent";},children:[jsx(U.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),U.label]},U.mode))})}),jsx(AnimatePresence,{children:h&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(Tn,{mode:h,locale:r,isDark:t,currentValue:Fe||void 0,onSave:O,onClose:()=>b(null)})})})})]})}function Zk(e){let t=new Map;function r(a){if(a.assignees)for(let n of a.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(a.subtasks)for(let n of a.subtasks)r(n);}return r(e),Array.from(t.values())}function e1(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 n0({assignee:e,size:t=28,isDark:r}){let a=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",n=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:g(a,"rounded-full object-cover ring-1 flex-shrink-0",r?"ring-white/10":"ring-gray-200")}):jsx("div",{className:g(a,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,r?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function o0({task:e,isDark:t,locale:r="en"}){let a=r==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let u=Zk(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(n0,{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:a?"Sin asignar":"Unassigned"})]});let l=o?.percentage??0,c=!!o&&l>0,i=c?e1(l):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(n0,{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&&i&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[l,"% LOAD"]})]})}var t1={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function i0({blockers:e,isDark:t,locale:r="en"}){return !e||e.length===0?jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:r==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((a,n)=>jsxs("span",{className:g("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",t1[a.severity]),children:[a.type," #",a.id]},`${a.type}-${a.id}-${n}`))})}function b1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function h1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"blue"}function g0({state:e,onClose:t,isDark:r,locale:a,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:u=[],onOpenTimeLog:p,onReportBlocker:d,onCopyTaskLink:m,onTaskMove:f,onTaskIndent:v,onTaskOutdent:h}){let b=useRef(null),y=a==="es"?d0.es:d0.en,[x,w]=useState({left:e.x,top:e.y});if(useLayoutEffect(()=>{w({left:e.x,top:e.y});let N=b.current;if(!N)return;let P=N.getBoundingClientRect(),T=8,V=e.x,O=e.y;e.y+P.height>window.innerHeight-T&&(O=Math.max(T,e.y-P.height)),e.x+P.width>window.innerWidth-T&&(V=Math.max(T,window.innerWidth-P.width-T)),(V!==e.x||O!==e.y)&&w({left:V,top:O});},[e.x,e.y,e.isOpen]),useEffect(()=>{let N=T=>{b.current&&!b.current.contains(T.target)&&t();},P=T=>{T.key==="Escape"&&t();};return document.addEventListener("mousedown",N),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",P);}},[t]),!e.isOpen)return null;let k=()=>{if(!e.task)return [];let N=[];return n&&N.push({id:"edit",label:y.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),N.push({id:"sep1",label:"",icon:null,separator:true}),l&&(N.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:()=>{l({...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:()=>{l({...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:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),N.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:()=>{l({...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:()=>{l({...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:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:y.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),u.length>0&&N.push({id:"assign",label:y.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(P=>({id:`assign-${P.id}`,label:P.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:P.name.charAt(0).toUpperCase()}),onClick:()=>{let T=e.task.assignees||[],O=T.some(X=>X.name===P.name)?T.filter(X=>X.name!==P.name):[...T,{name:P.name,initials:b1(P.name),color:P.color||h1(P.name),avatar:P.avatarUrl}];l({...e.task,assignees:O}),t();}}))})),p&&N.push({id:"log-time",label:y.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),d&&N.push({id:"report-blocker",label:y.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&N.push({id:"copy-link",label:y.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:y.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||v||h)&&(N.push({id:"sep3",label:"",icon:null,separator:true}),f&&(N.push({id:"move-up",label:y.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),N.push({id:"move-down",label:y.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),v&&N.push({id:"indent",label:y.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{v(e.task.id),t();}}),h&&N.push({id:"outdent",label:y.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),o&&N.push({id:"delete",label:y.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 i&&(N.push({id:"sort-asc",label:y.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),N.push({id:"sort-desc",label:y.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(N.push({id:"sep-hide",label:"",icon:null,separator:true}),N.push({id:"hide",label:y.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),N},I=e.type==="task"?k():M(),C={position:"fixed",left:x.left,top:x.top,zIndex:9999};return jsx("div",{ref:b,style:C,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:I.map(N=>N.separator?jsx("div",{className:g("my-1 h-px",r?"bg-white/[0.05]":"bg-gray-200")},N.id):N.submenu?jsx(y1,{item:N,isDark:r},N.id):jsxs("button",{onClick:N.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",N.danger?"text-red-500 hover:text-red-600":r?"text-white":"text-gray-700"),children:[jsx("span",{className:g(N.danger?"text-red-500":r?"text-white/60":"text-gray-400"),children:N.icon}),N.label]},N.id))})}function y1({item:e,isDark:t}){let[r,a]=useState(false),n=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),a(true);},onMouseLeave:()=>{n.current=setTimeout(()=>a(false),150);},children:[jsxs("button",{className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:g("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),r&&e.submenu&&jsx("div",{className:g("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxs("button",{onClick:l.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:l.icon}),l.label]},l.id))})]})}var d0={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 k0={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"})},R1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function T0({isOpen:e,onClose:t,columns:r,customFields:a=[],onColumnsChange:n,onCreateCustomField:s,mostrarColumnasDensas:o=true,isDark:l,locale:c}){let[i,u]=useState(""),[p,d]=useState(null),[m,f]=useState(null),v=useRef(null),h=c==="es"?C0.es:C0.en;useLayoutEffect(()=>{if(!e||!v.current)return;let N=()=>{if(!v.current)return;let P=v.current.parentElement;if(P){let X=P.getBoundingClientRect();f({top:X.bottom+4,right:window.innerWidth-X.right});}let T=v.current.getBoundingClientRect(),O=window.innerHeight-T.top-20;d(Math.max(300,O));};return requestAnimationFrame(N),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[e]),useEffect(()=>{if(!e)return;let N=setTimeout(()=>{let P=V=>{v.current&&!v.current.contains(V.target)&&t();},T=V=>{V.key==="Escape"&&t();};document.addEventListener("mousedown",P),document.addEventListener("keydown",T),v._cleanup=()=>{document.removeEventListener("mousedown",P),document.removeEventListener("keydown",T);};},100);return ()=>{clearTimeout(N),v._cleanup&&v._cleanup();}},[e,t]);let b=useMemo(()=>{let N=new Set([...R1]);return r.forEach(P=>{P.type&&P.type!=="assignees"&&N.add(P.type);}),Array.from(N)},[r]);if(!e)return null;let y=N=>{let P=h.columns[N];if(P)return P;let T=r.find(V=>V.type===N);return T?.label?T.label:N},x=N=>{if(N==="name")return;let P=r.map(T=>T.id===N?{...T,visible:!T.visible}:T);n(P);},w=(N,P)=>{let T=r.find(O=>O.type===N&&(!P||O.customFieldId===P));if(T){x(T.id);return}let V={id:P||N,type:N,label:P?a.find(O=>O.id===P)?.name||N:y(N),width:120,visible:true,sortable:true,resizable:true,customFieldId:P};n([...r,V]);},k=["effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"],M=b.filter(N=>N!=="assignees"&&(o||!k.includes(N))&&y(N).toLowerCase().includes(i.toLowerCase())),I=a.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),C=l?"#00E5FF":"#00E5CC";return jsxs("div",{ref:v,style:{...p?{maxHeight:`${p}px`}:{},...m?{top:m.top,right:m.right}:{},background:l?"#111114":"#FFFFFF",border:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:l?"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 ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:l?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:h.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",N.currentTarget.style.color=l?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent",N.currentTarget.style.color=l?"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:l?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:i,onChange:N=>u(N.target.value),placeholder:h.searchPlaceholder,style:{fontSize:12,background:l?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:l?"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",C);},onFocus:N=>{N.currentTarget.style.borderColor=C,N.currentTarget.style.background=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:N=>{N.currentTarget.style.borderColor=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",N.currentTarget.style.background=l?"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:l?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:h.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:M.map(N=>{let P=r.find(O=>O.type===N&&!O.customFieldId),T=P?.visible??false,V=N==="name";return jsxs("button",{onClick:()=>{V||(P?x(P.id):w(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:O=>{V||(O.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:O=>{O.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:T?C:"transparent",border:T?`1.5px solid ${C}`:`1.5px solid ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:T?`0 0 6px ${C}40`:"none"},children:T&&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:T?C:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:k0[N]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:T?500:400,color:T?l?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":l?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:y(N),children:y(N)})]},N)})})]}),I.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:l?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:h.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:I.map(N=>{let T=r.find(V=>V.customFieldId===N.id)?.visible??false;return jsxs("button",{onClick:()=>w(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=l?"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:T?C:"transparent",border:T?`1.5px solid ${C}`:`1.5px solid ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:T?`0 0 6px ${C}40`:"none"},children:T&&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:T?C:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:k0[N.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:T?500:400,color:T?l?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":l?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:N.name})]},N.id)})})]})]})]})}var C0={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 V1=[{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 S0({isOpen:e,onClose:t,onSave:r,isDark:a,locale:n}){let[s,o]=useState(""),[l,c]=useState("text"),[i,u]=useState([""]),p=n==="es"?D0.es:D0.en;useEffect(()=>{e&&(o(""),c("text"),u([""]));},[e]),useEffect(()=>{let h=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let d=()=>{if(!s.trim())return;let h={name:s.trim(),type:l};l==="dropdown"&&(h.options=i.filter(b=>b.trim())),r(h),t();},m=()=>{u([...i,""]);},f=(h,b)=>{let y=[...i];y[h]=b,u(y);},v=h=>{i.length>1&&u(i.filter((b,y)=>y!==h));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:g("relative w-full max-w-md rounded-xl shadow-2xl border",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:g("flex items-center justify-between px-6 py-4 border-b",a?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:g("text-lg font-semibold",a?"text-white":"text-gray-900"),children:p.title}),jsx("button",{onClick:t,className:g("p-1 rounded",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:g("w-5 h-5",a?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:p.fieldName}),jsx("input",{type:"text",value:s,onChange:h=>o(h.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",a?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:p.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:V1.map(h=>jsxs("button",{onClick:()=>c(h.type),className:g("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===h.type?"border-[#00E5CC] bg-[#00E5CC]/10":a?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:l===h.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-400",children:h.icon}),jsx("span",{className:g("text-xs",l===h.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-500"),children:p.types[h.type]})]},h.type))})]}),l==="dropdown"&&jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:p.options}),jsxs("div",{className:"space-y-2",children:[i.map((h,b)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:h,onChange:y=>f(b,y.target.value),placeholder:`${p.option} ${b+1}`,className:g("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsx("button",{onClick:()=>v(b),className:g("p-2 rounded-lg transition-colors",a?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},b)),jsxs("button",{onClick:m,className:g("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",a?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),p.addOption]})]})]})]}),jsxs("div",{className:g("flex items-center justify-end gap-3 px-6 py-4 border-t",a?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children: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 D0={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 P0={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 F0({value:e,hideCompleted:t,onChange:r,onHideCompletedChange:a,isDark:n,locale:s}){let[o,l]=useState(false),c=useRef(null),i=useRef(0),u=s==="es"?P0.es:P0.en;useEffect(()=>{if(!o)return;let m=v=>{Date.now()-i.current<100||c.current&&!c.current.contains(v.target)&&l(false);},f=v=>{v.key==="Escape"&&l(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||(i.current=Date.now()),l(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:()=>{r(m.value),a(false),l(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;a(m),m&&r("all"),l(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 L0(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function fo(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function A0({data:e,isDark:t,locale:r="en",onClose:a,lens:n="hours",onUnassignedTaskClick:s}){let o=r==="es",l=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:l?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),a&&jsx("button",{onClick:a,className:g("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),l&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let c=e.totalOffered??0,i=e.totalEstimated??0,u=e.totalExecuted??0,p=c-u,d=c>0?Math.round(p/c*100):0,m=c-i,f=c>0?Math.round(m/c*100):0,v=c>0?Math.min(Math.round(u/c*100),120):0,h=u>c&&c>0,b=h?"#F87171":"#00E5CC";return jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"PRESUPUESTO":"BUDGET"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:fo(c)})]}),(()=>{let y=e.totalEstimatedLabor??0,x=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,k=x>0||w>0,M=(I,C)=>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:I}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:fo(C)})]});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:fo(i)})]}),k&&jsxs(Fragment,{children:[M(o?"Mano de obra":"Labor",y),x>0&&M(o?"Activos":"Equipment",x),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),u>0&&(()=>{let y=e.totalExecutedLabor??0,x=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,k=x>0||w>0,M=(I,C)=>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:I}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:fo(C)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsx("span",{className:g("text-[11px] font-mono font-bold",h?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:fo(u)})]}),k&&jsxs(Fragment,{children:[M(o?"Mano de obra":"Labor",y),x>0&&M(o?"Activos":"Equipment",x),w>0&&M(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:b}})}),i>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?"+":"",fo(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:[p>=0?`+${fo(p)} ${o?"disponible (caja)":"available (cash)"}`:`${fo(Math.abs(p))} ${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,i=e.totalHoursAllocatedMinutes??0,u=i>0?Math.min(Math.round(c/i*100),100):0,m=(i>0?c/i:0)>1.1?"#F87171":u>=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:L0(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:L0(i)})]}),i>0&&jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${u}%`,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,i=c>0,u=c<0,p=e.scheduleVarianceLabel||(i?`+${c} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:u?`${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",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",u&&"bg-[#F87171]/15 text-[#F87171]",!i&&!u&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:p})})()]}),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,i)=>{let u=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:u}})})]},`${c.name}-${i}`)})})]})]})}var oC=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function W0(e,t=0,r=[]){let a=[];for(let n of e){let s=[...r,n.id];a.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&a.push(...W0(n.subtasks,t+1,s));}return a}function sC(e){let t=e.subtasks;if(!t?.length)return null;let r=new Date,a=0,n=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),c=s.endDate.getTime()-o;if(c<=0)continue;let u=Math.max(0,Math.min(r.getTime()-o,c))/c*100;if(u<=0)continue;let p=(s.progress||0)/u;a+=p,n++;}return n>0?a/n:null}function Cs(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,r=0,a=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=Cs(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,r+=s.allocated>0?s.allocated:n.effortMinutes??0,a+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,r+=n.effortMinutes??0,a+=n.soldEffortMinutes??0;return {spent:t,allocated:r,quoted:a}}function ks(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function iC({value:e,onChange:t,isDark:r}){let[a,n]=useState(false),[s,o]=useState(String(e||""));return a?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:l=>l.stopPropagation(),onChange:l=>o(l.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let l=parseFloat(s);!isNaN(l)&&l>=0&&l<=100?t(l):s===""&&t(0),n(false);},onKeyDown:l=>{l.key==="Enter"&&l.target.blur(),l.key==="Escape"&&(o(String(e||"")),n(false));},className:g("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",r?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:l=>{l.stopPropagation(),o(String(e||"")),n(true);},className:g("text-xs font-mono cursor-pointer hover:underline",e>0?r?"text-white/80":"text-gray-700":r?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function U0(e){if(e.length===0)return 0;let t=0,r=0,a=0;for(let l of e){let c=l.weight||0;c>0&&(t+=(l.progress||0)*c,r+=c,a+=1);}let n=a/e.length;if(r>=99&&n>=.95)return Math.round(t/r*10)/10;if(e.reduce((l,c)=>l+(c.effort_minutes||0),0)>0){let l=0,c=0;for(let i of e){let u=i.effort_minutes||60;l+=(i.progress||0)*u,c+=u;}return Math.round(l/c*10)/10}let o=e.reduce((l,c)=>l+(c.progress||0),0);return Math.round(o/e.length*10)/10}function qd(e,t=[]){for(let r of e)r.subtasks&&r.subtasks.length>0?qd(r.subtasks,t):t.push({progress:r.progress||0,weight:r.weight||0,effort_minutes:r.effort_minutes??r.effortMinutes});return t}function z0({tasks:e,config:t={},callbacks:r={},isLoading:a=false,error:n,className:s,style:o,availableUsers:l=[],customFields:c=[],toolbarRightContent:i,onColumnHeaderClick:u,columnsWithFilter:p,filterDotColor:d="#00E5CC"}){let{theme:m="dark",locale:f="en",customTranslations:v,showSearch:h=true,showHierarchy:b=true,tableColumns:y,mostrarIndicadoresFinancieros:x=true,mostrarColumnasDensas:w=true,allowColumnCustomization:k=true,allowColumnResize:M=true,enableContextMenu:I=true,showCreateTaskButton:C=false,onCreateTask:N,persistFilter:P=false,financialBlur:T,healthSidebar:V,lens:O="hours",hourlyRate:X=0,rateMap:F,aggregateParentHours:Fe=false,showProjectTotals:U=false,totalsDollarOverride:De}=t,B=bl(f,v),z=m==="dark",Me=S=>{if(!F||!S.assignees||S.assignees.length===0)return X;let Y=0,re=0;for(let Ce of S.assignees){let We=Ce.id?F[Ce.id]:void 0;if(We==null||We<=0)continue;let oe=typeof Ce.estimatedMinutes=="number"?Ce.estimatedMinutes:0;oe>0&&(Y+=We*oe,re+=oe);}if(re>0)return Y/re;let xe=S.assignees.map(Ce=>Ce.id?F[Ce.id]:void 0).filter(Ce=>Ce!=null&&Ce>0);return xe.length===0?X:xe.reduce((Ce,We)=>Ce+We,0)/xe.length},Ue=S=>{let Y=0,re=0,xe=0,Ce=We=>{for(let oe of We)if(oe.subtasks&&oe.subtasks.length>0){let Te={s:Y,a:re,q:xe};if(Ce(oe.subtasks),Y-Te.s+(re-Te.a)+(xe-Te.q)===0){let at=Me(oe);Y+=(oe.timeLoggedMinutes??0)/60*at,re+=(oe.effortMinutes??0)/60*at,xe+=(oe.soldEffortMinutes??0)/60*at;}}else {let Te=Me(oe);Y+=(oe.timeLoggedMinutes??0)/60*Te,re+=(oe.effortMinutes??0)/60*Te,xe+=(oe.soldEffortMinutes??0)/60*Te;}};return S.subtasks&&Ce(S.subtasks),{dollarSpent:Y,dollarAllocated:re,dollarQuoted:xe}},ce=useCallback(()=>{if(!P||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let S=localStorage.getItem(P);if(S){let Y=JSON.parse(S);return {statusFilter:Y.statusFilter||"all",hideCompleted:Y.hideCompleted||!1}}}catch(S){console.error("Error loading persisted filter:",S);}return {statusFilter:"all",hideCompleted:false}},[P]),Le=useMemo(()=>{function S(Y){let re=0,xe=0,Ce=0,We=0,oe=0,Te=0;for(let Ke of Y)if(Ke.subtasks&&Ke.subtasks.length>0){let at=S(Ke.subtasks);if(at.spent+at.allocated+at.quoted>0)re+=at.spent,xe+=at.allocated,Ce+=at.quoted,We+=at.dollarSpent,oe+=at.dollarAllocated,Te+=at.dollarQuoted;else {let mt=Ke.timeLoggedMinutes??0,gt=Ke.effortMinutes??0,mr=Ke.soldEffortMinutes??0;re+=mt,xe+=gt,Ce+=mr;let kr=Me(Ke);We+=mt/60*kr,oe+=gt/60*kr,Te+=mr/60*kr;}}else {let at=Ke.timeLoggedMinutes??0,nt=Ke.effortMinutes??0,mt=Ke.soldEffortMinutes??0;re+=at,xe+=nt,Ce+=mt;let gt=Me(Ke);We+=at/60*gt,oe+=nt/60*gt,Te+=mt/60*gt;}return {spent:re,allocated:xe,quoted:Ce,dollarSpent:We,dollarAllocated:oe,dollarQuoted:Te}}return S(e)},[e]),J=useMemo(()=>{let S=new Map;function Y(re){let xe=0;for(let Ce of re)if(Ce.subtasks&&Ce.subtasks.length>0){let We=Y(Ce.subtasks);S.set(Ce.id,We),xe+=We;}else xe+=Ce.weight||0;return xe}return Y(e),S},[e]),Pe=useMemo(()=>!V?.enabled||!V.data?V:{...V,data:{...V.data,totalHoursSpentMinutes:Le.spent,totalHoursAllocatedMinutes:Le.allocated}},[V,Le]),[Ee,$e]=useState(true),[He,et]=useState(null),[se,_e]=useState("position"),[qe,Re]=useState("asc"),[ut,Et]=useState(""),[Ge,Ie]=useState(()=>ce().statusFilter),[dt,Mt]=useState(()=>ce().hideCompleted),[Be,vt]=useState(y||oC),[L,Q]=useState(false),[R,_]=useState(false),[ue,ve]=useState({isOpen:false,x:0,y:0,type:"task"}),[Oe,ye]=useState(null),[ft,ie]=useState(false),[ge,Ze]=useState(null),[Xe,kt]=useState(null),[Je,At]=useState(null),Yt=useRef(0),pr=useRef(false),It=!!(r.onTaskMove||r.onTaskReparent),[Ur,Ht]=useState(null),[vr,jt]=useState(null),or=S=>{let Y=S.type;return S.customFieldId?Y==="file"?null:{kind:"customField",fieldId:S.customFieldId}:Y==="assignees"||Y==="teamLoad"?"assignees":Y==="startDate"?"startDate":Y==="endDate"?"endDate":null},ha=(S,Y)=>typeof S=="string"||typeof Y=="string"?S===Y:S.fieldId===Y.fieldId,pa=useRef([]),tt=useCallback((S,Y)=>{It&&(Y.preventDefault(),Yt.current=Y.clientY,ye(S),pr.current=false,ie(false),At({x:Y.clientX,y:Y.clientY}));},[It]),Ye=useCallback(S=>{if(!Oe||(Math.abs(S.clientY-Yt.current)>5&&!pr.current&&(pr.current=true,ie(true)),At({x:S.clientX,y:S.clientY}),!pr.current))return;let re=document.querySelectorAll("[data-listview-row]"),xe=null,Ce=null;re.forEach(We=>{let oe=We.getBoundingClientRect(),Te=We.getAttribute("data-listview-row");if(Te&&Te!==Oe&&S.clientY>=oe.top&&S.clientY<=oe.bottom){xe=Te;let Ke=S.clientY-oe.top,at=oe.height;Ce=Ke<at*.25?"above":Ke>at*.75?"below":"child";}}),Ze(xe),kt(Ce);},[Oe]),ea=useCallback(()=>{if(pr.current&&Oe&&ge&&Xe){if(Xe==="child"&&r.onTaskReparent)r.onTaskReparent(Oe,ge);else if(Xe==="above"||Xe==="below"){let S=(xe,Ce,We=null)=>{for(let oe of xe){if(oe.id===Ce)return We;if(oe.subtasks){let Te=S(oe.subtasks,Ce,oe.id);if(Te!==void 0)return Te}}},Y=S(e,Oe,null),re=S(e,ge,null);if(r.onTaskReparent){let xe=(at,nt)=>{if(nt===null)return at;for(let mt of at){if(mt.id===nt)return mt.subtasks||[];if(mt.subtasks){let gt=xe(mt.subtasks,nt);if(gt.length>0||mt.subtasks.some(mr=>mr.id===nt))return gt}}return []},Ce=xe(e,re??null),We=Ce.findIndex(at=>at.id===ge),oe=Y===re,Te=oe?Ce.findIndex(at=>at.id===Oe):-1,Ke=Xe==="below"?We+1:We;oe&&Te!==-1&&Te<We&&(Ke-=1),r.onTaskReparent(Oe,re??null,Math.max(0,Ke));}}}ye(null),Ze(null),kt(null),At(null),pr.current=false,ie(false);},[Oe,ge,Xe,e,r]),_r=(S,Y)=>typeof Y!="string"?S.customFields?.find(xe=>xe.fieldId===Y.fieldId)?.value:Y==="assignees"?S.assignees:Y==="startDate"?S.startDate:S.endDate,sa=(S,Y,re,xe)=>{S.preventDefault(),S.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let Ce=Array.from(document.querySelectorAll("[data-listview-row]")),We=Ce.map(yt=>yt.getAttribute("data-listview-row")||""),oe=Math.max(0,We.indexOf(Y)),Te=yt=>We.slice(oe,yt+1);jt({sourceTaskId:Y,column:re,sourceIndex:xe,targetIndex:xe,rangeIds:new Set([Y])});let at=(yt=>{let Ft=yt?.parentElement??null;for(;Ft;){let Ta=window.getComputedStyle(Ft).overflowY;if((Ta==="auto"||Ta==="scroll")&&Ft.scrollHeight>Ft.clientHeight)return Ft;Ft=Ft.parentElement;}let Lr=document.scrollingElement;return Lr&&Lr.scrollHeight>Lr.clientHeight?Lr:null})(S.currentTarget),nt=yt=>{let Ft=oe,Lr=false;Ce.forEach((Ta,Cr)=>{let Yr=Ta.getBoundingClientRect();yt>=Yr.top&&yt<=Yr.bottom&&(Ft=Cr,Lr=true);});let xa=Ce[Ce.length-1];if(!Lr&&xa){let Ta=xa.getBoundingClientRect();yt>Ta.bottom&&(Ft=Ce.length-1);}return Ft<oe&&(Ft=oe),Ft},mt=S.clientY,gt=null,mr=()=>{gt!==null&&(cancelAnimationFrame(gt),gt=null);},kr=()=>{let yt=nt(mt),Ft=new Set(Te(yt));jt(Lr=>Lr&&{...Lr,targetIndex:yt,rangeIds:Ft});},zr=()=>{if(mr(),!at)return;let yt=at,Lr=yt===document.scrollingElement?{top:0,bottom:window.innerHeight}:yt.getBoundingClientRect(),xa=60,Ta=12,Cr=mt-Lr.top,Yr=Lr.bottom-mt,vo=yt.scrollHeight-yt.clientHeight;if(Yr<xa&&yt.scrollTop<vo){let Ss=Math.max(1,Math.round(Ta*(1-Math.max(0,Yr)/xa))),wo=()=>{yt.scrollTop+=Ss,kr(),yt.scrollTop<yt.scrollHeight-yt.clientHeight&&(gt=requestAnimationFrame(wo));};gt=requestAnimationFrame(wo);}else if(Cr<xa&&yt.scrollTop>0){let Ss=Math.max(1,Math.round(Ta*(1-Math.max(0,Cr)/xa))),wo=()=>{yt.scrollTop-=Ss,kr(),yt.scrollTop>0&&(gt=requestAnimationFrame(wo));};gt=requestAnimationFrame(wo);}},Ut=yt=>{mt=yt.clientY,kr(),zr();},Gt=yt=>{window.removeEventListener("mousemove",Ut),window.removeEventListener("mouseup",Gt),mr(),document.body.style.cursor="",document.body.style.userSelect="",jt(null);let Ft=nt(yt.clientY),Lr=new Map(pa.current.map(Yr=>[Yr.id,Yr])),xa=Lr.get(Y);if(!xa)return;let Ta=_r(xa,re),Cr=[];for(let Yr of Te(Ft)){if(Yr===Y)continue;let vo=Lr.get(Yr);vo&&(vo.subtasks&&vo.subtasks.length>0||Cr.push(Yr));}Cr.length>0&&r.onBulkFill?.(Cr,re,Ta);};window.addEventListener("mousemove",Ut),window.addEventListener("mouseup",Gt);},wr=S=>vr?vr.rangeIds.has(S):false;useEffect(()=>{if(Oe)return document.addEventListener("mousemove",Ye),document.addEventListener("mouseup",ea),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Ye),document.removeEventListener("mouseup",ea),document.body.style.cursor="",document.body.style.userSelect="";}},[Oe,Ye,ea]);let[Wr,le]=useState("all"),[de,pt]=useState(false),j=useRef(null),be=useRef(null),te=useMemo(()=>{let S=0;function Y(re,xe){for(let Ce of re)xe>S&&(S=xe),Ce.subtasks?.length&&Y(Ce.subtasks,xe+1);}return Y(e,1),S},[e]);useEffect(()=>{if(!de)return;let S=Y=>{j.current?.contains(Y.target)||be.current?.contains(Y.target)||pt(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[de]),useEffect(()=>{if(Wr==="all"){let re=function(xe){for(let Ce of xe)Ce.subtasks?.length&&(Ce.isExpanded===false&&r.onTaskToggleExpand?.(Ce.id),re(Ce.subtasks));};re(e);}else {let re=function(xe,Ce){for(let We of xe)if(We.subtasks?.length){let oe=Ce<Wr,Te=We.isExpanded!==false;oe!==Te&&r.onTaskToggleExpand?.(We.id),re(We.subtasks,Ce+1);}};re(e,1);}},[Wr]);let[$,ee]=useState(null),[ke,D]=useState(0),[W,pe]=useState(0),we=useRef(null),[rt,fe]=useState(null),[q,it]=useState(null);useEffect(()=>{y&&vt(S=>{if(S.length===y.length){let Y=true;for(let re=0;re<S.length;re++){let xe=S[re],Ce=y[re];if(!xe||!Ce||xe.id!==Ce.id||xe.visible!==Ce.visible||xe.width!==Ce.width||xe.label!==Ce.label){Y=false;break}}if(Y)return S}return y});},[y]),useEffect(()=>{if(!(!P||typeof window>"u"))try{localStorage.setItem(P,JSON.stringify({statusFilter:Ge,hideCompleted:dt}));}catch(S){console.error("Error persisting filter state:",S);}},[P,Ge,dt]);let bt=useMemo(()=>{let S=new Set;function Y(re){for(let xe of re)xe.subtasks?.length&&(xe.isExpanded!==false&&S.add(xe.id),Y(xe.subtasks));}return Y(e),S},[e]),Pt=useMemo(()=>Be.filter(S=>S.visible),[Be]),Zt=useCallback(S=>{r.onTaskToggleExpand?.(S);},[r]),ya=useCallback(S=>{se===S?Re(Y=>Y==="asc"?"desc":"asc"):(_e(S),Re("asc")),r.onSortChange?.({column:S,direction:qe==="asc"?"desc":"asc"});},[se,qe,r]),Kr=useCallback(S=>{vt(S),r.onColumnsChange?.(S);},[r]),Za=useCallback(S=>{let Y=Be.map(re=>re.id===S?{...re,visible:false}:re);Kr(Y);},[Be,Kr]),er=useCallback((S,Y)=>{_e(S),Re(Y);},[]),yo=useCallback((S,Y,re)=>{I&&(S.preventDefault(),ve({isOpen:true,x:S.clientX,y:S.clientY,type:Y?"task":"header",task:Y,columnId:re}));},[I]),Vn=useCallback(()=>{ve(S=>({...S,isOpen:false}));},[]),Wa=useCallback((S,Y)=>{if(!M)return;S.preventDefault(),S.stopPropagation();let re=Be.find(xe=>xe.id===Y);re&&(ee(Y),D(S.clientX),pe(re.width));},[Be,M]);useEffect(()=>{if(!$)return;let S=Be,Y=xe=>{let Ce=xe.clientX-ke,We=Math.max(50,W+Ce);S=S.map(oe=>oe.id===$?{...oe,width:We}:oe),vt(S);},re=()=>{r.onColumnsChange?.(S),ee(null);};return document.addEventListener("mousemove",Y),document.addEventListener("mouseup",re),()=>{document.removeEventListener("mousemove",Y),document.removeEventListener("mouseup",re);}},[$,ke,W,r]);let jn=useCallback((S,Y)=>{if(Y==="name"){S.preventDefault();return}fe(Y),S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",Y),S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="0.5");},[]),_n=useCallback(S=>{S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="1"),fe(null),it(null);},[]),bi=useCallback((S,Y)=>{S.preventDefault(),Y!=="name"&&(S.dataTransfer.dropEffect="move",it(Y));},[]),_o=useCallback(()=>{it(null);},[]),hi=useCallback((S,Y)=>{if(S.preventDefault(),!rt||rt===Y||Y==="name")return;let re=[...Be],xe=re.findIndex(oe=>oe.id===rt),Ce=re.findIndex(oe=>oe.id===Y);if(xe===-1||Ce===-1)return;let We=re.splice(xe,1);We[0]&&(re.splice(Ce,0,We[0]),Kr(re),fe(null),it(null));},[rt,Be,Kr]),qr=useCallback(async S=>{if(r.onCreateCustomField){let Y={...S,id:`cf_${Date.now()}`,projectId:""};await r.onCreateCustomField(Y);}_(false);},[r]),xo=useCallback(S=>S.progress===100||S.status==="completed"?"completed":S.progress&&S.progress>0||S.status==="in-progress"?"in-progress":"todo",[]),ma=useMemo(()=>{let S=W0(e);if(ut.trim()){let Y=ut.toLowerCase();S=S.filter(re=>re.name.toLowerCase().includes(Y));}if(Ge!=="all"){let Y=new Set(S.filter(re=>xo(re)===Ge).flatMap(re=>re.parentPath));S=S.filter(re=>Y.has(re.id));}if(dt){let Y=new Set(S.filter(re=>xo(re)!=="completed").flatMap(re=>re.parentPath));S=S.filter(re=>Y.has(re.id));}return S.sort((Y,re)=>{let xe,Ce;switch(se){case "name":xe=Y.name.toLowerCase(),Ce=re.name.toLowerCase();break;case "startDate":xe=Y.startDate?.getTime()||0,Ce=re.startDate?.getTime()||0;break;case "endDate":xe=Y.endDate?.getTime()||0,Ce=re.endDate?.getTime()||0;break;case "progress":xe=Y.progress||0,Ce=re.progress||0;break;case "status":xe=Y.status||"todo",Ce=re.status||"todo";break;case "priority":let We={urgent:0,high:1,medium:2,low:3,none:4};xe=We[Y.priority]??4,Ce=We[re.priority]??4;break;case "position":return 0;default:return 0}return xe<Ce?qe==="asc"?-1:1:xe>Ce?qe==="asc"?1:-1:0}),S},[e,ut,Ge,dt,se,qe,xo]);pa.current=ma;let za=useCallback((S,Y)=>{let re=We=>{r.onTaskUpdate?.({...S,...We});},xe=We=>We?S.customFields?.find(Te=>Te.fieldId===We)?.value:void 0,Ce=(We,oe)=>{if(!We)return;let Ke=[...S.customFields||[]],at=Ke.findIndex(nt=>nt.fieldId===We);at>=0?Ke[at]={fieldId:We,value:oe}:Ke.push({fieldId:We,value:oe}),re({customFields:Ke});};switch(Y.type){case "name":return null;case "status":return jsx(Tg,{value:S.status||(S.progress===100?"completed":S.progress&&S.progress>0?"in-progress":"todo"),onChange:oe=>{re({status:oe,progress:oe==="completed"?100:oe==="in-progress"?50:0});},isDark:z,locale:f,translations:B.status});case "priority":return jsx(Dg,{value:S.priority,onChange:oe=>re({priority:oe}),isDark:z,locale:f});case "assignees":{let oe=S.hasChildren,Te=S.assignees||[];if(oe&&S.subtasks?.length){let Ke=new Map,at=nt=>{(nt||[]).forEach(mt=>{(mt.assignees||[]).forEach(gt=>{Ke.has(gt.name)||Ke.set(gt.name,gt);}),mt.subtasks?.length&&at(mt.subtasks);});};at(S.subtasks),Te=Array.from(Ke.values());}else oe&&(Te=[]);return jsx(xl,{value:Te,availableUsers:l,onChange:Ke=>re({assignees:Ke}),isDark:z,locale:f,disabled:oe})}case "startDate":return jsx(wl,{value:S.startDate,onChange:oe=>re({startDate:oe}),isDark:z,locale:f,dateField:"start",startDate:S.startDate,endDate:S.endDate});case "endDate":return jsx(wl,{value:S.endDate,onChange:oe=>re({endDate:oe}),isDark:z,locale:f,dateField:"end",startDate:S.startDate,endDate:S.endDate});case "progress":{let oe=!!(S.subtasks&&S.subtasks.length>0),Te=oe?U0(qd(S.subtasks||[])):S.progress||0;return jsx(Rg,{value:Te,onChange:oe?void 0:Ke=>{let at=Ke===100?"completed":Ke>0?"in-progress":"todo";re({progress:Ke,status:at});},isDark:z,disabled:oe})}case "tags":return jsx(Jg,{value:S.tags||[],isDark:z});case "text":return jsx(Og,{value:xe(Y.customFieldId)||"",onChange:oe=>Ce(Y.customFieldId,oe),isDark:z});case "number":return jsx(Wg,{value:xe(Y.customFieldId)||0,onChange:oe=>Ce(Y.customFieldId,oe),isDark:z});case "date":let We=xe(Y.customFieldId);return jsx(wl,{value:We?new Date(We):void 0,onChange:oe=>Ce(Y.customFieldId,oe),isDark:z,locale:f});case "dropdown":return jsx(zg,{value:xe(Y.customFieldId)||"",options:Y.options||[],onChange:oe=>Ce(Y.customFieldId,oe),isDark:z});case "checkbox":return jsx(Vg,{value:xe(Y.customFieldId)||false,onChange:oe=>Ce(Y.customFieldId,oe),isDark:z});case "multiselect":return jsx(jg,{value:xe(Y.customFieldId)||[],options:Y.options||[],onChange:oe=>Ce(Y.customFieldId,oe),isDark:z,maxSelectable:Y.maxSelectable});case "person":{let oe=xe(Y.customFieldId)||[];return jsx(xl,{value:oe.map(Te=>({name:Te.name,avatar:Te.avatar,initials:Te.initials||(Te.name||"?").slice(0,2).toUpperCase(),color:Te.color||"#00E5CC"})),availableUsers:l,onChange:Te=>Ce(Y.customFieldId,Te),isDark:z,locale:f})}case "file":return jsx(qg,{value:xe(Y.customFieldId),isDark:z,onOpen:oe=>{oe.url&&window.open(oe.url,"_blank","noopener,noreferrer");}});case "estimatedTime":{let oe=S.status==="completed"||S.progress===100;return jsx(Ra,{value:S.estimatedTime,onChange:Te=>re({estimatedTime:Te}),isDark:z,locale:f,disabled:oe,lens:O,hourlyRate:Me(S)})}case "quotedTime":{let oe=S.status==="completed"||S.progress===100,Te=T?.enabled&&(!T.columns||T.columns.includes("quotedTime"));return jsx(Ra,{value:S.quotedTime,onChange:Ke=>re({quotedTime:Ke}),isDark:z,locale:f,disabled:oe,isBlurred:Te,lens:O,hourlyRate:Me(S)})}case "elapsedTime":{let oe=S.status==="completed"||S.progress===100,Te=S.executedDollarsCanonical;return jsx(Ra,{value:S.elapsedTime,onChange:Ke=>re({elapsedTime:Ke}),isDark:z,locale:f,disabled:oe,lens:O,hourlyRate:Me(S),financialOverride:Te})}case "effortMinutes":{if(Fe&&S.subtasks&&S.subtasks.length>0){let{allocated:nt}=Cs(S);if(O==="financial"){let mt=Ue(S),gt=Math.round(mt.dollarAllocated),mr=Math.round(mt.dollarQuoted),kr=mr-gt;return jsxs("div",{className:"flex flex-col",children:[gt>0?jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",gt.toLocaleString("es-CO")]}):null,kr!==0&>>0&&mr>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",kr>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[kr>0?"+":"",Math.abs(kr)>=1e3?`$${(kr/1e3).toFixed(1)}K`:`$${kr}`]})]})}return jsx(Ra,{value:nt>0?nt:void 0,isDark:z,locale:f,disabled:true,lens:O,hourlyRate:X})}let oe=S.status==="completed"||S.progress===100,Te=S.effortMinutes||0,Ke=S.soldEffortMinutes||0,at=Me(S);if(O==="financial"&&at&&Te>0&&Ke>0){let nt=Math.round(Te/60*at),gt=Math.round(Ke/60*at)-nt;return jsxs("div",{className:"flex flex-col",children:[jsx(Ra,{value:Te,onChange:mr=>re({effortMinutes:mr}),isDark:z,locale:f,disabled:oe,lens:O,hourlyRate:Me(S)}),gt!==0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",gt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[gt>0?"+":"",Math.abs(gt)>=1e3?`$${(gt/1e3).toFixed(1)}K`:`$${gt}`]})]})}return jsx(Ra,{value:Te,onChange:nt=>re({effortMinutes:nt}),isDark:z,locale:f,disabled:oe,lens:O,hourlyRate:Me(S)})}case "timeLoggedMinutes":{let oe=S.executedDollarsCanonical;if(Fe&&S.subtasks&&S.subtasks.length>0){let{spent:Ke}=Cs(S);return jsx(Ra,{value:Ke>0?Ke:void 0,isDark:z,locale:f,disabled:true,lens:O,hourlyRate:Me(S),financialOverride:oe})}let Te=S.status==="completed"||S.progress===100;return jsx(Ra,{value:S.timeLoggedMinutes,onChange:r.onLogTime?Ke=>{r.onLogTime?.(S,Ke);}:void 0,isDark:z,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:Te,lens:O,hourlyRate:Me(S),financialOverride:oe})}case "soldEffortMinutes":{if(Fe&&S.subtasks&&S.subtasks.length>0){let{quoted:Ke}=Cs(S),at=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx(Ra,{value:Ke>0?Ke:void 0,isDark:z,locale:f,disabled:true,isBlurred:at,lens:O,hourlyRate:Me(S)})}let oe=S.status==="completed"||S.progress===100,Te=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx(Ra,{value:S.soldEffortMinutes,onChange:Ke=>re({soldEffortMinutes:Ke}),isDark:z,locale:f,disabled:oe,isBlurred:Te,lens:O,hourlyRate:Me(S)})}case "scheduleVariance":{let oe=S.effortMinutes||0,Te=S.soldEffortMinutes||0,Ke=S.timeLoggedMinutes||0,at=oe>0||Te>0||Ke>0;return jsx(t0,{startDate:S.startDate,endDate:S.endDate,scheduleVariance:S.scheduleVariance,isDark:z,locale:f,hasTimeAllocated:at})}case "hoursBar":{if(Fe&&S.hasChildren){let{spent:oe,allocated:Te,quoted:Ke}=Cs(S),at=oe>Te&&Te>0;return jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",z?"text-white/50":"text-gray-500"),children:[jsx("span",{className:g("font-bold",at?"text-[#FF453A]":z?"text-white/80":"text-gray-800"),children:ks(oe)}),Te>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:z?"text-white/60":"text-gray-600",children:ks(Te)})]}),Ke>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:z?"text-amber-400/70":"text-amber-600",children:ks(Ke)})]})]})}return jsx(a0,{task:S,isDark:z,locale:f,onLogTime:r.onLogTime,onEstimateUpdate:r.onEstimateUpdate,onSoldEffortUpdate:r.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:r.onOpenTimeLog,lens:O,hourlyRate:Me(S)})}case "teamLoad":return S.hasChildren||S.subtasks&&S.subtasks.length>0?jsx(o0,{task:S,isDark:z,locale:f}):jsx(xl,{value:S.assignees||[],availableUsers:l,onChange:Te=>{r.onTaskUpdate?.({...S,assignees:Te});},isDark:z,locale:f});case "blockers":return jsx(i0,{blockers:S.blockers,isDark:z,locale:f});case "weight":{let oe=J.get(S.id);if(oe!==void 0)return jsx("span",{className:g("text-xs font-mono",oe>0?z?"text-white/50":"text-gray-400":z?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:oe>0?`${Number(oe.toFixed(2))}%`:"\u2014"});let Te=S.weight||0;return jsx(iC,{value:Te,onChange:Ke=>re({weight:Ke}),isDark:z})}default:return jsx("span",{className:g("text-sm",z?"text-white/60":"text-gray-500"),children:"-"})}},[r,z,f,l,B,Fe,J]),en=useCallback(S=>{let re={name:B.columns.name,status:B.columns.status,priority:B.columns.priority,assignees:B.columns.assignees,startDate:B.columns.startDate,endDate:B.columns.endDate,progress:B.columns.progress,tags:B.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:B.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:B.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:B.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:B.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:B.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:B.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:B.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:B.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:B.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:B.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:B.columns.weight||(f==="es"?"Peso":"Weight")}[S.type]||S.label;return typeof re=="string"?re:String(re||S.type)},[B,f]),Kn=useMemo(()=>{let re=Pt.reduce((Ce,We)=>Ce+We.width,0)+(k?48:0),xe={};for(let Ce of Pt)xe[Ce.id]=`${Ce.width/re*100}%`;return xe},[Pt,k]);return a?jsx("div",{className:g("flex-1 flex items-center justify-center",z?"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",z?"text-white/60":"text-gray-600"),children:[B.empty.noTasks,"..."]})]})}):n?jsx("div",{className:g("flex-1 flex items-center justify-center",z?"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",z?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:g("text-sm",z?"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",z?"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",z?"text-white":"text-gray-900"),children:B.empty.noTasks}),jsx("p",{className:g("text-sm",z?"text-white/60":"text-gray-600"),children:B.empty.addFirstTask})]})}):jsxs("div",{ref:we,className:g(z?"bg-[#0D0D0D]":"bg-white",$&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[(()=>{let S=!!t.toolbarContainer,Y=jsx("div",{className:S?"flex items-center":g("flex-shrink-0 px-6 py-4 border-b",z?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:S?"flex items-center gap-2":"flex items-center gap-4",children:[jsx("div",{className:g("text-sm whitespace-nowrap",z?"text-white/60":"text-gray-600"),"data-cuenta-de-tareas":true,children:(()=>{let re=ma.filter(We=>(We.subtasks?.length??0)>0).length,xe=ma.length-re,Ce=f==="es";return jsxs(Fragment,{children:[xe," ",B.pagination.tasks,re>0&&jsxs(Fragment,{children:[" \xB7 ",re," ",Ce?re===1?"tarea padre":"tareas padre":re===1?"parent task":"parent tasks"]})]})})()}),h&&!S&&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",z?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:ut,onChange:re=>Et(re.target.value),placeholder:B.toolbar.searchPlaceholder,className:g("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",z?"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")})]}),!S&&jsx("div",{className:"flex-1"}),i&&jsx("div",{className:"flex items-center gap-2",children:i}),b&&te>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:j,onClick:()=>pt(!de),className:g("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",z?de?"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]":de?"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"}),Wr==="all"?f==="es"?"Todos":"All":`L${Wr}`]}),de&&jsx("div",{ref:be,className:g("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",z?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(te,5)},(re,xe)=>({value:xe+1,label:`L${xe+1}`}))].map(re=>jsxs("button",{onClick:()=>{le(re.value),pt(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",z?Wr===re.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":Wr===re.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:re.label}),Wr===re.value&&jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(re.value)))})]}),jsx(F0,{value:Ge,hideCompleted:dt,onChange:Ie,onHideCompletedChange:Mt,isDark:z,locale:f}),Pe?.enabled&&Pe.data&&!Ee&&jsx("button",{onClick:()=>$e(true),className:g("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",z?"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,C&&N&&!S&&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:B.toolbar.newTask})]})]})});return S?createPortal(Y,t.toolbarContainer):Y})(),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",z?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[It&&jsx("div",{className:"w-5 flex-shrink-0"}),Pt.map(S=>{let Y=S.id!=="name",re=q===S.id&&rt!==S.id;return jsxs("div",{className:g("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",z?"text-white/60":"text-gray-500",Y&&"cursor-grab",S.type!=="name"&&"justify-center",rt===S.id&&"opacity-50",re&&(z?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:Kn[S.id],minWidth:S.minWidth},draggable:Y,onDragStart:Y?xe=>jn(xe,S.id):void 0,onDragEnd:Y?_n:void 0,onDragOver:Y?xe=>bi(xe,S.id):void 0,onDragLeave:Y?_o:void 0,onDrop:Y?xe=>hi(xe,S.id):void 0,onContextMenu:xe=>yo(xe,void 0,S.id),children:[Y&&jsx(GripVertical,{className:g("w-3 h-3 flex-shrink-0 transition-opacity",z?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),u?jsxs("button",{draggable:false,onClick:xe=>{let Ce=xe.currentTarget.getBoundingClientRect();u(S.id,Ce);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[en(S),p?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}}),se===S.id&&jsx(ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):S.sortable?jsxs("button",{draggable:false,onClick:()=>ya(S.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[en(S),p?.includes(S.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",se===S.id&&"text-[#00E5CC]")})]}):jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[en(S),p?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}})]}),M&&S.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:xe=>Wa(xe,S.id),children:jsx("div",{className:g("w-px h-full transition-colors","pointer-events-none",$===S.id?"bg-[#00E5CC] w-0.5":"bg-current opacity-40 group-hover:bg-[#00E5CC] group-hover:opacity-100 group-hover:w-0.5")})})]},S.id)}),k&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:S=>{S.stopPropagation(),Q(Y=>!Y);},className:g("p-0.5 rounded transition-colors",z?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",L&&(z?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(T0,{isOpen:L,onClose:()=>Q(false),columns:Be,customFields:c,mostrarColumnasDensas:w,onColumnsChange:Kr,onCreateCustomField:()=>{Q(false),_(true);},isDark:z,locale:f})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:ma.map((S,Y)=>{let re=bt.has(S.id),xe=Math.min(Y*.01,.2),Ce=S.hasChildren&&S.level===0,We=S.subtasks?.length||0;if(Ce){let{spent:mt,allocated:gt,quoted:mr}=Cs(S),kr=sC(S);return jsxs(motion.div,{"data-task-id":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:xe},className:g("flex items-center border-y cursor-pointer transition-colors duration-500",z?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",He===S.id&&(z?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>r.onTaskClick?.(S),children:[It&&jsx("div",{className:"w-5 flex-shrink-0"}),Pt.map(zr=>jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",zr.type!=="name"&&"justify-center"),style:{width:Kn[zr.id],minWidth:zr.minWidth},children:zr.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{onClick:Ut=>{Ut.stopPropagation(),Zt(S.id);},className:g("p-0.5 rounded flex-shrink-0 mt-0.5",z?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:re?jsx(ChevronDown,{className:g("w-4 h-4",z?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:g("w-4 h-4",z?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:Ut=>{Ut.stopPropagation(),Zt(S.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:re?jsx(FolderOpen,{className:"w-4 h-4",style:{color:z?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:z?"#FFD60A":"#B45309"}})}),S.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:z?"#FFD60A":"#B45309"},children:S.wbsCode}),jsxs("div",{className:"flex flex-col min-w-0",children:[jsx("span",{className:g("text-[13px] font-bold uppercase tracking-wide",z?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:S.name}),jsxs("span",{className:g("text-[10px] font-mono",z?"text-white/30":"text-gray-500"),children:["(",We," ",f==="es"?We===1?"Tarea":"Tareas":We===1?"Item":"Items",")"]}),kr!==null&&x&&jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",kr>=1?"text-[#32D74B] bg-[#32D74B]/10":kr>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",kr.toFixed(2)]})]})]}):zr.type==="timeLoggedMinutes"?O==="financial"?(()=>{let Ut=S.executedDollarsCanonical,Gt=Ut!=null?Math.round(Ut):Math.round(Ue(S).dollarSpent);return Gt>0?jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Gt.toLocaleString("en-US")]}):null})():jsx(Ra,{value:mt>0?mt:void 0,isDark:z,locale:f,disabled:true,lens:O,hourlyRate:Me(S)}):zr.type==="soldEffortMinutes"?O==="financial"?(()=>{let Ut=Ue(S),Gt=Math.round(Ut.dollarQuoted);return Gt>0?jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Gt.toLocaleString("en-US")]}):null})():jsx(Ra,{value:mr>0?mr:void 0,isDark:z,locale:f,disabled:true,lens:O,hourlyRate:Me(S)}):zr.type==="effortMinutes"?O==="financial"?(()=>{let Ut=Ue(S),Gt=Math.round(Ut.dollarAllocated),yt=Math.round(Ut.dollarQuoted),Ft=yt-Gt;return jsxs("div",{className:"flex flex-col",children:[Gt>0?jsxs("span",{className:g("text-sm font-mono",z?"text-white/60":"text-gray-500"),children:["$",Gt.toLocaleString("es-CO")]}):null,Ft!==0&&Gt>0&&yt>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ft>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ft>0?"+":"",Math.abs(Ft)>=1e3?`$${(Ft/1e3).toFixed(1)}K`:`$${Ft}`]})]})})():jsx(Ra,{value:gt>0?gt:void 0,isDark:z,locale:f,disabled:true,lens:O,hourlyRate:Me(S)}):za(S,zr)},zr.id)),k&&jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)}let oe=Oe===S.id,Te=ge===S.id,Ke=Te&&Xe==="above",at=Te&&Xe==="below",nt=Te&&Xe==="child";return jsxs(motion.div,{"data-task-id":S.id,"data-listview-row":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:xe},className:g("flex items-center border-b transition-colors relative group",z?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",He===S.id&&(z?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:oe?.4:1,backgroundColor:nt?z?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:nt?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>r.onTaskClick?.(S),onDoubleClick:()=>r.onTaskDoubleClick?.(S),onContextMenu:mt=>yo(mt,S),onMouseEnter:()=>Ht(S.id),onMouseLeave:()=>Ht(mt=>mt===S.id?null:mt),children:[Ke&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),at&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),It&&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:mt=>tt(S.id,mt),style:{color:z?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),Pt.map(mt=>{let gt=!!(S.subtasks&&S.subtasks.length>0),mr=or(mt),zr=!!mr&&!gt&&Ur===S.id&&!vr,Ut=!!vr&&!!mr&&ha(vr.column,mr)&&wr(S.id);return jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",mt.type!=="name"&&"justify-center"),style:{width:Kn[mt.id],minWidth:mt.minWidth,position:"relative",backgroundColor:Ut?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:Ut?"inset 0 0 0 1px rgba(0, 229, 204, 0.45)":void 0},children:mt.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&S.level>0&&jsx("div",{style:{width:`${S.level*24}px`},className:"flex-shrink-0"}),b&&S.hasChildren&&jsx("button",{onClick:Gt=>{Gt.stopPropagation(),Zt(S.id);},className:g("p-0.5 rounded flex-shrink-0",z?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:re?jsx(ChevronDown,{className:g("w-4 h-4",z?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:g("w-4 h-4",z?"text-white/60":"text-gray-400")})}),b&&!S.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(S.wbsCode||S.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[S.wbsCode&&jsx("span",{className:g("text-[10px] font-mono",z?"text-[#00E5CC]":"text-[#00C4AE]"),children:S.wbsCode}),S.taskCode&&jsx("span",{className:g("text-[10px] font-mono",z?"text-white/40":"text-gray-400"),children:S.taskCode})]}),jsx("span",{className:g("truncate",S.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",S.progress===100?z?"line-through text-white/50":"line-through text-gray-400":S.hasChildren?z?"text-white":"text-gray-900":z?"text-[#D1D5DB]":"text-gray-600"),children:S.name}),S.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${S.tags[0].color}20`,color:S.tags[0].color},children:S.tags[0].name})]})]}):zr&&mr?jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[za(S,mt),jsx("span",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Gt=>sa(Gt,S.id,mr,Y),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}})]}):za(S,mt)},mt.id)}),k&&jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)})}),U&&ma.length>0&&(()=>{let{spent:S,allocated:Y,quoted:re}=Le,xe=Y-S,Ce=xe<0,We=Ce?`+${ks(Math.abs(xe))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${ks(xe)} ${f==="es"?"AHORRADO":"SAVED"}`,oe=O==="financial"&&X>0,Te=De?.breakdown,Ke=!!Te&&((Te.equipment??0)>0||(Te.travel??0)>0),at=Te?.laborSpent!=null?Te.laborSpent:De?.spent!=null?De.spent:Le.dollarSpent,nt=Te?.laborAllocated!=null?Te.laborAllocated:De?.allocated!=null?De.allocated:Le.dollarAllocated,mt=De?.quoted!=null?De.quoted:Le.dollarQuoted,gt=(Ut,Gt)=>{if(oe){let yt=Gt??Ut/60*X;return `$${Math.round(yt).toLocaleString("es-CO")}`}return ks(Ut)},mr=oe?Math.abs(nt-at):0,kr=oe?`+$${mr.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Ce?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:We,zr=oe&&Ke?f==="es"?"solo mano de obra":"labor only":void 0;return jsxs("div",{className:g("flex items-center sticky bottom-0 z-[5]",z?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:z?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[It&&jsx("div",{className:"w-5 flex-shrink-0"}),Pt.map(Ut=>jsx("div",{className:g("flex items-center px-4 py-3",Ut.type!=="name"&&"justify-center"),style:{width:Kn[Ut.id],minWidth:Ut.minWidth},children:Ut.type==="name"?jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:g("text-[11px] font-black uppercase tracking-widest",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),zr&&jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",z?"text-white/35":"text-gray-400"),children:[jsx(Info,{className:"w-2.5 h-2.5"}),zr]})]}):Ut.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",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:gt(S,oe?at:void 0)}),jsx("span",{className:g("text-[11px]",z?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:g("text-[11px]",z?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:gt(Y,oe?nt:void 0)})]}),Y>0&&jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Ce?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:oe?kr:We})]}):Ut.type==="soldEffortMinutes"?jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:re>0?gt(re,oe?mt:void 0):"\u2013"}):Ut.type==="effortMinutes"?(()=>{if(oe&&re>0&&Y>0){let Gt=Math.round(mt),yt=Math.round(nt),Ft=Gt-yt,Lr=Gt>0?Math.round(Ft/Gt*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:gt(Y,nt)}),jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ft>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ft>=0?"+":"",Math.abs(Ft)>=1e3?`$${(Ft/1e3).toFixed(1)}K`:`$${Ft}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Lr,"%)"]})]})]})}return jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Y>0?gt(Y,oe?nt:void 0):"\u2013"})})():Ut.type==="timeLoggedMinutes"?jsx("span",{className:g("text-[12px] font-bold",z?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:S>0?gt(S,oe?at:void 0):"\u2013"}):Ut.type==="progress"?(()=>{let Gt=U0(qd(e||[]));return jsxs("span",{className:g("text-[12px] font-bold font-mono",z?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Gt,"%"]})})():Ut.type==="weight"?(()=>{let Gt=e||[],yt=[],Ft=Cr=>{for(let Yr of Cr)yt.push(Yr),Yr.subtasks?.length&&Ft(Yr.subtasks);};Ft(Gt);let xa=yt.filter(Cr=>!Cr.subtasks?.length||Cr.subtasks.length===0).reduce((Cr,Yr)=>Cr+(Yr.weight||0),0),Ta=Math.abs(xa-100)<.1;return jsxs("span",{className:g("text-[12px] font-bold font-mono",Ta?z?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(xa.toFixed(1)),"%"]})})():jsx("span",{className:g("text-[11px]",z?"text-white/30":"text-gray-300"),children:"\u2013"})},Ut.id)),k&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),ma.length===0&&ut&&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",z?"text-white/30":"text-gray-400")}),jsx("p",{className:g(z?"text-white/60":"text-gray-600"),children:B.empty.noResults})]})})]})}),Pe?.enabled&&Pe.data&&Ee&&jsx(A0,{data:Pe.data,isDark:z,locale:f,onClose:()=>$e(false),lens:t?.lens,onUnassignedTaskClick:S=>{let Y=document.querySelector(`[data-task-id="${S}"]`);Y&&(Y.scrollIntoView({behavior:"smooth",block:"center"}),et(S),setTimeout(()=>et(null),2e3));}})]}),jsx(g0,{state:ue,onClose:Vn,isDark:z,locale:f,onTaskEdit:r.onTaskEdit,onTaskDuplicate:r.onTaskDuplicate,onTaskDelete:r.onTaskDelete,onTaskUpdate:r.onTaskUpdate,onColumnHide:Za,onColumnSort:er,availableUsers:l,onOpenTimeLog:r.onOpenTimeLog,onReportBlocker:r.onReportBlocker,onCopyTaskLink:r.onCopyTaskLink,onTaskMove:r.onTaskMove,onTaskIndent:r.onTaskIndent,onTaskOutdent:r.onTaskOutdent}),ft&&Je&&Oe&&createPortal(jsx("div",{style:{position:"fixed",left:Je.x+12,top:Je.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let Y=Ne.flattenTasks(e).find(re=>re.id===Oe);return Y?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:z?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${z?"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:z?"#e6edf3":"#111827"},children:Y.name})]}):null})()}),document.body),jsx(S0,{isOpen:R,onClose:()=>_(false),onSave:qr,isDark:z,locale:f})]})}var G0=[{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}],V0=[{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"}],j0=[{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 Yd={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"},Xd={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"},Jd={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"},Fl={dark:Yd,light:Xd,neutral:Jd};function _0(e){return Fl[e]||Fl.dark}function Ll(e,t,r,a,n=5){let s=[],o=[],l=e.filter(m=>m.endSerial>=r&&m.startSerial<=a).sort((m,f)=>m.startSerial-f.startSerial||f.endSerial-m.endSerial);for(let m of l){let f=Math.max(m.startSerial,r),v=Math.min(m.endSerial,a),h=0;for(;(s[h]||[]).some(([b,y])=>!(v<b||f>y));)h++;(s[h]=s[h]||[]).push([f,v]),o.push({t:m,s:f,e:v,lane:h,contL:m.startSerial<r,contR:m.endSerial>a});}let c={};for(let m=r;m<=a;m++)c[m]=new Set;o.forEach(m=>{for(let f=m.s;f<=m.e;f++)c[f].add(m.lane);});let i=[],u=[],p={};t.filter(m=>m.serial>=r&&m.serial<=a).forEach(m=>{(p[m.serial]=p[m.serial]||[]).push(m);}),Object.keys(p).forEach(m=>{let f=+m,v=p[f],h=[];for(let b=0;b<n;b++)c[f].has(b)||h.push(b);if(v.length<=h.length)v.forEach((b,y)=>i.push({it:b,day:f,lane:h[y]}));else {let b=Math.max(h.length-1,0);v.slice(0,b).forEach((y,x)=>i.push({it:y,day:f,lane:h[x]})),u.push({day:f,lane:h[b]!=null?h[b]:n-1,count:v.length-b,items:v.slice(b)});}});let d=s.length;return i.forEach(m=>{d=Math.max(d,m.lane+1);}),u.forEach(m=>{d=Math.max(d,m.lane+1);}),{bars:o,chips:i,more:u,laneCount:Math.max(d,1)}}var lC=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],cC=["MON","TUE","WED","THU","FRI","SAT","SUN"];function K0(e){return e==="es"?lC:cC}function q0(e){return (e.getDay()+6)%7}function Y0(e,t){let r=new Date(e,t,1),a=q0(r),n=new Date(e,t,1-a),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},l=p=>{let d=p.getTime()-n.getTime();return Math.floor(d/864e5)+1},c=l(r),i=new Date(e,t+1,0),u=l(i);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:l,monthStartSerial:c,monthEndSerial:u}}function ii(e,t){return q0(e.serialToDate(t))>=5}function dC(e){let t=[],r=(a,n,s)=>{for(let o of a){let l=n||o.id,c=s||o.name;t.push({t:o,phaseId:l,phaseName:c}),o.subtasks?.length&&r(o.subtasks,l,c);}};return r(e,"",""),t}function X0(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function J0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Al(e){let{tasks:t,grid:r,projectColor:a,hourlyRate:n,projectId:s}=e,o=dC(t),l=42,c=[];for(let{t:u,phaseId:p,phaseName:d}of o){let m=X0(u.startDate),f=X0(u.endDate);if(!m||!f)continue;let v=r.dateToSerial(m),h=r.dateToSerial(f);if(h<1||v>l)continue;let b=u.effortMinutes??0,y=Math.round(b/60*10)/10,x=u.costAtCompletion,w=x!=null?J0(x):J0(y*n),k=u.assignees?.[0],M=k?.initials||(k?.name?mC(k.name):void 0),I=u.displayId||u.wbsCode||"",C=pC(I||u.id)?"":I||u.id;c.push({uid:u.id,id:C,name:u.name,projectId:s,color:u.color,startSerial:Math.max(v,1),endSerial:Math.min(h,l),hrs:y,cost:w,critical:!!u.isCriticalPath,who:M,realStart:m,realEnd:f,phaseId:p,phaseName:d});}let i=[];return {calTasks:c,dayItems:i,isEmpty:c.length===0&&i.length===0}}var uC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function pC(e){return uC.test(e)||/^task-\d+/.test(e)}function mC(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 gC=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],fC=["January","February","March","April","May","June","July","August","September","October","November","December"];function Q0(e,t,r){return `${(r==="es"?gC:fC)[t]} ${e}`}var Qd=26,bC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Il({locale:e}){let t=K0(e);return jsx("div",{className:"cal-dow",children:t.map((r,a)=>jsx("div",{className:a>=5?"wknd":"",children:r},r))})}function Rl({bar:e,ws:t,money:r,projColor:a,slotH:n=Qd}){let{t:s}=e,o=e.s-t,l=e.e-e.s+1,c="cal-bar"+(s.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":""),i=r==="$"?s.cost:`${s.hrs}h`,u={"--proj":e.color??s.color??a,left:`calc(${o}/7*100% + 3px)`,width:`calc(${l}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxs("div",{className:c,style:u,children:[s.critical&&l>=3?jsx("span",{className:"cpm-tag",children:"CPM"}):null,s.id?jsx("span",{className:"tk",children:s.id}):null,jsx("span",{className:"nom",children:s.name}),l>=3?jsx("span",{className:"val",children:i}):null]})}function Bl({chip:e,ws:t,slotH:r=Qd}){let a=e.day-t,n=`cal-chip ${e.it.type}`,s={left:`calc(${a}/7*100% + 3px)`,width:"calc(1/7*100% - 6px)",top:`${e.lane*r}px`};return jsxs("div",{className:n,style:s,children:[jsx("span",{className:"ico",children:bC[e.it.type]}),jsx("span",{className:"lbl2",children:e.it.label})]})}function $l({more:e,ws:t,slotH:r=Qd,onClick:a}){let s={left:`calc(${e.day-t}/7*100% + 3px)`,top:`${e.lane*r}px`};return jsxs("div",{className:"cal-more",style:s,role:a?"button":void 0,tabIndex:a?0:void 0,onClick:a?()=>a(e):void 0,children:["+",e.count," m\xE1s"]})}function Z0({projects:e,locale:t="es"}){let r=t==="en";return jsxs("div",{className:"cal-legend",children:[e.map(a=>jsxs("span",{children:[jsx("span",{className:"dot",style:{background:a.color}}),a.id?`${a.id} `:"",a.name]},a.id||a.name)),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," ",r?"Critical path":"Ruta cr\xEDtica"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," ",r?"Milestone":"Hito"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," ",r?"Due date":"Vencimiento"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," ",r?"External event":"Evento externo"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," ",r?"Absence":"Ausencia"]})]})}var vC=[{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 Zd({view:e,onViewChange:t,money:r,onMoneyChange:a,mostrarConmutadorDeDinero:n,projectLabel:s,locale:o="es",enCabecera:l=false,hiddenViews:c=[]}){let i=o==="en",u=vC.filter(p=>!c.includes(p.id));return l?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:`${i?p.en:p.es} (${p.key})`,children:i?p.en:p.es},p.id))}),n!==false&&jsxs("div",{className:"cal-seg",children:[jsx("button",{type:"button",className:r==="$"?"":"on",onClick:()=>a("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:r==="$"?"on":"",onClick:()=>a("$"),children:"$"})]})]}):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:[i?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:r==="$"?"":"on",onClick:()=>a("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:r==="$"?"on":"",onClick:()=>a("$"),children:"$"})]})]})}function ef({monthLabel:e,onPrev:t,onNext:r,onToday:a,layersOpen:n,onToggleLayers:s,layersOff:o,phases:l,phaseFilter:c="all",onPhaseChange:i,locale:u="es",children:p}){let d=o?o.length:0,[m,f]=useState(false),v=useRef(null),h=u==="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 b=c==="all"?h?"Todas":"All":l?.find(y=>y.id===c)?.name??(h?"Todas":"All");return jsxs("div",{className:"cal-toolbar",children:[jsxs("div",{className:"cal-nav-arrows",children:[jsx("button",{type:"button",onClick:t,"aria-label":"Periodo anterior",children:"\u2039"}),jsx("button",{type:"button",onClick:r,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsx("div",{className:"cal-month-label",children:e}),jsx("button",{type:"button",className:"cal-hoy",onClick:a,children:h?"Hoy":"Today"}),jsx("div",{className:"cal-vsep"}),l&&l.length>0&&i?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:h?"Fase":"Phase"})," ",b," \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:()=>{i("all"),f(false);},children:jsx("span",{className:"nm",children:h?"Todas las fases":"All phases"})}),l.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:()=>{i(y.id),f(false);},children:jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.name})},y.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 ",h?"Capas":"Layers"," ",jsxs("span",{className:"n",children:[6-d,"/6"]})]})})]})}var wC=[{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 tf({off:e,onToggle:t}){let r=e||[];return jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:wC.map(a=>{let n=r.includes(a.id);return jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(a.id),children:[jsx("span",{className:"sw",style:{background:a.sw,opacity:n?.3:1}}),jsxs("div",{children:[jsx("div",{className:"nm",children:a.nm}),jsx("div",{className:"sub",children:a.sub})]}),jsx("span",{className:"cal-switch"+(n?"":" on")})]},a.id)})})}var NC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},DC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function af({dayLabel:e,items:t,tasks:r=[],itemValue:a,onClose:n,style:s,locale:o="es"}){let l=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 i=r.length+t.length,p=a||(d=>{switch(d.type){case "hito":return l?"Milestone":"Hito";case "desembolso":return l?"Disb.":"Desemb.";case "deadline":return l?"Due":"Vence";case "aus":return l?"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 ${i} ${l?"items":"elementos"}`,children:[jsx("div",{className:"cal-pop-head",children:jsxs("div",{className:"sup",children:[e," \xB7 ",i," ",l?i===1?"item":"items":i===1?"elemento":"elementos"]})}),jsxs("div",{className:"cal-pop-list",children:[r.map((d,m)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"sw",style:{background:d.swatch}}),d.taskId?jsx("span",{className:"tk",children:d.taskId}):null,jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),d.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:"8px",letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:"3px",padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,jsx("span",{className:"v",children:d.value})]},`t${m}`)),t.map((d,m)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"ico",style:{color:DC[d.type]},children:NC[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 rf={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 nf({monthLabel:e,upcomingMilestones:t=[],locale:r="es",onCreateTask:a}){let n=rf[r]||rf.es;return jsxs("div",{className:"cal-empty",children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:n.title}),jsxs("p",{children:[n.body,jsx("br",{}),jsx("b",{children:e})]}),a?jsx("button",{type:"button",className:"cal-empty-crear",onClick:a,children:n.crear}):null,t.length>0?jsxs("div",{className:"cal-empty-hitos",children:[jsx("div",{className:"hd",children:n.upcoming}),t.map((s,o)=>jsxs("div",{className:"cal-empty-hito",children:[jsx("span",{className:"ic "+(s.type==="deadline"?"rd":"cy"),children:s.type==="deadline"?"\u2691":"\u25C6"}),s.label,jsx("span",{className:"d",children:s.date})]},o))]}):null]})}function sf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function MC(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 of=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function PC(e){return of[e%of.length]}function FC(e){return e>1?"over":e>=.9?"warn":"ok"}var eu="\xA0";function Uo(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function lf(e,t,r){let a=new Map,n=new Set;for(let l of t)l.isWeekend||l.isHoliday||n.add(sf(l.date));if(n.size===0)return a;let s=new Map;e.forEach((l,c)=>{s.set(l.userId,{color:PC(c),initials:MC(l.name)});});let o=new Map;for(let l of e)for(let c of l.dailyEstimated){if(!c.date||!n.has(c.date))continue;o.has(c.date)||o.set(c.date,new Map);let i=o.get(c.date);i.set(l.userId,(i.get(l.userId)??0)+(c.hours||0));}for(let l of n){let c=o.get(l)??new Map,i=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:r}}),u=i.reduce((p,d)=>p+d.hours,0);a.set(l,{assigned:Math.round(u*100)/100,capacity:r*e.length,perPerson:i});}return a}function cf({days:e,capByDay:t,selectedKey:r,onSelectDay:a}){return jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=sf(n.date),o=n.isWeekend||n.isHoliday,l=o?void 0:t.get(s),c=!!l&&l.capacity>0,i=c?l.assigned/l.capacity:0,p="cal-cap-cell "+(o?"off":FC(i))+(r===s?" sel":""),d=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxs("div",{className:p,role:c&&a?"button":void 0,tabIndex:c&&a?0:void 0,title:o?void 0:d,onClick:m=>{!c||!a||a(s,d,m.currentTarget);},onKeyDown:m=>{!c||!a||(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),a(s,d,m.currentTarget));},children:[jsx("div",{className:"nums",children:o||!c?jsx("span",{children:o?"\u2014":`0h${eu}/${eu}\u2014`}):jsxs(Fragment,{children:[jsxs("b",{children:[Uo(l.assigned),"h"]}),jsxs("span",{children:["/",eu,Uo(l.capacity),"h"]})]})}),jsx("div",{className:"cal-cap-track",children:c?jsx("div",{className:"cal-cap-fill",style:{width:Math.min(i*100,100)+"%"}}):null})]},n.serial)})})}function df({dayLabel:e,perPerson:t,onClose:r,style:a}){let n=useRef(null);useEffect(()=>{let i=p=>{p.key==="Escape"&&r();},u=p=>{n.current&&!n.current.contains(p.target)&&r();};return document.addEventListener("keydown",i),document.addEventListener("mousedown",u),()=>{document.removeEventListener("keydown",i),document.removeEventListener("mousedown",u);}},[r]);let s=t.reduce((i,u)=>i+u.hours,0),o=t.reduce((i,u)=>i+u.capacity,0),l=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,...a},children:[jsxs("div",{className:"cal-pop-head",children:[jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxs("div",{className:"tit",style:l?{color:"var(--red)"}:void 0,children:[Uo(s),"h asignadas / ",Uo(o),"h"]}),l?jsx("div",{className:"rng",children:jsxs("b",{children:["+",Uo(c),"h sobre capacidad"]})}):jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsx("div",{children:t.map(i=>{let u=i.capacity>0&&i.hours>i.capacity,p=i.capacity>0?i.capacity:1;return jsxs("div",{className:u?"cal-person-row over":"cal-person-row",children:[jsx("span",{className:"pava",style:{background:i.color},children:i.initials}),jsx("span",{className:"nm",title:i.name,children:i.name}),jsx("div",{className:"cal-person-track",children:jsx("div",{className:"cal-person-fill",style:{width:Math.min(i.hours/p*100,100)+"%"}})}),jsxs("span",{className:"hrs",children:[Uo(i.hours),"h / ",Uo(i.capacity),"h"]})]},i.name)})})]})}var tu=28,AC=182;function pf({grid:e,weeks:t,tasks:r,items:a,money:n,projColor:s,todaySerial:o,locale:l,capRows:c,teamSize:i,onTaskOpen:u,onMore:p,onCapDay:d}){let m=l==="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(IC,{grid:e,ws:f.ws,we:f.we,tasks:r,items:a,money:n,projColor:s,todaySerial:o,onTaskOpen:u,onMore:p}),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",i!=null?` \xB7 ${i} ${m?i===1?"persona":"personas":i===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 IC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:l,onTaskOpen:c,onMore:i}){let u=useMemo(()=>Ll(a,n,t,r),[a,n,t,r]),p=useMemo(()=>new Set(n.filter(f=>f.type==="deadline").map(f=>f.serial)),[n]),d=[];for(let f=t;f<=r;f++)d.push(f);let m={height:`${AC}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),h=f>=e.monthStartSerial&&f<=e.monthEndSerial,b="cal-day";return ii(e,f)&&(b+=" wknd"),h||(b+=" out"),f===l&&(b+=" today"),p.has(f)&&(b+=" deadline-day"),jsx("div",{className:b,children:jsx("span",{className:"cal-day-num",children:v.getDate()})},f)})}),jsxs("div",{className:"cal-items",children:[u.bars.map((f,v)=>jsx("div",{onClick:()=>c?.(f.t.uid),style:{cursor:c?"pointer":"default",display:"contents"},children:jsx(Rl,{bar:f,ws:t,money:s,projColor:o,slotH:tu})},`b${v}`)),u.chips.map((f,v)=>jsx(Bl,{chip:f,ws:t,slotH:tu},`c${v}`)),u.more.map((f,v)=>jsx($l,{more:f,ws:t,slotH:tu,onClick:()=>i(f.day,f.items,a.filter(h=>h.startSerial<=f.day&&h.endSerial>=f.day))},`m${v}`))]})]})}var RC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function BC(e){return RC.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 mf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function OC(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function gf(e,t){let r=OC(e),a=[];for(let n of r){if(n.startDate&&n.endDate)continue;let s=n.effortMinutes??0,o=Math.round(s/60*10)/10,l=n.costAtCompletion,c=l!=null?mf(l):mf(o*t),i=n.assignees?.[0],u=i?.initials||(i?.name?$C(i.name):void 0),p=n.displayId||n.wbsCode||"",d=BC(p||n.id)?"":p||n.id;a.push({taskId:n.id,id:d,name:n.name,hrs:o,cost:c,who:u,projColor:n.color});}return a}function ff({items:e,onItemClick:t,onCollapse:r,money:a,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:r,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(l=>{let c=a==="$"?l.cost:`${l.hrs}h`;return jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(l.taskId),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),t(l.taskId));},children:[jsxs("div",{className:"row1",children:[l.id?jsx("span",{className:"tk",children:l.id}):null,jsx("span",{className:"pdot",style:{background:l.projColor||n}})]}),jsx("div",{className:"nom",children:l.name}),jsxs("div",{className:"meta",children:[jsxs("span",{children:[jsxs("b",{children:[l.hrs,"h"]})," est"]}),jsx("span",{children:c}),l.who?jsx("span",{className:"cal-ava",children:l.who}):null]})]},l.taskId)})]})}function bf({onExpand:e,locale:t="es"}){let r=t==="en";return jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),e());},title:r?"Expand backlog":"Expandir backlog",children:[jsx("span",{className:"pc",children:"\u27E8"}),jsx("span",{className:"dot"}),jsxs("span",{className:"vtxt",children:["Backlog \xB7 ",r?"Status":"Estado"]})]})}function Ns(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function hf({taskName:e,taskId:t,sim:r,busy:a,locale:n,onConfirm:s,onCancel:o,style:l}){let c=useRef(null),i=n==="es";useEffect(()=>{let f=v=>{v.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let u=r.wasCritical,p=r.projectEndDeltaDays,d=p>0?`+${p} ${i?p===1?"d\xEDa":"d\xEDas":p===1?"day":"days"} \xB7 ${Ns(r.oldProjectEnd,n)} \u2192 ${Ns(r.newProjectEnd,n)}`:`+0 ${i?"d\xEDas":"days"}${r.slackDays>0?` \xB7 ${i?"holgura":"slack"} ${r.slackDays}d`:""}`,m=p>0?i?`Confirmar +${p} ${p===1?"d\xEDa":"d\xEDas"}`:`Confirm +${p} ${p===1?"day":"days"}`:i?"Confirmar movimiento":"Confirm move";return jsxs("div",{ref:c,className:"cal-pop",style:{width:"324px",zIndex:60,...l},role:"dialog",children:[jsxs("div",{className:"cal-pop-head",children:[jsx("div",{className:"sup",children:i?"Confirmar movimiento":"Confirm move"}),jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxs("div",{className:"rng",children:[Ns(r.oldStart,n)," \u2013 ",Ns(r.oldEnd,n)," \u2192 ",jsxs("b",{children:[Ns(r.newStart,n)," \u2013 ",Ns(r.newEnd,n)]})]})]}),u?jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",i?"Esta tarea est\xE1 en ruta cr\xEDtica":"This task is on the critical path"]}):null,jsxs("div",{className:"cal-impact",children:[jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Tareas sucesoras movidas":"Successor tasks moved"}),jsx("span",{className:"v",children:r.movedSuccessors.length===0?i?"Ninguna":"None":`${r.movedSuccessors.length}${r.movedSuccessors.length<=2?" \xB7 "+r.movedSuccessors.map(f=>f.name).join(", "):""}`})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Fin de proyecto":"Project end"}),jsx("span",{className:p>0?"v bad":"v good",children:d})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Ruta cr\xEDtica":"Critical path"}),jsx("span",{className:"v",children:r.stillCritical?i?"Sigue en CPM":"Stays critical":r.wasCritical?i?"Sale de CPM":"Leaves critical":i?`No entra \xB7 holgura ${r.slackDays}d`:`Not critical \xB7 slack ${r.slackDays}d`})]})]}),jsxs("div",{className:"cal-pop-actions",children:[jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:a,children:i?"Cancelar":"Cancel"}),jsx("button",{type:"button",className:u||p>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:a,children:a?i?"Guardando\u2026":"Saving\u2026":m})]})]})}var zC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function yf({grid:e,tasks:t,items:r,money:a,projColor:n,todaySerial:s,locale:o,onTaskOpen:l}){let c=o==="es",i=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 r)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,r,e]);if(i.length===0)return jsxs("div",{className:"cal-empty",style:{position:"static",padding:"60px 24px"},children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children: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:i.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:()=>l?.(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:a==="$"?d.cost:`${d.hrs}h`})]},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:zC[d.type]??"\xB7"}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label})]},`it${m}`))]},p.serial))})}function GC(e){let t=[],r=a=>a.forEach(n=>{t.push(n),n.subtasks?.length&&r(n.subtasks);});return r(e),t}function Ol(e){let t=e.dependencies;return Array.isArray(t)?t.map(r=>typeof r=="string"?r:r?.id).filter(r=>!!r):[]}function ru(e){let t=e.startDate?new Date(e.startDate):null,r=e.endDate?new Date(e.endDate):null;return !t||!r?1:Math.max(1,Math.round((r.getTime()-t.getTime())/864e5))}function xf(e,t){let r=new Map(e.map(i=>[i.id,i])),a=new Map;for(let i of e)for(let u of Ol(i))a.has(u)||a.set(u,[]),a.get(u).push(i.id);let n=new Map,s=new Map,o=new Set,l=i=>{if(s.has(i))return s.get(i);if(o.has(i))return s.get(i)??0;o.add(i);let u=r.get(i);if(!u)return o.delete(i),0;let p=Ol(u).filter(f=>r.has(f)),d=t.has(i)?t.get(i):u.startDate?new Date(u.startDate).getTime():0;for(let f of p){let v=l(f);v>d&&(d=v);}let m=ru(u)*864e5;return n.set(i,d),s.set(i,d+m),o.delete(i),s.get(i)};for(let i of e)l(i.id);let c=0;return s.forEach(i=>{i>c&&(c=i);}),{finish:s,start:n,projectEnd:c}}function vf(e,t,r){let a=new Map(e.map(c=>[c.id,c])),n=new Map;for(let c of e)for(let i of Ol(c))n.has(i)||n.set(i,[]),n.get(i).push(c.id);let s=new Map,o=[...e].sort((c,i)=>(t.get(i.id)??0)-(t.get(c.id)??0));for(let c of o){let i=n.get(c.id)??[];if(i.length===0)s.set(c.id,r);else {let u=1/0;for(let p of i){let d=s.get(p),m=a.get(p);d!=null&&m&&(u=Math.min(u,d-ru(m)*864e5));}s.set(c.id,u===1/0?r:u);}}let l=new Set;for(let c of e){let i=(s.get(c.id)??0)-(t.get(c.id)??0);Math.abs(i)<864e5/2&&Ol(c).length+(n.get(c.id)?.length??0)>0&&l.add(c.id);}return l}function Hl(e,t,r,a){let n=GC(e),s=n.find(b=>b.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),l=new Date(s.endDate),c=xf(n,new Map),i=vf(n,c.finish,c.projectEnd),u=n.map(b=>b.id===t?{...b,startDate:r,endDate:a}:b),p=xf(u,new Map([[t,r.getTime()]])),d=vf(u,p.finish,p.projectEnd),m=new Map(u.map(b=>[b.id,b])),f=[];for(let b of n){if(b.id===t)continue;let y=c.start.get(b.id),x=p.start.get(b.id);if(y!=null&&x!=null&&Math.abs(x-y)>=864e5/2){let w=ru(m.get(b.id))*864e5;f.push({id:b.id,name:b.name,newStart:new Date(x),newEnd:new Date(x+w)});}}let v=Math.round((p.projectEnd-c.projectEnd)/864e5),h=i.has(t)?0:Math.max(0,Math.round((c.projectEnd-(c.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:l,newStart:r,newEnd:a,movedSuccessors:f,projectEndDeltaDays:v,oldProjectEnd:new Date(c.projectEnd),newProjectEnd:new Date(p.projectEnd),wasCritical:i.has(t),stillCritical:d.has(t),slackDays:h}}function wf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var KC=132,Ul=26,qC="#5B7FD4";function kf({tasks:e,projectName:t,projectId:r,projectColor:a,locale:n,themeMode:s,hourlyRate:o,money:l,onMoneyChange:c,onTaskOpen:i,toolbarContainer:u,hiddenViews:p,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:m,onCreateTask:f,canReschedule:v,onReschedule:h,members:b=[],holidayDates:y=[],timesheetSettings:x,onVisibleRangeChange:w}){let[k,M]=useState("mes"),[I,C]=useState(()=>{let ie=new Date,ge={y:ie.getFullYear(),m:ie.getMonth()},Ze=(e??[]).map(Je=>Je.startDate?new Date(Je.startDate):null).filter(Je=>!!Je&&!isNaN(Je.getTime()));if(Ze.length===0||(e??[]).some(Je=>{let At=Je.startDate?new Date(Je.startDate):null,Yt=Je.endDate?new Date(Je.endDate):At;if(!At||isNaN(At.getTime()))return false;let pr=new Date(ge.y,ge.m,1),It=new Date(ge.y,ge.m+1,0,23,59,59);return At<=It&&(Yt??At)>=pr}))return ge;let kt=Ze.reduce((Je,At)=>Je<At?Je:At);return {y:kt.getFullYear(),m:kt.getMonth()}}),[N,P]=useState(false),[T,V]=useState([]),[O,X]=useState("all"),[F,Fe]=useState(null),[U,De]=useState(null),[B,z]=useState(false),[Me,Ue]=useState(null),[ce,Le]=useState(false),J=useMemo(()=>Y0(I.y,I.m),[I.y,I.m]),Pe=a||qC,Ee=useMemo(()=>{let ie=new Set;for(let ge of y){let Ze=new Date(`${ge}T12:00:00`),Xe=J.dateToSerial(Ze);Xe>=1&&Xe<=42&&ie.add(Xe);}return ie},[y,J]);useEffect(()=>{w?.({start:wf(J.serialToDate(1)),end:wf(J.serialToDate(42))});},[I.y,I.m]);let $e=b.length,He=useMemo(()=>{let ie=x?.hoursPerDay;if(!ie)return 8;let ge=[ie.monday,ie.tuesday,ie.wednesday,ie.thursday,ie.friday].map(Ze=>Ze||0).filter(Ze=>Ze>0);return ge.length?Math.round(ge.reduce((Ze,Xe)=>Ze+Xe,0)/ge.length*10)/10:8},[x]),et=useMemo(()=>Al({tasks:e,grid:J,projectColor:()=>Pe,hourlyRate:o,projectId:r}),[e,J,Pe,o,r]),se=useMemo(()=>{if(d===false)return [];let ie=new Map;for(let ge of et.calTasks)ge.phaseId&&ge.phaseName&&ie.set(ge.phaseId,ge.phaseName);return [...ie.entries()].map(([ge,Ze])=>({id:ge,name:Ze})).sort((ge,Ze)=>ge.name.localeCompare(Ze.name))},[et.calTasks,d]),_e=!T.includes("tareas"),qe=!T.includes("cpm"),Re=useMemo(()=>{let ie=_e?et.calTasks:[];return O!=="all"&&(ie=ie.filter(ge=>ge.phaseId===O)),qe||(ie=ie.map(ge=>ge.critical?{...ge,critical:false}:ge)),ie},[et.calTasks,_e,qe,O]),ut=useMemo(()=>{let ie=new Set;return T.includes("hitos")&&(ie.add("hito"),ie.add("desembolso")),T.includes("ext")&&ie.add("ext"),T.includes("aus")&&ie.add("aus"),et.dayItems.filter(ge=>!ie.has(ge.type))},[et.dayItems,T]),Et=!T.includes("festivos"),Ge=new Date,Ie=J.dateToSerial(new Date(Ge.getFullYear(),Ge.getMonth(),Ge.getDate())),dt=ie=>V(ge=>ge.includes(ie)?ge.filter(Ze=>Ze!==ie):[...ge,ie]),Mt=()=>C(ie=>{let ge=new Date(ie.y,ie.m-1,1);return {y:ge.getFullYear(),m:ge.getMonth()}}),Be=()=>C(ie=>{let ge=new Date(ie.y,ie.m+1,1);return {y:ge.getFullYear(),m:ge.getMonth()}}),vt=()=>{let ie=new Date;C({y:ie.getFullYear(),m:ie.getMonth()});},L=(ie,ge,Ze)=>{if(!v||ge===0)return;let Xe=et.calTasks.find(pr=>pr.uid===ie);if(!Xe)return;let kt=ge*864e5,Je=new Date(Xe.realStart.getTime()+kt),At=new Date(Xe.realEnd.getTime()+kt),Yt=Hl(e,ie,Je,At);Yt&&Ue({uid:ie,taskId:Xe.id,taskName:Xe.name,sim:Yt,anchor:Ze});},Q=async()=>{if(!Me||!h)return;Le(true);let ie=[{id:Me.uid,startDate:Me.sim.newStart,endDate:Me.sim.newEnd},...Me.sim.movedSuccessors.map(Ze=>({id:Ze.id,startDate:Ze.newStart,endDate:Ze.newEnd}))],ge=await h(ie);Le(false),ge&&Ue(null);},R=Q0(I.y,I.m,n),_=[{id:"",name:t,color:Pe}],ue=useMemo(()=>gf(e,o),[e,o]),ve=useMemo(()=>{if(k==="lookahead"){let ie=J.weeks.find(Ze=>Ie>=Ze.ws&&Ie<=Ze.we)??J.weeks[0],ge=J.weeks.indexOf(ie);return J.weeks.slice(ge,ge+2)}return k==="semana"?[J.weeks.find(ge=>Ie>=ge.ws&&Ie<=ge.we)??J.weeks[0]]:[]},[k,J.weeks,Ie]),Oe=useMemo(()=>{let ie={};return ve.forEach((ge,Ze)=>{let Xe=[];for(let Je=ge.ws;Je<=ge.we;Je++)Xe.push({serial:Je,date:J.serialToDate(Je),isWeekend:ii(J,Je),isHoliday:Ee.has(Je)});let kt=lf(b,Xe,He);ie[Ze]={days:Xe,capByDay:kt};}),ie},[ve,J,Ee,b,He]),ye=k==="semana"||k==="lookahead",ft=k==="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(Zd,{enCabecera:true,hiddenViews:p,view:k,onViewChange:M,money:l==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:ie=>c(ie==="$"?"$":"Hrs"),projectLabel:t,locale:n})}),u):jsx(Zd,{view:k,onViewChange:M,money:l==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:ie=>c(ie==="$"?"$":"Hrs"),projectLabel:t,locale:n,hiddenViews:p}),jsx(ef,{monthLabel:R,onPrev:Mt,onNext:Be,onToday:vt,layersOpen:N,onToggleLayers:()=>P(ie=>!ie),layersOff:T,phases:se,phaseFilter:O,onPhaseChange:X,locale:n,children:N?jsx(tf,{off:T,onToggle:dt}):null}),jsxs("div",{className:"cal-body",children:[jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:ft?"hidden":void 0},children:[ft?jsx(yf,{grid:J,tasks:Re,items:ut,money:l,projColor:Pe,todaySerial:Ie,locale:n,onTaskOpen:i}):ye?jsxs(Fragment,{children:[jsx(Il,{locale:n}),jsx(pf,{grid:J,weeks:ve,tasks:Re,items:ut,money:l,projColor:Pe,todaySerial:Ie,locale:n,capRows:Oe,teamSize:$e,onTaskOpen:i,onMore:(ie,ge,Ze)=>Fe({day:ie,items:ge,tasks:Ze}),onCapDay:(ie,ge,Ze)=>{for(let Xe of Object.keys(Oe)){let kt=Oe[+Xe].capByDay.get(ie);if(kt){De({dayLabel:ge,perPerson:kt.perPerson,anchor:Ze.getBoundingClientRect()});break}}}})]}):et.isEmpty?jsxs(Fragment,{children:[jsx(Il,{locale:n}),jsx("div",{className:"cal-weeks",children:J.weeks.map(ie=>jsx(Cf,{grid:J,ws:ie.ws,we:ie.we,todaySerial:Ie,showFestivos:Et,holidaySerials:Ee,locale:n,deadlineDays:new Set},ie.ws))}),jsx(nf,{monthLabel:R,locale:n,onCreateTask:f})]}):jsxs(Fragment,{children:[jsx(Il,{locale:n}),jsx("div",{className:"cal-weeks",children:J.weeks.map(ie=>jsx(YC,{grid:J,ws:ie.ws,we:ie.we,tasks:Re,items:ut,money:l,projColor:Pe,todaySerial:Ie,showFestivos:Et,holidaySerials:Ee,locale:n,onTaskOpen:i,onMore:(ge,Ze,Xe)=>Fe({day:ge,items:Ze,tasks:Xe}),canReschedule:v,onDragReschedule:L,pendingGhost:Me?{uid:Me.uid,days:Math.round((Me.sim.newStart.getTime()-Me.sim.oldStart.getTime())/864e5)}:null},ie.ws))})]}),F?jsx(af,{dayLabel:`${J.serialToDate(F.day).getDate()}`,items:F.items,tasks:F.tasks.map(ie=>({swatch:Pe,taskId:ie.id,label:ie.name,critical:ie.critical,value:l==="$"?ie.cost:`${ie.hrs}h`})),onClose:()=>Fe(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40},locale:n==="en"?"en":"es"}):null,U?jsx(df,{dayLabel:U.dayLabel,perPerson:U.perPerson,onClose:()=>De(null),style:{position:"fixed",top:`${U.anchor.top-8}px`,left:`${U.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,Me?jsx(hf,{taskName:Me.taskName,taskId:Me.sim.taskId,sim:Me.sim,busy:ce,locale:n,onConfirm:Q,onCancel:()=>Ue(null),style:{position:"fixed",top:`${Me.anchor.top+12}px`,left:`${Math.min(Me.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),B?jsx(ff,{items:ue,money:l,projColor:Pe,onItemClick:ie=>i?.(ie),onCollapse:()=>z(false),locale:n==="en"?"en":"es"}):jsx(bf,{onExpand:()=>z(true),locale:n==="en"?"en":"es"})]}),jsx(Z0,{projects:_,locale:n==="en"?"en":"es"})]})}function Cf({grid:e,ws:t,we:r,todaySerial:a,showFestivos:n,holidaySerials:s,deadlineDays:o}){let l=[];for(let c=t;c<=r;c++)l.push(c);return jsx("div",{className:"cal-week-bg",children:l.map(c=>{let i=e.serialToDate(c),u=c>=e.monthStartSerial&&c<=e.monthEndSerial,p=n&&s.has(c),d="cal-day";return ii(e,c)&&(d+=" wknd"),p&&(d+=" festivo"),u||(d+=" out"),c===a&&(d+=" today"),o.has(c)&&(d+=" deadline-day"),jsxs("div",{className:d,children:[jsx("span",{className:"cal-day-num",children:i.getDate()}),p?jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},c)})})}function YC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:l,showFestivos:c,holidaySerials:i,locale:u,onTaskOpen:p,onMore:d,canReschedule:m,onDragReschedule:f,pendingGhost:v}){let h=useMemo(()=>Ll(a,n,t,r),[a,n,t,r]),b=useMemo(()=>new Set(n.filter(I=>I.type==="deadline").map(I=>I.serial)),[n]),y=Math.max(KC,h.laneCount*Ul+36),x=useRef(null),[w,k]=useState(null),M=(I,C)=>{if(!m||!f){p?.(C);return}I.preventDefault();let N=x.current;if(!N)return;let P=N.getBoundingClientRect().width/7,T=I.clientX,V=0,O=F=>{let Fe=Math.round((F.clientX-T)/P);V=Fe,k({id:C,days:Fe});},X=F=>{if(window.removeEventListener("pointermove",O),window.removeEventListener("pointerup",X),k(null),V===0){p?.(C);return}let Fe=new DOMRect(F.clientX,F.clientY,0,0);f(C,V,Fe);};window.addEventListener("pointermove",O),window.addEventListener("pointerup",X);};return jsxs("div",{ref:x,className:"cal-week",style:{minHeight:`${y}px`},children:[jsx(Cf,{grid:e,ws:t,we:r,todaySerial:l,showFestivos:c,holidaySerials:i,locale:u,deadlineDays:b}),jsxs("div",{className:"cal-items",children:[h.bars.map((I,C)=>{let N=w?.id===I.t.uid?w.days:null,P=v?.uid===I.t.uid?v.days:null,T=N??P??0,V=N==null&&P!=null,O=T!==0?{...I,s:I.s+T,e:I.e+T}:I;return jsx("div",{onPointerDown:X=>M(X,I.t.uid),style:{cursor:m?"grab":p?"pointer":"default",display:"contents",opacity:V?.6:1},children:jsx(Rl,{bar:O,ws:t,money:s,projColor:o,slotH:Ul})},`b${C}`)}),h.chips.map((I,C)=>jsx(Bl,{chip:I,ws:t,slotH:Ul},`c${C}`)),h.more.map((I,C)=>jsx($l,{more:I,ws:t,slotH:Ul,onClick:()=>d(I.day,I.items,a.filter(N=>N.startSerial<=I.day&&N.endSerial>=I.day))},`m${C}`))]})]})}function JC({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:l}){let[c,i]=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(b=>b.assignedUserIds||[])).size,v=u.map(b=>b.priority).filter(Boolean),h=new Set(u.flatMap(b=>b.labels||[])).size;return {totalCards:m,uniqueAssignees:f,priorities:v,labels:h}},[u]),d=()=>{n?.(e.id);};return jsxs("div",{className:g("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick: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:[r?jsx("div",{onClick:()=>a?.(m),children:r(m)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(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 Nf={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 di(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 Df(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 Sf({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:s,config:o,className:l}){let c=useMemo(()=>({...Nf,...o}),[o]),[i,u]=useState(new Set),p=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],k=y.get(w);k?k.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((k,M)=>M.timestamp.getTime()-k.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=>{u(x=>{let w=new Set(x);return w.has(y)?w.delete(y):w.add(y),w});},h=y=>{let w=new Date().getTime()-y.getTime(),k=Math.floor(w/6e4),M=Math.floor(w/36e5),I=Math.floor(w/864e5);return k<1?"just now":k<60?`${k}m ago`:M<24?`${M}h ago`:I<7?`${I}d ago`:y.toLocaleDateString()},b=useMemo(()=>{let y=0;return t.types&&t.types.length>0&&y++,t.users&&t.users.length>0&&y++,t.dateRange&&y++,t.searchTerm&&y++,y},[t]);return useEffect(()=>{if(s&&p.current){let y=p.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:g("history-timeline-empty",l),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:g("history-timeline",c.compact&&"compact",l),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:y=>{let x=y.target.value;r({...t,types:x?[x]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),f.map(y=>jsxs("option",{value:y,children:[di(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;r({...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=>r({...t,searchTerm:y.target.value})})]}),b>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:a,children:["Clear filters (",b,")"]})]}),jsx("div",{className:"history-timeline-container",ref:p,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 k=i.has(x.id),M=s===x.id,I=Df(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:I},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:di(x.type)})}),w<y.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:I}})]}),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?h(x.timestamp):x.timestamp.toLocaleString()})]}),Object.keys(x.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),v(x.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(x.changes).map(([C,N])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[C,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(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)})]})]},C)),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(([C,N])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[C,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(N)})]},C))]})]})]})]},x.id)})})]},y.date?.toISOString()||"all"))})]})}function Mf({replayState:e,events:t,onStartReplay:r,onStopReplay:a,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:l,onSpeedChange:c,className:i}){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",i),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:g("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:p&&di(p.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:p&&ci(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=>l(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:()=>l(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: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:a,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children: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",i),children:[jsxs("button",{className:"history-replay-start-button",onClick:r,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function nu(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 ou(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 Pf(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 Ff(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function a2(e,t,r,a,n,s=100){let o=e.map(c=>({...c,x:c.x??r/2+Math.random()*100-50,y:c.y??a/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(o.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;o.forEach(u=>{let p=r/2,d=a/2;u.vx+=(p-u.x)*n.centerForce*i,u.vy+=(d-u.y)*n.centerForce*i,o.forEach(m=>{if(u.id===m.id)return;let f=u.x-m.x,v=u.y-m.y,h=Math.sqrt(f*f+v*v)||1,b=n.chargeStrength*i/(h*h);u.vx+=f/h*b,u.vy+=v/h*b;});}),t.forEach(u=>{let p=l.get(typeof u.source=="string"?u.source:u.source.id),d=l.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,h=(v-n.linkDistance)/v*n.forceStrength*i;p.vx+=m*h,p.vy+=f*h,d.vx-=m*h,d.vy-=f*h;}),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(r-n.nodeSize,u.x)),u.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return o}function Lf({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:s,stats:o,onInteraction:l,className:c}){let i=useRef(null),[u,p]=useState([]),[d,m]=useState(null),[f,v]=useState(null),[h,b]=useState(null),[y,x]=useState(1),[w,k]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let O=a2(e,t,r.width,r.height,r,150);p(O);},[e,t,r]);let M=useCallback((O,X)=>{r.enableDragging&&(X.stopPropagation(),m(O));},[r.enableDragging]),I=useCallback(O=>{if(!d||!i.current)return;let F=i.current.getBoundingClientRect(),Fe=(O.clientX-F.left-w.x)/y,U=(O.clientY-F.top-w.y)/y;p(De=>De.map(B=>B.id===d?{...B,x:Fe,y:U,fx:Fe,fy:U}:B));},[d,y,w]),C=useCallback(()=>{m(null);},[]),N=useCallback((O,X)=>{X.stopPropagation(),l?.({type:"node-click",node:O,position:{x:X.clientX,y:X.clientY}});},[l]),P=useCallback((O,X)=>{X.stopPropagation(),l?.({type:"edge-click",edge:O,position:{x:X.clientX,y:X.clientY}});},[l]),T=useCallback(O=>{let X=u.find(F=>F.id===O);return X?{x:X.x,y:X.y}:{x:0,y:0}},[u]),V=useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(r.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let X=O.card.priority;return X==="URGENT"?"#ef4444":X==="HIGH"?"#f59e0b":X==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[r.colorScheme]);return e.length===0?jsxs("div",{className:g("relationships-graph-empty",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"})]})]}),r.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x(O=>Math.min(O+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x(O=>Math.max(O-.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(O=>O.type))).map(O=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:nu(O)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Pf(O)," ",ou(O)]})]},O))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:I,onMouseUp:C,onMouseLeave:C,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${y})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let X=T(typeof O.source=="string"?O.source:O.source.id),F=T(typeof O.target=="string"?O.target:O.target.id),Fe=Ff(O.type),U=h===O.id,De=O.onCriticalPath;return jsxs("g",{className:g("relationships-graph-edge",U&&"hovered",De&&"critical"),onMouseEnter:()=>b(O.id),onMouseLeave:()=>b(null),onClick:B=>P(O,B),children:[jsx("line",{x1:X.x,y1:X.y,x2:F.x,y2:F.y,stroke:nu(O.type),strokeWidth:De?r.edgeWidth*2:r.edgeWidth,strokeOpacity:U?1:.6,markerEnd:Fe?"url(#arrowhead)":void 0}),r.showEdgeLabels&&U&&jsx("text",{x:(X.x+F.x)/2,y:(X.y+F.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:ou(O.type)})]},O.id)})}),jsx("g",{className:"relationships-graph-nodes",children:u.map(O=>{let X=f===O.id,F=O.onCriticalPath;return jsxs("g",{className:g("relationships-graph-node",X&&"hovered",F&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:Fe=>M(O.id,Fe),onMouseEnter:()=>v(O.id),onMouseLeave:()=>v(null),onClick:Fe=>N(O,Fe),children:[jsx("circle",{r:F?r.nodeSize*1.2:r.nodeSize,fill:V(O),stroke:F?"#fbbf24":"#ffffff",strokeWidth:F?3:2,opacity:X?1:.9}),r.showLabels&&jsx("text",{y:r.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.id)})})]}),jsx("defs",{children:jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Rf({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[s,o]=useState(""),[l,c]=useState(false),[i,u]=useState(null),[p,d]=useState(null),m=useRef(null),f=l||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(""),u(null),d(null),t());},h=async()=>{if(!(!s.trim()||f)){c(true),u(null),d(null);try{let y=await a(s.trim());d(y);}catch(y){u(y instanceof Error?y.message:"Failed to generate plan");}finally{c(false);}}},b=()=>{p&&(r(p),v());};return e?jsxs(ir,{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: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((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 (",p.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[p.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)),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:y=>o(y.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled:f}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((y,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"}),p?jsx("button",{onClick:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:h,disabled:!s.trim()||f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:f?"Generating...":"Generate Plan"})]})]})]})})]}):null}var su={"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 o2={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},s2={generatePlan:{enabled:true,minPlanTier:"hobby",estimatedTokens:2e3},predictRisks:{enabled:true,minPlanTier:"pro",estimatedTokens:1500},suggestAssignee:{enabled:true,minPlanTier:"hobby",estimatedTokens:800},generateReport:{enabled:true,minPlanTier:"enterprise",estimatedTokens:3e3},generateSubtasks:{enabled:true,minPlanTier:"hobby",estimatedTokens:1e3}};function i2(e,t,r){let a=su[e];if(!a)throw new Error(`Unknown model: ${e}`);let n=t/1e3*a.costPer1kInput,s=r/1e3*a.costPer1kOutput;return n+s}function ui(e){return `$${e.toFixed(4)}`}var iu=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=i2(t.model,t.inputTokens,t.outputTokens),a={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:r};return this.operations.push(a),this.listeners.forEach(n=>n(a)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),a}getStats(t){let r=this.operations;t&&(r=r.filter(p=>p.timestamp>=t.start&&p.timestamp<=t.end));let a=r.length,n=r.reduce((p,d)=>p+d.cost,0),s=r.reduce((p,d)=>p+d.inputTokens,0),o=r.reduce((p,d)=>p+d.outputTokens,0),l=r.filter(p=>p.success),c=r.reduce((p,d)=>p+d.duration,0),i={},u={};return r.forEach(p=>{i[p.feature]=(i[p.feature]||0)+1,u[p.feature]=(u[p.feature]||0)+p.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:i,costsByFeature:u,averageDuration:a>0?c/a:0,successRate:a>0?l.length/a:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,r="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][r],s=new Date,o=new Date;r==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let l=this.operations.filter(u=>u.timestamp>=o).length,c=Math.max(0,n-l),i=l/n*100;return {used:l,limit:n,remaining:c,percentUsed:i,isExceeded:l>=n}}subscribe(t){return this.listeners.push(t),()=>{let r=this.listeners.indexOf(t);r>-1&&this.listeners.splice(r,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},zo=new iu;function Of({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=useState(zo.getStats()),[s,o]=useState(zo.checkLimit(r));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{n(zo.getStats()),o(zo.checkLimit(r));},1e3);return ()=>clearInterval(c)},[e,r]),useEffect(()=>{let c=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let l=zo.getRecentOperations(5);return jsxs(ir,{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 (",r.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ui(a.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-[#00E5CC] mt-1",children:a.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(a.totalInputTokens+a.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[a.totalInputTokens.toLocaleString()," in /"," ",a.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(a.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",a.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(a.operationsByFeature).map(([c,i])=>{let u=a.costsByFeature[c]||0,p=a.totalOperations>0?i/a.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children: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:[i," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ui(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"}),l.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:l.map(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:ui(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 Wf({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:s}){let[o,l]=useState(""),[c,i]=useState(""),[u,p]=useState(""),[d,m]=useState(false),[f,v]=useState(null),[h,b]=useState(null),[y,x]=useState(null),w=useRef(null),k=d||n;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let P=T=>{T.key==="Escape"&&!k&&M();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,k]);let M=()=>{k||(l(""),i(""),p(""),v(null),b(null),x(null),t());},I=async()=>{if(!(!o.trim()||k)){m(true),v(null),b(null),x(null);try{let P=await a({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});b(P.tasks.tasks),x({from_cache:P.from_cache,tokens_used:P.tokens_used,mock_mode:P.mock_mode,similarity:P.similarity,tokens_saved:P.tokens_saved});}catch(P){v(P instanceof Error?P.message:"Failed to generate tasks");}finally{m(false);}}},C=()=>{h&&(r(h),M());};if(!e)return null;let N=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxs(ir,{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:P=>P.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick: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:h?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[y?.mock_mode&&jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),y?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-[#00E5CC]/20 text-[#00E5CC] border border-[#00E5CC]/30",children:["From Cache (",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:[y?.tokens_used||0," tokens"]}),y?.tokens_saved&&jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[y.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((P,T)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxs("span",{className:"text-xs text-white/50",children:["#",T+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:P.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),P.start," \u2192 ",P.end]}),jsxs("span",{children:[P.duration," days"]}),P.dependencies.length>0&&jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",P.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${P.priority==="high"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:P.priority})]})},P.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:w,value:o,onChange:P=>l(P.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled: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:P=>i(P.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled: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:P=>p(P.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled: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((P,T)=>jsx("button",{onClick:()=>l(P),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:P},T))})]})]})}),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"}),h?jsx("button",{onClick:C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:I,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 Gl({initialBoard:e,onPersist:t}){let[r,a]=useState(e),n=useCallback(h=>{t&&Ci(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,y,x)=>{console.warn(`Retry attempt ${y} after ${x}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=useCallback(async(h,b,y)=>{a(x=>{let w=x.cards.find(P=>P.id===h);if(!w)return x;let k=w.columnId,M={...w,columnId:b,position:y},I=x.cards.map(P=>P.id===h?M:P),C=x.columns.map(P=>{if(P.id===k)return {...P,cardIds:P.cardIds.filter(T=>T!==h)};if(P.id===b){let T=I.filter(V=>V.columnId===b).sort((V,O)=>V.position-O.position);return {...P,cardIds:T.map(V=>V.id)}}return P}),N={...x,cards:I,columns:C};return n(N),N});},[n]),o=useCallback(async(h,b)=>{a(y=>{let x=y.cards.map(k=>k.id===h?{...k,...b}:k),w={...y,cards:x};return n(w),w});},[n]),l=useCallback(async h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(y=>{let x={...h,id:b},w=y.columns.map(M=>M.id===h.columnId?{...M,cardIds:[...M.cardIds,b]}:M),k={...y,cards:[...y.cards,x],columns:w};return n(k),k});},[n]),c=useCallback(async h=>{a(b=>{let y=b.cards.find(M=>M.id===h);if(!y)return b;let x=b.cards.filter(M=>M.id!==h),w=b.columns.map(M=>M.id===y.columnId?{...M,cardIds:M.cardIds.filter(I=>I!==h)}:M),k={...b,cards:x,columns:w};return n(k),k});},[n]),i=useCallback(async h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(y=>{let x={...h,id:b,cardIds:[]},w={...y,columns:[...y.columns,x]};return n(w),w});},[n]),u=useCallback(async(h,b)=>{a(y=>{let x=y.columns.map(k=>k.id===h?{...k,...b}:k),w={...y,columns:x};return n(w),w});},[n]),p=useCallback(async h=>{a(b=>{let y=b.cards.filter(k=>k.columnId!==h),x=b.columns.filter(k=>k.id!==h),w={...b,cards:y,columns:x};return n(w),w});},[n]),d=useCallback(h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),b},[l]),m=useCallback(h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),b},[i]),f=useCallback(()=>{a(h=>{let b={...h,cards:[],columns:[]};return n(b),b});},[n]);return {board:r,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:p},setBoard:a,helpers:{addCard:d,addColumn:m,deleteCard:c,deleteColumn:p,clearBoard:f}}}function Gf({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:s}=Gl({initialBoard:e,onPersist:r}),o=useMemo(()=>({addCard:(c,i,u={})=>{s.addCard({title:i,columnId:c,position:a.cards.filter(p=>p.columnId===c).length,...u});},addColumn:(c,i)=>{let u=a.columns.length>0?Math.max(...a.columns.map(p=>p.position)):0;s.addColumn({title:c,position:i??u+1e3});},reset:s.clearBoard}),[a.cards,a.columns,s]);return {props:useMemo(()=>({board:a,callbacks:n,availableUsers:t}),[a,n,t]),board:a,callbacks:n,utils:o}}var pi={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},jf={by:"none",order:"asc"};function _f({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=useState({...pi,...e}),[s,o]=useState({...jf,...t}),l=useCallback(v=>{n(h=>({...h,...v}));},[]),c=useCallback(v=>{o(h=>({...h,...v}));},[]),i=useCallback(()=>{n(pi),o(jf);},[]),u=useCallback(()=>{r&&n({...pi,assignees:[r]});},[r]),p=useCallback(()=>{n({...pi,dateFilter:"overdue"});},[]),d=useCallback(()=>{n({...pi,priorities:["HIGH","URGENT"]});},[]),m=useMemo(()=>a.dateFilter!=="all"||a.priorities.length>0||a.assignees.length>0||a.labels.length>0||a.columns.length>0||a.search!==""||s.by!=="none",[a,s]),f=useCallback(v=>{let h=[...v];if(a.search){let b=a.search.toLowerCase();h=h.filter(y=>y.title.toLowerCase().includes(b)||y.description?.toLowerCase().includes(b));}if(a.dateFilter!=="all"){let b=new Date,y=b.getFullYear(),x=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),k=`${y}-${x}-${w}`;h=h.filter(M=>{if(!M.endDate&&!M.dueDate)return false;let I=M.endDate||M.dueDate;if(!I)return false;let C;if(typeof I=="string")C=I.split("T")[0]||I;else {let N=I.getUTCFullYear(),P=String(I.getUTCMonth()+1).padStart(2,"0"),T=String(I.getUTCDate()).padStart(2,"0");C=`${N}-${P}-${T}`;}switch(a.dateFilter){case "overdue":return C<k;case "today":return C===k;case "this-week":let N=new Date(k+"T00:00:00"),P=new Date(C+"T00:00:00"),T=new Date(N);return T.setDate(T.getDate()+7),P>=N&&P<=T;case "custom":if(a.dateRange){let V=typeof I=="string"?new Date(I):I;return V>=a.dateRange.start&&V<=a.dateRange.end}return true;default:return true}});}return a.priorities.length>0&&(h=h.filter(b=>b.priority&&a.priorities.includes(b.priority))),a.assignees.length>0&&(h=h.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(x=>a.assignees.includes(x)))),a.labels.length>0&&(h=h.filter(b=>b.labels&&b.labels.some(y=>a.labels.includes(y)))),a.columns.length>0&&(h=h.filter(b=>a.columns.includes(b.columnId))),s.by!=="none"&&h.sort((b,y)=>{let x=0;switch(s.by){case "created":let w=b.createdAt?new Date(b.createdAt).getTime():0,k=y.createdAt?new Date(y.createdAt).getTime():0;x=w-k;break;case "priority":let M={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},I=M[b.priority||"LOW"],C=M[y.priority||"LOW"];x=I-C;break;case "dueDate":let N=b.endDate||b.dueDate,P=y.endDate||y.dueDate;if(!N)return 1;if(!P)return -1;let T=typeof N=="string"?new Date(N).getTime():N.getTime(),V=typeof P=="string"?new Date(P).getTime():P.getTime();x=T-V;break;case "title":x=b.title.localeCompare(y.title);break;case "estimate":let O=b.estimatedTime||0,X=y.estimatedTime||0;x=O-X;break;default:x=0;}return s.order==="asc"?x:-x}),h},[a,s]);return {filters:a,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:u,filterOverdue:p,filterHighPriority:d,applyFilters:f,hasActiveFilters:m}}var qf,Yf;if(typeof window<"u")try{let e=vi("ai");qf=e.generateObject,Yf=e.generateText;}catch{}function Xf(e={}){let[t,r]=useState(false),[a,n]=useState(null),s=!!(qf&&Yf&&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');r(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{r(false);}},[s]),l=useCallback(async p=>{if(!s)throw new Error("AI features not available");r(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{r(false);}},[s]),c=useCallback(async p=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(d){let m=d instanceof Error?d:new Error("Failed to predict risks");throw n(m),m}finally{r(false);}},[s]),i=useCallback(async p=>{if(!s)throw new Error("AI features not available");r(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{r(false);}},[s]),u=useCallback(async p=>{if(!s)throw new Error("AI features not available");r(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{r(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:a}}function cu(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(n=>{t(n);}),[]);let r=useCallback(a=>{selectionStore.setState(a);},[]);return [e,r]}function Jf(e){let{cards:t}=e,[r,a]=cu(),n=useCallback(p=>r.selectedCardIds.includes(p),[r.selectedCardIds]),s=useCallback((p,d)=>{if(!d){a({selectedCardIds:[p],lastSelectedCardId:p});return}let m=d.ctrlKey||d.metaKey,f=d.shiftKey;if(m)r.selectedCardIds.includes(p)?a({selectedCardIds:r.selectedCardIds.filter(v=>v!==p),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,p],lastSelectedCardId:p});else if(f&&r.lastSelectedCardId){let v=t.find(b=>b.id===p),h=t.find(b=>b.id===r.lastSelectedCardId);if(v&&h&&v.columnId===h.columnId){let b=t.filter(C=>C.columnId===v.columnId).sort((C,N)=>C.position-N.position),y=b.findIndex(C=>C.id===r.lastSelectedCardId),x=b.findIndex(C=>C.id===p),[w,k]=y<x?[y,x]:[x,y],M=b.slice(w,k+1).map(C=>C.id),I=Array.from(new Set([...r.selectedCardIds,...M]));a({selectedCardIds:I,lastSelectedCardId:p});}else a({selectedCardIds:[p],lastSelectedCardId:p});}else a({selectedCardIds:[p],lastSelectedCardId:p});},[t,r,a]),o=useCallback(p=>{a({selectedCardIds:r.selectedCardIds.filter(d=>d!==p),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),l=useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),c=useCallback(()=>{a({selectedCardIds:t.map(p=>p.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=useCallback(p=>{r.selectedCardIds.includes(p)?o(p):a({selectedCardIds:[...r.selectedCardIds,p],lastSelectedCardId:p});},[r,o,a]),u=useCallback(()=>t.filter(p=>r.selectedCardIds.includes(p.id)),[t,r.selectedCardIds]);return {selectedCardIds:r.selectedCardIds,lastSelectedCardId:r.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:u}}var Qf={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Zf(e){let{cards:t,config:r,aiService:a}=e,n=useMemo(()=>({...Qf,...r}),[r]),[s,o]=useState([]),l=useCallback((v,h,b,y,x)=>{if(h.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:v,cardIds:h,columnId:b,strategy:y,color:x,isExpanded:true,position:s.filter(k=>k.columnId===b).length,createdAt:new Date};o(k=>[...k,w]);},[n.minCardsPerStack,s]),c=useCallback(v=>{o(h=>h.filter(b=>b.id!==v));},[]),i=useCallback(v=>{o(h=>h.map(b=>b.id===v?{...b,isExpanded:!b.isExpanded}:b));},[]),u=useCallback((v,h)=>{o(b=>b.map(y=>y.id===v&&!y.cardIds.includes(h)?{...y,cardIds:[...y.cardIds,h]}:y));},[]),p=useCallback((v,h)=>{o(b=>b.map(y=>{if(y.id===v){let x=y.cardIds.filter(w=>w!==h);return x.length<n.minCardsPerStack?null:{...y,cardIds:x}}return y}).filter(y=>y!==null));},[n.minCardsPerStack]),d=useCallback(v=>s.filter(h=>h.columnId===v).sort((h,b)=>h.position-b.position),[s]),m=useCallback(async v=>{let h=t.filter(k=>k.columnId===v);if(h.length<n.minCardsPerStack*2)return [];let b=[],y=new Map;h.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(M=>{y.has(M)||y.set(M,[]),y.get(M).push(k);});}),y.forEach((k,M)=>{k.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${M}`,cardIds:k.map(I=>I.id),columnId:v,strategy:"labels",color:"#00E5CC"},reason:`${k.length} cards with label "${M}"`,confidence:.85});});let x=new Map;h.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&&b.push({stack:{title:`\u{1F464} Assigned to user-${M.slice(-4)}`,cardIds:k.map(I=>I.id),columnId:v,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(h.forEach(k=>{k.priority&&(w.has(k.priority)||w.set(k.priority,[]),w.get(k.priority).push(k));}),w.forEach((k,M)=>{if(k.length>=n.minCardsPerStack){let I={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[M.toLowerCase()]||"\u26AA";b.push({stack:{title:`${I} ${M} Priority`,cardIds:k.map(C=>C.id),columnId:v,strategy:"priority",color:M==="high"||M==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${M} priority`,confidence:.75});}}),a&&n.enableAutoStacking)for(let k of h){let I=(await a.findSimilar(k,h)).filter(C=>C.similarity>=n.autoStackConfidenceThreshold);if(I.length>=n.minCardsPerStack-1){let C=[k.id,...I.map(P=>P.card.id)],N=I.reduce((P,T)=>P+T.similarity,0)/I.length;b.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:C,columnId:v,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${I.length+1} similar tasks`,confidence:N});}}return b.filter(k=>k.confidence>=n.autoStackConfidenceThreshold).sort((k,M)=>M.confidence-k.confidence).slice(0,5)},[t,n,a]),f=useCallback(v=>{l(v.stack.title,v.stack.cardIds,v.stack.columnId,v.stack.strategy,v.stack.color);},[l]);return useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let b=await m(h),y=b[0];b.length>0&&y&&y.confidence>=.9&&f(y);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:u,removeFromStack:p,getStacksForColumn:d,getSuggestions:m,applySuggestion:f,config:n}}var eb=createContext(null);function tb({children:e,initialData:t,onStateChange:r}){let a=useRef();if(!a.current){let s=new Map,o=new Map;t?.columns?.forEach(c=>{let{Column:i}=vi("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=vi("@libxai/core");o.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=vi("@libxai/core");l=new c(t.board);}a.current=new BoardStore({board:l,columns:s,cards:o});}let n=a.current;return useEffect(()=>{if(r)return n.subscribeAll(s=>{r(n.getState());})},[n,r]),jsx(eb.Provider,{value:{store:n},children:e})}function Vl(){let e=useContext(eb);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function gi(){let e=Vl(),[t,r]=useState(e.getBoard()),[a,n]=useState(e.getAllColumns()),[s,o]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{r(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let l=useCallback(y=>{e.updateBoard(y);},[e]),c=useCallback(y=>{e.addColumn(y);},[e]),i=useCallback((y,x)=>{e.updateColumn(y,x);},[e]),u=useCallback(y=>{e.deleteColumn(y);},[e]),p=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]),h=useCallback(y=>e.getCard(y),[e]),b=useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:a,cards:s,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:u,getColumn:p,addCard:d,updateCard:m,deleteCard:f,moveCard:v,getCard:h,getCardsByColumn:b}}function ab(e){let{cards:t}=gi();return useMemo(()=>e?t.filter(r=>{if(e.searchQuery){let a=e.searchQuery.toLowerCase(),n=r.title.toLowerCase().includes(a),s=r.description?.toLowerCase().includes(a);if(!n&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!r.priority||!e.priorities.includes(r.priority))||e.statuses&&e.statuses.length>0&&(!r.status||!e.statuses.includes(r.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>r.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>r.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(r.columnId)||e.isOverdue!==void 0&&e.isOverdue!==r.isOverdue())}):t,[t,e])}function nb(e="position",t="asc"){let{cards:r}=gi();return useMemo(()=>[...r].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=n.priority?l[n.priority]:0,i=s.priority?l[s.priority]:0;o=c-i;break}case "createdAt":o=n.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":o=n.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":o=n.position-s.position;break}return t==="asc"?o:-o}),[r,e,t])}var jl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Vu.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let r of t.dependencies)if(!this.plugins.has(r))throw new Error(`Plugin ${t.id} depends on ${r} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(r=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,r,{plugin:t.id});});}unregister(t){let r=this.plugins.get(t);if(!r){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}r.onDestroy&&Promise.resolve(r.onDestroy()).catch(a=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,a);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${r.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,r){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);r?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,r){return this.config.get(t)?.[r]}setConfig(t,r,a){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[r]=a,this.pluginLogger.debug(`Plugin config set: ${t}.${r}`,{value:a});}async executeHook(t,r,a){let n=a;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let l=await Promise.resolve(o.apply(s,r));l!==void 0&&(n=l,r[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,r){let a=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&a.push(Promise.resolve(s.apply(n,r)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(a);}},T2=new jl;function sb({items:e,height:t,estimateSize:r,renderItem:a,className:n="",overscan:s=5,horizontal:o=false,gap:l=0,getItemKey:c}){let i=useRef(null),u=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:s,horizontal:o,gap:l}),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:i,style:d,className:n,children:jsx("div",{style:m,children:p.map(f=>{let v=e[f.index];if(!v)return null;let h=c?c(v,f.index):f.index,b={position:"absolute",top:o?0:f.start,left:o?f.start:0,width:o?f.size:"100%",height:o?"100%":f.size};return jsx("div",{style:b,"data-index":f.index,children:a(v,f.index)},h)})})})}function ib(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 cb({items:e,height:t,width:r="100%",estimateColumnWidth:a,renderColumn:n,className:s="",overscan:o=3,gap:l=16,getItemKey:c,horizontal:i=true}){let u=useRef(null),p=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>a,overscan:o,gap:l}),d=p.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,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 h=e[v.index];if(!h)return null;let b=c?c(h,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(h,v.index)},b)})})})}function db(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 ub(e,t=10){return e>t}var mu={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},gu={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},fu={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},bu={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},hu={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},yu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},xu={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},vu={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)"},wu={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)"},ku={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Cu={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}},Tu={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}},_l={spacing:mu,borderRadius:gu,fontSize:fu,fontWeight:bu,lineHeight:hu,zIndex:yu,duration:xu,easing:vu,shadows:wu,opacity:ku,kanban:Cu,gantt:Tu};function pb(e,t,r){return e[t]??r}function Nu(e,t="",r={}){for(let[a,n]of Object.entries(e)){let s=t?`${t}-${a}`:a;typeof n=="object"&&n!==null&&!Array.isArray(n)?Nu(n,s,r):(typeof n=="string"||typeof n=="number")&&(r[s]=n);}return r}function S2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Du(e="asakaa"){let t=Nu(_l),r=[];for(let[a,n]of Object.entries(t)){let s=`--${e}-${a}`,o=S2(n);r.push(` ${s}: ${o};`);}return `:root {
|
|
415
|
-
${
|
|
413
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function hg(e){let t=[],a=r=>{for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);};return a(e),t}function Un(e,t){let a=hg(e),r=t.toLowerCase().trim(),n=a.find(l=>l.name.toLowerCase()===r);if(n)return n;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let o=r.split(/\s+/);return a.find(l=>{let c=l.name.toLowerCase();return o.every(i=>c.includes(i))})}function wd(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(),h=m-v;return h<=0&&(h+=7),f.setDate(f.getDate()+h),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 l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let d=parseInt(l[1],10),m=parseInt(l[2],10)-1,f=parseInt(l[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},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let d=parseInt(i[1],10),m=c[i[2].toLowerCase()],f=i[3]?parseInt(i[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 kd(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 Cd(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 yg(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 xg(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),u=r[2].trim(),p=Un(t,i),d=wd(u);if(!p)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!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 i=n[1].trim(),u=n[2].trim(),p=Un(t,i),d=kd(u);if(!p)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,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 i=s[1].trim(),u=s[2].trim(),p=Un(t,i),d=Cd(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:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let o=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),u=o[2].trim(),p=Un(t,i);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:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),u=l[2].trim(),p=Un(t,i),d=Un(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:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let i=c[1].trim(),u=Un(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function vg(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 ek(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 tk(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function gl(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=>gl(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let o=u=>{if(u)return typeof u=="string"?new Date(u):u},l=o(e.startDate),c=o(e.endDate),i=e.metadata?.isMilestone===true||l&&c&&Math.abs(c.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:c,progress:e.progress||0,status:ek(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function wg(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:tk(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function kg(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>gl(r,e,t))}var Td={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"}},Nd={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:Td,es:Nd};function Dd(e){return fl[e]||fl.en}function bl(e,t){let a=Dd(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 Sd=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function Cg(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 Tg({value:e,onChange:t,isDark:a,translations:r,disabled:n=false}){let[s,o]=useState(false),l=useRef(null);useEffect(()=>{let m=f=>{l.current&&!l.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let c=Cg(e),i=Sd[0],u=Sd.find(m=>m.value===c)??i,p=u.icon,d=m=>{switch(Cg(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:l,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:Sd.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 uo(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,l=s.bottom+a+o<=window.innerHeight,c=s.top-a-o>=0;n(!l&&c);},[t,a,e]),r}var Ed=[{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 Dg({value:e="none",onChange:t,isDark:a,locale:r,disabled:n=false}){let[s,o]=useState(false),l=useRef(null),c=uo(l,s,180);useEffect(()=>{let p=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let i=Ed.find(p=>p.value===e)??Ed[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",i.color)}),jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:i.label[u]})]}):jsxs("div",{ref:l,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",i.color)}),jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:i.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:Ed.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 ai(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Md(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 xl({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:n,disabled:s=false}){let[o,l]=useState(false),[c,i]=useState(""),u=useRef(null),p=useRef(null),d=uo(u,o);useEffect(()=>{let h=b=>{u.current&&!u.current.contains(b.target)&&(l(false),i(""));};return o&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),useEffect(()=>{o&&p.current&&p.current.focus();},[o]);let m=t.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),f=h=>e.some(b=>b.name===h),v=h=>{if(a){if(f(h.name))a(e.filter(b=>b.name!==h.name));else {let b={name:h.name,initials:ai(h.name),color:h.color||Md(h.name).replace("bg-","").replace("-500",""),avatar:h.avatarUrl,id:h.id};a([...e,b]);}l(false),i("");}};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((h,b)=>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",!h.avatar&&Md(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,title:h.name,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||ai(h.name)},`${h.name}-${b}`)),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",{onClick:h=>{h.stopPropagation(),l(!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((h,b)=>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",!h.avatar&&Md(h.name)),style:h.color&&!h.avatar?{backgroundColor:h.color}:void 0,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||ai(h.name)},`${h.name}-${b}`)),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:h=>i(h.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:h=>h.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((h,b)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:h.color?`${h.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:h.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:h.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials||ai(h.name)}),h.name.split(" ")[0],jsx("button",{onClick:y=>{y.stopPropagation(),a(e.filter(x=>x.name!==h.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}})})]},`${h.name}-${b}`))}),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(h=>{let b=f(h.name);return jsxs("button",{onClick:y=>{y.stopPropagation(),v(h);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:b?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=>{b||(y.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:y=>{b||(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:h.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:h.avatarUrl?jsx("img",{src:h.avatarUrl,alt:h.name,className:"w-full h-full rounded-full object-cover"}):ai(h.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.name}),b&&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"}})})]},h.id)})})]})]})}function Lg({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:n="end",isDark:s,locale:o,disabled:l=false,placeholder:c}){let[i,u]=useState(false),[p,d]=useState(n),[m,f]=useState(()=>{let T=n==="start"?e:t;if(T){let V=T instanceof Date?T:new Date(T);return new Date(V.getFullYear(),V.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),v=useRef(null),h=useRef(null),b=useRef(null),[y,x]=useState(null),w=e?e instanceof Date?e:new Date(e):null,k=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let T=V=>{let O=V.target;v.current&&v.current.contains(O)||b.current&&b.current.contains(O)||u(false);};return i&&document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[i]),useLayoutEffect(()=>{if(!i){x(null);return}let T=()=>{let V=h.current?.getBoundingClientRect();if(!V)return;let O=520,J=360,L=window.innerHeight-V.bottom,Ie=L<J&&V.top>L,G=Ie?V.top-4:V.bottom+4,ke=Math.min(Math.max(V.left,8),window.innerWidth-O-8);x({top:G,left:ke,flipUp:Ie});};return T(),window.addEventListener("scroll",T,true),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,true),window.removeEventListener("resize",T);}},[i]),useEffect(()=>{i&&d(r?n:"start");},[i,r,n]);let M=T=>T?T.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",I=useCallback(()=>{let T=m.getFullYear(),V=m.getMonth(),O=new Date(T,V,1),L=new Date(T,V+1,0).getDate(),Ie=O.getDay(),G=[],R=new Date(T,V,0).getDate();for(let Pe=Ie-1;Pe>=0;Pe--)G.push({date:new Date(T,V-1,R-Pe),isCurrentMonth:false});for(let Pe=1;Pe<=L;Pe++)G.push({date:new Date(T,V,Pe),isCurrentMonth:true});let U=42-G.length;for(let Pe=1;Pe<=U;Pe++)G.push({date:new Date(T,V+1,Pe),isCurrentMonth:false});return G},[m]),C=T=>{if(r)n==="start"?a(T,k||void 0):a(w||void 0,T),u(false);else if(p==="start"){let V=k&&T>k?T:k;a(T,V||void 0),d("end");}else {let V=w&&T<w?T:w;a(V||void 0,T),u(false);}},N=()=>{let T=new Date,V=new Date(T);V.setDate(T.getDate()+1);let O=new Date(T);O.setDate(T.getDate()+((6-T.getDay()+7)%7||7));let J=new Date(T);J.setDate(T.getDate()+((1-T.getDay()+7)%7||7));let L=new Date(T);L.setDate(T.getDate()+(6-T.getDay()+7)%7+7);let Ie=new Date(T);Ie.setDate(T.getDate()+14);let G=new Date(T);return G.setDate(T.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:T,display:T.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:V,display:V.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:O,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:J,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:L,display:L.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:Ie,display:Ie.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:G,display:G.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let T=r&&n==="start"?w:k;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:M(T)})]})}let P=r&&n==="start"?w:k;return jsxs("div",{ref:v,className:"relative",children:[jsxs("button",{ref:h,onClick:T=>{T.stopPropagation(),u(!i);let V=n==="start"?w:k;V&&f(new Date(V.getFullYear(),V.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:M(P)})]}),i&&y&&createPortal(jsxs("div",{ref:b,className:g("rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),style:{position:"fixed",top:y.flipUp?void 0:y.top,bottom:y.flipUp?window.innerHeight-y.top:void 0,left:y.left,zIndex:10001},onClick:T=>T.stopPropagation(),children:[jsxs("div",{className:g("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[N().map((T,V)=>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:()=>C(T.date),children:[jsx("span",{children:T.label}),jsx("span",{className:g("text-xs",s?"text-white/30":"text-gray-400"),children:T.display})]},V)),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,k||void 0):a(w||void 0,void 0):a(void 0,void 0),u(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:p==="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(T=>jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:T},T))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:I().map((T,V)=>{let O=T.date.toDateString()===new Date().toDateString(),J=w?.toDateString()===T.date.toDateString(),L=k?.toDateString()===T.date.toDateString(),Ie=J||L,G=!r&&w&&k&&T.date>=w&&T.date<=k;return jsx("button",{onClick:()=>C(new Date(T.date)),className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!T.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),T.isCurrentMonth&&(s?"text-white":"text-gray-900"),O&&"ring-2 ring-[#00E5CC]",J&&"bg-[#00E5CC] text-white",L&&!J&&"bg-[#7C3AED] text-white",G&&!Ie&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!Ie&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:T.date.getDate()},V)})})]})]}),document.body)]})}function wl({value:e,onChange:t,isDark:a,locale:r,disabled:n=false,dateField:s="end",startDate:o,endDate:l}){let c=e?e instanceof Date?e:new Date(e):null;return jsx(Lg,{startDate:s==="start"?c:o||null,endDate:s==="end"?c:l||null,onChange:(d,m)=>{t&&t(s==="start"?d:m);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:n||!t,placeholder:"-"})}function hs(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 kl(e,t={}){let{enabled:a=true,duration:r=400,steps:n=8}=t,[s,o]=useState(e),[l,c]=useState(false),i=useRef(e),u=useRef([]);return useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!a||e===i.current||e===void 0){o(e),i.current=e;return}let p=i.current??0,d=e,m=d-p,f=r/n;c(true);for(let v=1;v<=n;v++){let h=setTimeout(()=>{let b=v/n,y=1-Math.pow(1-b,3),x=Math.round(p+m*y);o(x),v===n&&(c(false),o(d));},f*v);u.current.push(h);}return i.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,a,r,n]),{displayValue:s,isAnimating:l}}function Ag(e,t={}){let{delay:a=1500,onCancel:r}=t,[n,s]=useState(null),[o,l]=useState(0),c=useRef(null),i=useRef(null),u=useCallback(m=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(m),l(0);let f=Date.now();i.current=setInterval(()=>{let v=Date.now()-f,h=Math.min(v/a*100,100);l(h);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(m),s(null),l(0);},a);},[a,e]),p=useCallback(()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:u,cancelChange:p}}function Rg({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,l]=useState(false),[c,i]=useState(""),u=useRef(null),{isFlashing:p,triggerFlash:d}=hs(),{displayValue:m,isAnimating:f}=kl(e,{enabled:n,duration:300,steps:6}),v=w=>{if(r||!t)return;w.stopPropagation();let k=w.currentTarget.getBoundingClientRect(),M=w.clientX-k.left,I=Math.round(M/k.width*100),C=Math.max(0,Math.min(100,I));C!==e&&(t(C),s&&d());},h=useCallback(w=>{r||!t||(w.stopPropagation(),i(String(e)),l(true));},[r,t,e]);useEffect(()=>{o&&u.current&&(u.current.focus(),u.current.select());},[o]);let b=useCallback(()=>{l(false);let w=parseInt(c,10);if(!isNaN(w)&&t){let k=Math.max(0,Math.min(100,w));k!==e&&(t(k),s&&d());}},[c,t,e,s,d]),y=useCallback(w=>{w.key==="Enter"&&b(),w.key==="Escape"&&l(false);},[b]),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:w=>w.stopPropagation(),children:[jsx("input",{ref:u,value:c,onChange:w=>i(w.target.value.replace(/[^0-9]/g,"")),onBlur:b,onKeyDown:y,maxLength:3,className:g("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",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:h,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 Og({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:n=false}){let[s,o]=useState(false),[l,c]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{c(e);},[e]);let u=()=>{l!==e&&t?.(l),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:i,type:"text",value:l,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 Wg({value:e,onChange:t,isDark:a,placeholder:r="-",min:n,max:s,disabled:o=false,enableSlotMachine:l=true,enableSaveFlash:c=true}){let[i,u]=useState(false),[p,d]=useState(e?.toString()||""),m=useRef(null),{isFlashing:f,triggerFlash:v}=hs(),{displayValue:h,isAnimating:b}=kl(e,{enabled:l&&!i});useEffect(()=>{i&&m.current&&(m.current.focus(),m.current.select());},[i]),useEffect(()=>{d(e?.toString()||"");},[e]);let y=()=>{let w=parseFloat(p);if(!isNaN(w)){let k=w;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=w=>{w.key==="Enter"?y():w.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",b&&"font-medium"),children:h!==void 0?h:r}):i?jsx("input",{ref:m,type:"number",value:p,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(),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",h===void 0&&(a?"text-white/30":"text-gray-400"),f&&(a?"bg-green-500/30":"bg-green-500/20"),b&&"font-medium scale-105"),children:h!==void 0?h:r})}function zg({value:e,options:t=[],onChange:a,isDark:r,placeholder:n="-",disabled:s=false}){let[o,l]=useState(false),c=useRef(null),i=uo(c,o,220);return useEffect(()=>{let u=p=>{c.current&&!c.current.contains(p.target)&&l(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(),l(!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 "+(i?"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),l(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 Vg({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:l,progress:c,startChange:i,cancelChange:u}=Ag(t,{delay:s}),p=m=>{m.stopPropagation(),!r&&t&&(n?l?u():i(!e):t(!e));},d=l?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",l&&"ring-2 ring-offset-1",l&&d&&"ring-green-500/50",l&&!d&&"ring-red-500/50",l&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[l&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:d?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):d?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),l&&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 jg({value:e=[],options:t=[],onChange:a,isDark:r,placeholder:n="-",disabled:s=false,maxSelectable:o,maxVisible:l=2}){let[c,i]=useState(false),u=useRef(null),p=uo(u,c,220);useEffect(()=>{let b=y=>{u.current&&!u.current.contains(y.target)&&i(false);};return c&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[c]);let d=e.slice(0,l),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=b=>{let y=e.includes(b),x=y?e.filter(w=>w!==b):[...e,b];!y&&o!=null&&e.length>=o||a(x);},h=o!=null&&e.length>=o;return jsxs("div",{ref:u,className:"relative",children:[jsxs("button",{onClick:b=>{b.stopPropagation(),i(!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(b=>{let y=e.includes(b),x=!y&&h;return jsxs("button",{disabled:x,onClick:w=>{w.stopPropagation(),v(b);},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:b}),y&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},b)})})]})}function Vk(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 qg({value:e,isDark:t,placeholder:a="-",onOpen:r}){let n=Vk(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,l=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:l})]}):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"}),l]})}function Jg({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 Kk(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 qk(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),c=parseInt(a[2],10);return l*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(l*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 Br({value:e,onChange:t,isDark:a,locale:r="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:l=false,lens:c="hours",hourlyRate:i=0,financialOverride:u}){let[p,d]=useState(false),[m,f]=useState(""),v=useRef(null),{isFlashing:h,triggerFlash:b}=hs(),y=c==="financial"&&(i>0||u!=null),x=u??(e?e/60*i:0),w=y&&(u!=null?u>0:e)?`$${Math.round(x).toLocaleString("en-US")}`:Kk(e,r);useEffect(()=>{p&&v.current&&(v.current.focus(),v.current.select());},[p]),useEffect(()=>{if(e){let C=Math.floor(e/60),N=e%60;C>0&&N>0?f(`${C}h ${N}m`):C>0?f(`${C}h`):f(`${N}m`);}else f("");},[e,p]);let k=()=>{let C=qk(m);C!==e&&(t?.(C),o&&b()),d(false);},M=C=>{C.key==="Enter"?k():C.key==="Escape"&&d(false);};if(l)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className: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 I=y?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsx(I,{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})]}):p?jsx("input",{ref:v,type:"text",value:m,onChange:C=>f(C.target.value),onBlur:k,onKeyDown:M,onClick:C=>C.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:C=>{C.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",h&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(I,{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 t0({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"}),l=()=>{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"]}),l()]})}function r0({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:l="hours",hourlyRate:c=0}){let i=a==="es",u=l==="financial"&&c>0,p=G=>u?`$${Math.round(G*c).toLocaleString("en-US")}`:`${G}h`,[d,m]=useState(false),[f,v]=useState(false),[h,b]=useState(null),y=useRef(null),x=e.timeLoggedMinutes||0,w=e.effortMinutes||0,k=e.soldEffortMinutes||0,M=Math.round(x/60*10)/10,I=Math.round(w/60*10)/10,C=w>0?x/w*100:0,N=C>100?Math.round((x-w)/60*10)/10:0,P=C>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!f&&!h)return;let G=ke=>{y.current&&!y.current.contains(ke.target)&&(v(false),b(null));};return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[f,h]);let T=G=>{if(G.stopPropagation(),r&&!n&&!s){b("log");return}if(r||n||s){v(ke=>!ke),b(null);return}o&&o(e);},V=G=>{v(false),b(G);},O=async(G,ke)=>{h==="log"&&r&&G?r(e,G,ke):h==="estimate"&&n?n(e,G):h==="quoted"&&s&&s(e,G),b(null);},J=r||n||s||o,L=[{mode:"log",icon:Clock,label:i?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:i?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(G=>G.show),Ie=h==="estimate"?w:h==="quoted"?k:void 0;return w===0&&x===0&&k===0?jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:G=>G.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&&J&&jsx("button",{onClick:T,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:G=>{G.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",G.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:G=>{G.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",G.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(G=>jsxs("button",{onClick:ke=>{ke.stopPropagation(),V(G.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:ke=>{ke.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ke=>{ke.target.style.background="transparent";},children:[jsx(G.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),G.label]},G.mode))})}),jsx(AnimatePresence,{children:h&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(Nn,{mode:h,locale:a,isDark:t,currentValue:Ie||void 0,onSave:O,onClose:()=>b(null)})})})})]}):jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:G=>G.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 G=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:G?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:p(M)}),w>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",p(I)]}),N>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:["+",p(N)," ",i?"Excedido":"Over"]})]})})(),w>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(C,100)}%`,backgroundColor:P,borderRadius:2,transition:"width 0.3s"}})})]}),J&&jsx("button",{onClick:T,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:G=>{G.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",G.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:G=>{G.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",G.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(G=>jsxs("button",{onClick:ke=>{ke.stopPropagation(),V(G.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:ke=>{ke.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ke=>{ke.target.style.background="transparent";},children:[jsx(G.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),G.label]},G.mode))})}),jsx(AnimatePresence,{children:h&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(Nn,{mode:h,locale:a,isDark:t,currentValue:Ie||void 0,onSave:O,onClose:()=>b(null)})})})})]})}function t1(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 a1(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 n0({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 o0({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=t1(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(n0,{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 l=o?.percentage??0,c=!!o&&l>0,i=c?a1(l):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(n0,{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&&i&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[l,"% LOAD"]})]})}var r1={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function i0({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",r1[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${n}`))})}function y1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function x1(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 g0({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:u=[],onOpenTimeLog:p,onReportBlocker:d,onCopyTaskLink:m,onTaskMove:f,onTaskIndent:v,onTaskOutdent:h}){let b=useRef(null),y=r==="es"?d0.es:d0.en,[x,w]=useState({left:e.x,top:e.y});if(useLayoutEffect(()=>{w({left:e.x,top:e.y});let N=b.current;if(!N)return;let P=N.getBoundingClientRect(),T=8,V=e.x,O=e.y;e.y+P.height>window.innerHeight-T&&(O=Math.max(T,e.y-P.height)),e.x+P.width>window.innerWidth-T&&(V=Math.max(T,window.innerWidth-P.width-T)),(V!==e.x||O!==e.y)&&w({left:V,top:O});},[e.x,e.y,e.isOpen]),useEffect(()=>{let N=T=>{b.current&&!b.current.contains(T.target)&&t();},P=T=>{T.key==="Escape"&&t();};return document.addEventListener("mousedown",N),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",P);}},[t]),!e.isOpen)return null;let k=()=>{if(!e.task)return [];let N=[];return n&&N.push({id:"edit",label:y.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),N.push({id:"sep1",label:"",icon:null,separator:true}),l&&(N.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:()=>{l({...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:()=>{l({...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:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),N.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:()=>{l({...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:()=>{l({...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:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:y.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),u.length>0&&N.push({id:"assign",label:y.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(P=>({id:`assign-${P.id}`,label:P.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:P.name.charAt(0).toUpperCase()}),onClick:()=>{let T=e.task.assignees||[],O=T.some(J=>J.name===P.name)?T.filter(J=>J.name!==P.name):[...T,{name:P.name,initials:y1(P.name),color:P.color||x1(P.name),avatar:P.avatarUrl}];l({...e.task,assignees:O}),t();}}))})),p&&N.push({id:"log-time",label:y.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),d&&N.push({id:"report-blocker",label:y.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&N.push({id:"copy-link",label:y.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:y.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||v||h)&&(N.push({id:"sep3",label:"",icon:null,separator:true}),f&&(N.push({id:"move-up",label:y.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),N.push({id:"move-down",label:y.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),v&&N.push({id:"indent",label:y.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{v(e.task.id),t();}}),h&&N.push({id:"outdent",label:y.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),o&&N.push({id:"delete",label:y.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 i&&(N.push({id:"sort-asc",label:y.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),N.push({id:"sort-desc",label:y.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(N.push({id:"sep-hide",label:"",icon:null,separator:true}),N.push({id:"hide",label:y.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),N},I=e.type==="task"?k():M(),C={position:"fixed",left:x.left,top:x.top,zIndex:9999};return jsx("div",{ref:b,style:C,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:I.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(v1,{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 v1({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(l=>jsxs("button",{onClick:l.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:l.icon}),l.label]},l.id))})]})}var d0={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 k0={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"})},$1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function T0({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:n,onCreateCustomField:s,mostrarColumnasDensas:o=true,isDark:l,locale:c}){let[i,u]=useState(""),[p,d]=useState(null),[m,f]=useState(null),v=useRef(null),h=c==="es"?C0.es:C0.en;useLayoutEffect(()=>{if(!e||!v.current)return;let N=()=>{if(!v.current)return;let P=v.current.parentElement;if(P){let J=P.getBoundingClientRect();f({top:J.bottom+4,right:window.innerWidth-J.right});}let T=v.current.getBoundingClientRect(),O=window.innerHeight-T.top-20;d(Math.max(300,O));};return requestAnimationFrame(N),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[e]),useEffect(()=>{if(!e)return;let N=setTimeout(()=>{let P=V=>{v.current&&!v.current.contains(V.target)&&t();},T=V=>{V.key==="Escape"&&t();};document.addEventListener("mousedown",P),document.addEventListener("keydown",T),v._cleanup=()=>{document.removeEventListener("mousedown",P),document.removeEventListener("keydown",T);};},100);return ()=>{clearTimeout(N),v._cleanup&&v._cleanup();}},[e,t]);let b=useMemo(()=>{let N=new Set([...$1]);return a.forEach(P=>{P.type&&P.type!=="assignees"&&N.add(P.type);}),Array.from(N)},[a]);if(!e)return null;let y=N=>{let P=h.columns[N];if(P)return P;let T=a.find(V=>V.type===N);return T?.label?T.label:N},x=N=>{if(N==="name")return;let P=a.map(T=>T.id===N?{...T,visible:!T.visible}:T);n(P);},w=(N,P)=>{let T=a.find(O=>O.type===N&&(!P||O.customFieldId===P));if(T){x(T.id);return}let V={id:P||N,type:N,label:P?r.find(O=>O.id===P)?.name||N:y(N),width:120,visible:true,sortable:true,resizable:true,customFieldId:P};n([...a,V]);},k=["effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"],M=b.filter(N=>N!=="assignees"&&(o||!k.includes(N))&&y(N).toLowerCase().includes(i.toLowerCase())),I=r.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),C=l?"#00E5FF":"#00E5CC";return jsxs("div",{ref:v,style:{...p?{maxHeight:`${p}px`}:{},...m?{top:m.top,right:m.right}:{},background:l?"#111114":"#FFFFFF",border:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:l?"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 ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:l?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:h.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",N.currentTarget.style.color=l?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent",N.currentTarget.style.color=l?"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:l?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:i,onChange:N=>u(N.target.value),placeholder:h.searchPlaceholder,style:{fontSize:12,background:l?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:l?"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",C);},onFocus:N=>{N.currentTarget.style.borderColor=C,N.currentTarget.style.background=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:N=>{N.currentTarget.style.borderColor=l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",N.currentTarget.style.background=l?"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:l?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:h.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:M.map(N=>{let P=a.find(O=>O.type===N&&!O.customFieldId),T=P?.visible??false,V=N==="name";return jsxs("button",{onClick:()=>{V||(P?x(P.id):w(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:O=>{V||(O.currentTarget.style.backgroundColor=l?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:O=>{O.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:T?C:"transparent",border:T?`1.5px solid ${C}`:`1.5px solid ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:T?`0 0 6px ${C}40`:"none"},children:T&&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:T?C:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:k0[N]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:T?500:400,color:T?l?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":l?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:y(N),children:y(N)})]},N)})})]}),I.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:l?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${l?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:h.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:I.map(N=>{let T=a.find(V=>V.customFieldId===N.id)?.visible??false;return jsxs("button",{onClick:()=>w(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=l?"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:T?C:"transparent",border:T?`1.5px solid ${C}`:`1.5px solid ${l?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:T?`0 0 6px ${C}40`:"none"},children:T&&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:T?C:l?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:k0[N.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:T?500:400,color:T?l?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":l?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:N.name})]},N.id)})})]})]})]})}var C0={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 _1=[{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 S0({isOpen:e,onClose:t,onSave:a,isDark:r,locale:n}){let[s,o]=useState(""),[l,c]=useState("text"),[i,u]=useState([""]),p=n==="es"?D0.es:D0.en;useEffect(()=>{e&&(o(""),c("text"),u([""]));},[e]),useEffect(()=>{let h=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let d=()=>{if(!s.trim())return;let h={name:s.trim(),type:l};l==="dropdown"&&(h.options=i.filter(b=>b.trim())),a(h),t();},m=()=>{u([...i,""]);},f=(h,b)=>{let y=[...i];y[h]=b,u(y);},v=h=>{i.length>1&&u(i.filter((b,y)=>y!==h));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:g("relative w-full max-w-md rounded-xl shadow-2xl border",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:h=>o(h.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:_1.map(h=>jsxs("button",{onClick:()=>c(h.type),className:g("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===h.type?"border-[#00E5CC] bg-[#00E5CC]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:l===h.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-400",children:h.icon}),jsx("span",{className:g("text-xs",l===h.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-500"),children:p.types[h.type]})]},h.type))})]}),l==="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:[i.map((h,b)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:h,onChange:y=>f(b,y.target.value),placeholder:`${p.option} ${b+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")}),i.length>1&&jsx("button",{onClick:()=>v(b),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"})})]},b)),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 D0={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 P0={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 F0({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:n,locale:s}){let[o,l]=useState(false),c=useRef(null),i=useRef(0),u=s==="es"?P0.es:P0.en;useEffect(()=>{if(!o)return;let m=v=>{Date.now()-i.current<100||c.current&&!c.current.contains(v.target)&&l(false);},f=v=>{v.key==="Escape"&&l(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||(i.current=Date.now()),l(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),l(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"),l(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 L0(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 fo(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function A0({data:e,isDark:t,locale:a="en",onClose:r,lens:n="hours",onUnassignedTaskClick:s}){let o=a==="es",l=n==="financial";return jsxs("div",{className: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:l?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"})})})]}),l&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let c=e.totalOffered??0,i=e.totalEstimated??0,u=e.totalExecuted??0,p=c-u,d=c>0?Math.round(p/c*100):0,m=c-i,f=c>0?Math.round(m/c*100):0,v=c>0?Math.min(Math.round(u/c*100),120):0,h=u>c&&c>0,b=h?"#F87171":"#00E5CC";return jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"PRESUPUESTO":"BUDGET"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:fo(c)})]}),(()=>{let y=e.totalEstimatedLabor??0,x=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,k=x>0||w>0,M=(I,C)=>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:I}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:fo(C)})]});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:fo(i)})]}),k&&jsxs(Fragment,{children:[M(o?"Mano de obra":"Labor",y),x>0&&M(o?"Activos":"Equipment",x),w>0&&M(o?"Vi\xE1ticos":"Travel",w)]})]})})(),u>0&&(()=>{let y=e.totalExecutedLabor??0,x=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,k=x>0||w>0,M=(I,C)=>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:I}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:fo(C)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsx("span",{className:g("text-[11px] font-mono font-bold",h?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:fo(u)})]}),k&&jsxs(Fragment,{children:[M(o?"Mano de obra":"Labor",y),x>0&&M(o?"Activos":"Equipment",x),w>0&&M(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:b}})}),i>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?"+":"",fo(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:[p>=0?`+${fo(p)} ${o?"disponible (caja)":"available (cash)"}`:`${fo(Math.abs(p))} ${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,i=e.totalHoursAllocatedMinutes??0,u=i>0?Math.min(Math.round(c/i*100),100):0,m=(i>0?c/i:0)>1.1?"#F87171":u>=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:L0(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:L0(i)})]}),i>0&&jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${u}%`,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,i=c>0,u=c<0,p=e.scheduleVarianceLabel||(i?`+${c} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:u?`${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",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",u&&"bg-[#F87171]/15 text-[#F87171]",!i&&!u&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:p})})()]}),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,i)=>{let u=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:u}})})]},`${c.name}-${i}`)})})]})]})}var iC=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function W0(e,t=0,a=[]){let r=[];for(let n of e){let s=[...a,n.id];r.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&r.push(...W0(n.subtasks,t+1,s));}return r}function lC(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 Cs(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=Cs(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 ks(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 cC({value:e,onChange:t,isDark:a}){let[r,n]=useState(false),[s,o]=useState(String(e||""));return r?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:l=>l.stopPropagation(),onChange:l=>o(l.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let l=parseFloat(s);!isNaN(l)&&l>=0&&l<=100?t(l):s===""&&t(0),n(false);},onKeyDown:l=>{l.key==="Enter"&&l.target.blur(),l.key==="Escape"&&(o(String(e||"")),n(false));},className: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:l=>{l.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 U0(e){if(e.length===0)return 0;let t=0,a=0,r=0;for(let l of e){let c=l.weight||0;c>0&&(t+=(l.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((l,c)=>l+(c.effort_minutes||0),0)>0){let l=0,c=0;for(let i of e){let u=i.effort_minutes||60;l+=(i.progress||0)*u,c+=u;}return Math.round(l/c*10)/10}let o=e.reduce((l,c)=>l+(c.progress||0),0);return Math.round(o/e.length*10)/10}function qd(e,t=[]){for(let a of e)a.subtasks&&a.subtasks.length>0?qd(a.subtasks,t):t.push({progress:a.progress||0,weight:a.weight||0,effort_minutes:a.effort_minutes??a.effortMinutes});return t}function z0({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:n,className:s,style:o,availableUsers:l=[],customFields:c=[],toolbarRightContent:i,onColumnHeaderClick:u,columnsWithFilter:p,filterDotColor:d="#00E5CC"}){let{theme:m="dark",locale:f="en",customTranslations:v,showSearch:h=true,showHierarchy:b=true,tableColumns:y,mostrarIndicadoresFinancieros:x=true,mostrarColumnasDensas:w=true,allowColumnCustomization:k=true,allowColumnResize:M=true,enableContextMenu:I=true,showCreateTaskButton:C=false,onCreateTask:N,persistFilter:P=false,financialBlur:T,healthSidebar:V,lens:O="hours",hourlyRate:J=0,rateMap:L,aggregateParentHours:Ie=false,showProjectTotals:G=false,totalsDollarOverride:ke}=t,R=bl(f,v),U=m==="dark",Pe=S=>{if(!L||!S.assignees||S.assignees.length===0)return J;let Y=0,te=0;for(let Te of S.assignees){let _e=Te.id?L[Te.id]:void 0;if(_e==null||_e<=0)continue;let le=typeof Te.estimatedMinutes=="number"?Te.estimatedMinutes:0;le>0&&(Y+=_e*le,te+=le);}if(te>0)return Y/te;let xe=S.assignees.map(Te=>Te.id?L[Te.id]:void 0).filter(Te=>Te!=null&&Te>0);return xe.length===0?J:xe.reduce((Te,_e)=>Te+_e,0)/xe.length},Ze=S=>{let Y=0,te=0,xe=0,Te=_e=>{for(let le of _e)if(le.subtasks&&le.subtasks.length>0){let Me={s:Y,a:te,q:xe};if(Te(le.subtasks),Y-Me.s+(te-Me.a)+(xe-Me.q)===0){let qe=Pe(le);Y+=(le.timeLoggedMinutes??0)/60*qe,te+=(le.effortMinutes??0)/60*qe,xe+=(le.soldEffortMinutes??0)/60*qe;}}else {let Me=Pe(le);Y+=(le.timeLoggedMinutes??0)/60*Me,te+=(le.effortMinutes??0)/60*Me,xe+=(le.soldEffortMinutes??0)/60*Me;}};return S.subtasks&&Te(S.subtasks),{dollarSpent:Y,dollarAllocated:te,dollarQuoted:xe}},oe=useCallback(()=>{if(!P||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let S=localStorage.getItem(P);if(S){let Y=JSON.parse(S);return {statusFilter:Y.statusFilter||"all",hideCompleted:Y.hideCompleted||!1}}}catch(S){console.error("Error loading persisted filter:",S);}return {statusFilter:"all",hideCompleted:false}},[P]),Fe=useMemo(()=>{function S(Y){let te=0,xe=0,Te=0,_e=0,le=0,Me=0;for(let Ke of Y)if(Ke.subtasks&&Ke.subtasks.length>0){let qe=S(Ke.subtasks);if(qe.spent+qe.allocated+qe.quoted>0)te+=qe.spent,xe+=qe.allocated,Te+=qe.quoted,_e+=qe.dollarSpent,le+=qe.dollarAllocated,Me+=qe.dollarQuoted;else {let ut=Ke.timeLoggedMinutes??0,We=Ke.effortMinutes??0,ha=Ke.soldEffortMinutes??0;te+=ut,xe+=We,Te+=ha;let ya=Pe(Ke);_e+=ut/60*ya,le+=We/60*ya,Me+=ha/60*ya;}}else {let qe=Ke.timeLoggedMinutes??0,At=Ke.effortMinutes??0,ut=Ke.soldEffortMinutes??0;te+=qe,xe+=At,Te+=ut;let We=Pe(Ke);_e+=qe/60*We,le+=At/60*We,Me+=ut/60*We;}return {spent:te,allocated:xe,quoted:Te,dollarSpent:_e,dollarAllocated:le,dollarQuoted:Me}}return S(e)},[e]),Q=useMemo(()=>{let S=new Map;function Y(te){let xe=0;for(let Te of te)if(Te.subtasks&&Te.subtasks.length>0){let _e=Y(Te.subtasks);S.set(Te.id,_e),xe+=_e;}else xe+=Te.weight||0;return xe}return Y(e),S},[e]),Se=useMemo(()=>!V?.enabled||!V.data?V:{...V,data:{...V.data,totalHoursSpentMinutes:Fe.spent,totalHoursAllocatedMinutes:Fe.allocated}},[V,Fe]),[Ue,Le]=useState(true),[Be,ot]=useState(null),[se,je]=useState("position"),[Xe,$e]=useState("asc"),[mt,Et]=useState(""),[st,Ne]=useState(()=>oe().statusFilter),[lt,Mt]=useState(()=>oe().hideCompleted),[Oe,xt]=useState(y||iC),[A,X]=useState(false),[we,B]=useState(false),[q,he]=useState({isOpen:false,x:0,y:0,type:"task"}),[Ae,ye]=useState(null),[tt,ie]=useState(false),[ce,He]=useState(null),[at,ft]=useState(null),[Ye,vt]=useState(null),Yt=useRef(0),ba=useRef(false),ca=!!(a.onTaskMove||a.onTaskReparent),[Gt,Bt]=useState(null),[Da,Ht]=useState(null),kr=S=>{let Y=S.type;return S.customFieldId?Y==="file"?null:{kind:"customField",fieldId:S.customFieldId}:Y==="assignees"||Y==="teamLoad"?"assignees":Y==="startDate"?"startDate":Y==="endDate"?"endDate":null},da=(S,Y)=>typeof S=="string"||typeof Y=="string"?S===Y:S.fieldId===Y.fieldId,pr=useRef([]),et=useCallback((S,Y)=>{ca&&(Y.preventDefault(),Yt.current=Y.clientY,ye(S),ba.current=false,ie(false),vt({x:Y.clientX,y:Y.clientY}));},[ca]),Je=useCallback(S=>{if(!Ae||(Math.abs(S.clientY-Yt.current)>5&&!ba.current&&(ba.current=true,ie(true)),vt({x:S.clientX,y:S.clientY}),!ba.current))return;let te=document.querySelectorAll("[data-listview-row]"),xe=null,Te=null;te.forEach(_e=>{let le=_e.getBoundingClientRect(),Me=_e.getAttribute("data-listview-row");if(Me&&Me!==Ae&&S.clientY>=le.top&&S.clientY<=le.bottom){xe=Me;let Ke=S.clientY-le.top,qe=le.height;Te=Ke<qe*.25?"above":Ke>qe*.75?"below":"child";}}),He(xe),ft(Te);},[Ae]),Aa=useCallback(()=>{if(ba.current&&Ae&&ce&&at){if(at==="child"&&a.onTaskReparent)a.onTaskReparent(Ae,ce);else if(at==="above"||at==="below"){let S=(xe,Te,_e=null)=>{for(let le of xe){if(le.id===Te)return _e;if(le.subtasks){let Me=S(le.subtasks,Te,le.id);if(Me!==void 0)return Me}}},Y=S(e,Ae,null),te=S(e,ce,null);if(a.onTaskReparent){let xe=(qe,At)=>{if(At===null)return qe;for(let ut of qe){if(ut.id===At)return ut.subtasks||[];if(ut.subtasks){let We=xe(ut.subtasks,At);if(We.length>0||ut.subtasks.some(ha=>ha.id===At))return We}}return []},Te=xe(e,te??null),_e=Te.findIndex(qe=>qe.id===ce),le=Y===te,Me=le?Te.findIndex(qe=>qe.id===Ae):-1,Ke=at==="below"?_e+1:_e;le&&Me!==-1&&Me<_e&&(Ke-=1),a.onTaskReparent(Ae,te??null,Math.max(0,Ke));}}}ye(null),He(null),ft(null),vt(null),ba.current=false,ie(false);},[Ae,ce,at,e,a]),ja=(S,Y)=>typeof Y!="string"?S.customFields?.find(xe=>xe.fieldId===Y.fieldId)?.value:Y==="assignees"?S.assignees:Y==="startDate"?S.startDate:S.endDate,or=(S,Y,te,xe)=>{S.preventDefault(),S.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let Te=Array.from(document.querySelectorAll("[data-listview-row]")),_e=Te.map(Tt=>Tt.getAttribute("data-listview-row")||""),le=Math.max(0,_e.indexOf(Y)),Me=Tt=>_e.slice(le,Tt+1);Ht({sourceTaskId:Y,column:te,sourceIndex:xe,targetIndex:xe,rangeIds:new Set([Y])});let qe=(Tt=>{let Ft=Tt?.parentElement??null;for(;Ft;){let Cr=window.getComputedStyle(Ft).overflowY;if((Cr==="auto"||Cr==="scroll")&&Ft.scrollHeight>Ft.clientHeight)return Ft;Ft=Ft.parentElement;}let ma=document.scrollingElement;return ma&&ma.scrollHeight>ma.clientHeight?ma:null})(S.currentTarget),At=Tt=>{let Ft=le,ma=false;Te.forEach((Cr,mr)=>{let qa=Cr.getBoundingClientRect();Tt>=qa.top&&Tt<=qa.bottom&&(Ft=mr,ma=true);});let sr=Te[Te.length-1];if(!ma&&sr){let Cr=sr.getBoundingClientRect();Tt>Cr.bottom&&(Ft=Te.length-1);}return Ft<le&&(Ft=le),Ft},ut=S.clientY,We=null,ha=()=>{We!==null&&(cancelAnimationFrame(We),We=null);},ya=()=>{let Tt=At(ut),Ft=new Set(Me(Tt));Ht(ma=>ma&&{...ma,targetIndex:Tt,rangeIds:Ft});},Za=()=>{if(ha(),!qe)return;let Tt=qe,ma=Tt===document.scrollingElement?{top:0,bottom:window.innerHeight}:Tt.getBoundingClientRect(),sr=60,Cr=12,mr=ut-ma.top,qa=ma.bottom-ut,Fr=Tt.scrollHeight-Tt.clientHeight;if(qa<sr&&Tt.scrollTop<Fr){let Ss=Math.max(1,Math.round(Cr*(1-Math.max(0,qa)/sr))),vo=()=>{Tt.scrollTop+=Ss,ya(),Tt.scrollTop<Tt.scrollHeight-Tt.clientHeight&&(We=requestAnimationFrame(vo));};We=requestAnimationFrame(vo);}else if(mr<sr&&Tt.scrollTop>0){let Ss=Math.max(1,Math.round(Cr*(1-Math.max(0,mr)/sr))),vo=()=>{Tt.scrollTop-=Ss,ya(),Tt.scrollTop>0&&(We=requestAnimationFrame(vo));};We=requestAnimationFrame(vo);}},Ut=Tt=>{ut=Tt.clientY,ya(),Za();},Vt=Tt=>{window.removeEventListener("mousemove",Ut),window.removeEventListener("mouseup",Vt),ha(),document.body.style.cursor="",document.body.style.userSelect="",Ht(null);let Ft=At(Tt.clientY),ma=new Map(pr.current.map(qa=>[qa.id,qa])),sr=ma.get(Y);if(!sr)return;let Cr=ja(sr,te),mr=[];for(let qa of Me(Ft)){if(qa===Y)continue;let Fr=ma.get(qa);Fr&&(Fr.subtasks&&Fr.subtasks.length>0||mr.push(qa));}mr.length>0&&a.onBulkFill?.(mr,te,Cr);};window.addEventListener("mousemove",Ut),window.addEventListener("mouseup",Vt);},Ca=S=>Da?Da.rangeIds.has(S):false;useEffect(()=>{if(Ae)return document.addEventListener("mousemove",Je),document.addEventListener("mouseup",Aa),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Je),document.removeEventListener("mouseup",Aa),document.body.style.cursor="",document.body.style.userSelect="";}},[Ae,Je,Aa]);let[Wa,de]=useState("all"),[ue,gt]=useState(false),j=useRef(null),fe=useRef(null),ae=useMemo(()=>{let S=0;function Y(te,xe){for(let Te of te)xe>S&&(S=xe),Te.subtasks?.length&&Y(Te.subtasks,xe+1);}return Y(e,1),S},[e]);useEffect(()=>{if(!ue)return;let S=Y=>{j.current?.contains(Y.target)||fe.current?.contains(Y.target)||gt(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[ue]),useEffect(()=>{if(Wa==="all"){let te=function(xe){for(let Te of xe)Te.subtasks?.length&&(Te.isExpanded===false&&a.onTaskToggleExpand?.(Te.id),te(Te.subtasks));};te(e);}else {let te=function(xe,Te){for(let _e of xe)if(_e.subtasks?.length){let le=Te<Wa,Me=_e.isExpanded!==false;le!==Me&&a.onTaskToggleExpand?.(_e.id),te(_e.subtasks,Te+1);}};te(e,1);}},[Wa]);let[$,ee]=useState(null),[Ce,D]=useState(0),[W,pe]=useState(0),ve=useRef(null),[rt,ge]=useState(null),[K,ct]=useState(null);useEffect(()=>{y&&xt(S=>{if(S.length===y.length){let Y=true;for(let te=0;te<S.length;te++){let xe=S[te],Te=y[te];if(!xe||!Te||xe.id!==Te.id||xe.visible!==Te.visible||xe.width!==Te.width||xe.label!==Te.label){Y=false;break}}if(Y)return S}return y});},[y]),useEffect(()=>{if(!(!P||typeof window>"u"))try{localStorage.setItem(P,JSON.stringify({statusFilter:st,hideCompleted:lt}));}catch(S){console.error("Error persisting filter state:",S);}},[P,st,lt]);let bt=useMemo(()=>{let S=new Set;function Y(te){for(let xe of te)xe.subtasks?.length&&(xe.isExpanded!==false&&S.add(xe.id),Y(xe.subtasks));}return Y(e),S},[e]),Pt=useMemo(()=>Oe.filter(S=>S.visible),[Oe]),Zt=useCallback(S=>{a.onTaskToggleExpand?.(S);},[a]),hr=useCallback(S=>{se===S?$e(Y=>Y==="asc"?"desc":"asc"):(je(S),$e("asc")),a.onSortChange?.({column:S,direction:Xe==="asc"?"desc":"asc"});},[se,Xe,a]),_a=useCallback(S=>{xt(S),a.onColumnsChange?.(S);},[a]),en=useCallback(S=>{let Y=Oe.map(te=>te.id===S?{...te,visible:false}:te);_a(Y);},[Oe,_a]),ea=useCallback((S,Y)=>{je(S),$e(Y);},[]),yo=useCallback((S,Y,te)=>{I&&(S.preventDefault(),he({isOpen:true,x:S.clientX,y:S.clientY,type:Y?"task":"header",task:Y,columnId:te}));},[I]),jn=useCallback(()=>{he(S=>({...S,isOpen:false}));},[]),Gr=useCallback((S,Y)=>{if(!M)return;S.preventDefault(),S.stopPropagation();let te=Oe.find(xe=>xe.id===Y);te&&(ee(Y),D(S.clientX),pe(te.width));},[Oe,M]);useEffect(()=>{if(!$)return;let S=Oe,Y=xe=>{let Te=xe.clientX-Ce,_e=Math.max(50,W+Te);S=S.map(le=>le.id===$?{...le,width:_e}:le),xt(S);},te=()=>{a.onColumnsChange?.(S),ee(null);};return document.addEventListener("mousemove",Y),document.addEventListener("mouseup",te),()=>{document.removeEventListener("mousemove",Y),document.removeEventListener("mouseup",te);}},[$,Ce,W,a]);let _n=useCallback((S,Y)=>{if(Y==="name"){S.preventDefault();return}ge(Y),S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",Y),S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="0.5");},[]),Kn=useCallback(S=>{S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="1"),ge(null),ct(null);},[]),bi=useCallback((S,Y)=>{S.preventDefault(),Y!=="name"&&(S.dataTransfer.dropEffect="move",ct(Y));},[]),jo=useCallback(()=>{ct(null);},[]),hi=useCallback((S,Y)=>{if(S.preventDefault(),!rt||rt===Y||Y==="name")return;let te=[...Oe],xe=te.findIndex(le=>le.id===rt),Te=te.findIndex(le=>le.id===Y);if(xe===-1||Te===-1)return;let _e=te.splice(xe,1);_e[0]&&(te.splice(Te,0,_e[0]),_a(te),ge(null),ct(null));},[rt,Oe,_a]),Ka=useCallback(async S=>{if(a.onCreateCustomField){let Y={...S,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(Y);}B(false);},[a]),xo=useCallback(S=>S.progress===100||S.status==="completed"?"completed":S.progress&&S.progress>0||S.status==="in-progress"?"in-progress":"todo",[]),wn=useMemo(()=>{let S=W0(e);if(mt.trim()){let Y=mt.toLowerCase();S=S.filter(te=>te.name.toLowerCase().includes(Y));}if(st!=="all"){let Y=new Set(S.filter(te=>xo(te)===st).flatMap(te=>te.parentPath));S=S.filter(te=>Y.has(te.id));}if(lt){let Y=new Set(S.filter(te=>xo(te)!=="completed").flatMap(te=>te.parentPath));S=S.filter(te=>Y.has(te.id));}return S.sort((Y,te)=>{let xe,Te;switch(se){case "name":xe=Y.name.toLowerCase(),Te=te.name.toLowerCase();break;case "startDate":xe=Y.startDate?.getTime()||0,Te=te.startDate?.getTime()||0;break;case "endDate":xe=Y.endDate?.getTime()||0,Te=te.endDate?.getTime()||0;break;case "progress":xe=Y.progress||0,Te=te.progress||0;break;case "status":xe=Y.status||"todo",Te=te.status||"todo";break;case "priority":let _e={urgent:0,high:1,medium:2,low:3,none:4};xe=_e[Y.priority]??4,Te=_e[te.priority]??4;break;case "position":return 0;default:return 0}return xe<Te?Xe==="asc"?-1:1:xe>Te?Xe==="asc"?1:-1:0}),S},[e,mt,st,lt,se,Xe,xo]);pr.current=wn;let _o=useCallback((S,Y)=>{let te=_e=>{a.onTaskUpdate?.({...S,..._e});},xe=_e=>_e?S.customFields?.find(Me=>Me.fieldId===_e)?.value:void 0,Te=(_e,le)=>{if(!_e)return;let Ke=[...S.customFields||[]],qe=Ke.findIndex(At=>At.fieldId===_e);qe>=0?Ke[qe]={fieldId:_e,value:le}:Ke.push({fieldId:_e,value:le}),te({customFields:Ke});};switch(Y.type){case "name":return null;case "status":return jsx(Tg,{value:S.status||(S.progress===100?"completed":S.progress&&S.progress>0?"in-progress":"todo"),onChange:le=>{te({status:le,progress:le==="completed"?100:le==="in-progress"?50:0});},isDark:U,locale:f,translations:R.status});case "priority":return jsx(Dg,{value:S.priority,onChange:le=>te({priority:le}),isDark:U,locale:f});case "assignees":{let le=S.hasChildren,Me=S.assignees||[];if(le&&S.subtasks?.length){let Ke=new Map,qe=At=>{(At||[]).forEach(ut=>{(ut.assignees||[]).forEach(We=>{Ke.has(We.name)||Ke.set(We.name,We);}),ut.subtasks?.length&&qe(ut.subtasks);});};qe(S.subtasks),Me=Array.from(Ke.values());}else le&&(Me=[]);return jsx(xl,{value:Me,availableUsers:l,onChange:Ke=>te({assignees:Ke}),isDark:U,locale:f,disabled:le})}case "startDate":return jsx(wl,{value:S.startDate,onChange:le=>te({startDate:le}),isDark:U,locale:f,dateField:"start",startDate:S.startDate,endDate:S.endDate});case "endDate":return jsx(wl,{value:S.endDate,onChange:le=>te({endDate:le}),isDark:U,locale:f,dateField:"end",startDate:S.startDate,endDate:S.endDate});case "progress":{let le=!!(S.subtasks&&S.subtasks.length>0),Me=le?U0(qd(S.subtasks||[])):S.progress||0;return jsx(Rg,{value:Me,onChange:le?void 0:Ke=>{let qe=Ke===100?"completed":Ke>0?"in-progress":"todo";te({progress:Ke,status:qe});},isDark:U,disabled:le})}case "tags":return jsx(Jg,{value:S.tags||[],isDark:U});case "text":return jsx(Og,{value:xe(Y.customFieldId)||"",onChange:le=>Te(Y.customFieldId,le),isDark:U});case "number":return jsx(Wg,{value:xe(Y.customFieldId)||0,onChange:le=>Te(Y.customFieldId,le),isDark:U});case "date":let _e=xe(Y.customFieldId);return jsx(wl,{value:_e?new Date(_e):void 0,onChange:le=>Te(Y.customFieldId,le),isDark:U,locale:f});case "dropdown":return jsx(zg,{value:xe(Y.customFieldId)||"",options:Y.options||[],onChange:le=>Te(Y.customFieldId,le),isDark:U});case "checkbox":return jsx(Vg,{value:xe(Y.customFieldId)||false,onChange:le=>Te(Y.customFieldId,le),isDark:U});case "multiselect":return jsx(jg,{value:xe(Y.customFieldId)||[],options:Y.options||[],onChange:le=>Te(Y.customFieldId,le),isDark:U,maxSelectable:Y.maxSelectable});case "person":{let le=xe(Y.customFieldId)||[];return jsx(xl,{value:le.map(Me=>({name:Me.name,avatar:Me.avatar,initials:Me.initials||(Me.name||"?").slice(0,2).toUpperCase(),color:Me.color||"#00E5CC"})),availableUsers:l,onChange:Me=>Te(Y.customFieldId,Me),isDark:U,locale:f})}case "file":return jsx(qg,{value:xe(Y.customFieldId),isDark:U,onOpen:le=>{le.url&&window.open(le.url,"_blank","noopener,noreferrer");}});case "estimatedTime":{let le=S.status==="completed"||S.progress===100;return jsx(Br,{value:S.estimatedTime,onChange:Me=>te({estimatedTime:Me}),isDark:U,locale:f,disabled:le,lens:O,hourlyRate:Pe(S)})}case "quotedTime":{let le=S.status==="completed"||S.progress===100,Me=T?.enabled&&(!T.columns||T.columns.includes("quotedTime"));return jsx(Br,{value:S.quotedTime,onChange:Ke=>te({quotedTime:Ke}),isDark:U,locale:f,disabled:le,isBlurred:Me,lens:O,hourlyRate:Pe(S)})}case "elapsedTime":{let le=S.status==="completed"||S.progress===100,Me=S.executedDollarsCanonical;return jsx(Br,{value:S.elapsedTime,onChange:Ke=>te({elapsedTime:Ke}),isDark:U,locale:f,disabled:le,lens:O,hourlyRate:Pe(S),financialOverride:Me})}case "effortMinutes":{if(Ie&&S.subtasks&&S.subtasks.length>0){let{allocated:At}=Cs(S);if(O==="financial"){let ut=Ze(S),We=Math.round(ut.dollarAllocated),ha=Math.round(ut.dollarQuoted),ya=ha-We;return jsxs("div",{className:"flex flex-col",children:[We>0?jsxs("span",{className:g("text-sm font-mono",U?"text-white/60":"text-gray-500"),children:["$",We.toLocaleString("es-CO")]}):null,ya!==0&&We>0&&ha>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",ya>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[ya>0?"+":"",Math.abs(ya)>=1e3?`$${(ya/1e3).toFixed(1)}K`:`$${ya}`]})]})}return jsx(Br,{value:At>0?At:void 0,isDark:U,locale:f,disabled:true,lens:O,hourlyRate:J})}let le=S.status==="completed"||S.progress===100,Me=S.effortMinutes||0,Ke=S.soldEffortMinutes||0,qe=Pe(S);if(O==="financial"&&qe&&Me>0&&Ke>0){let At=Math.round(Me/60*qe),We=Math.round(Ke/60*qe)-At;return jsxs("div",{className:"flex flex-col",children:[jsx(Br,{value:Me,onChange:ha=>te({effortMinutes:ha}),isDark:U,locale:f,disabled:le,lens:O,hourlyRate:Pe(S)}),We!==0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",We>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[We>0?"+":"",Math.abs(We)>=1e3?`$${(We/1e3).toFixed(1)}K`:`$${We}`]})]})}return jsx(Br,{value:Me,onChange:At=>te({effortMinutes:At}),isDark:U,locale:f,disabled:le,lens:O,hourlyRate:Pe(S)})}case "timeLoggedMinutes":{let le=S.executedDollarsCanonical;if(Ie&&S.subtasks&&S.subtasks.length>0){let{spent:Ke}=Cs(S);return jsx(Br,{value:Ke>0?Ke:void 0,isDark:U,locale:f,disabled:true,lens:O,hourlyRate:Pe(S),financialOverride:le})}let Me=S.status==="completed"||S.progress===100;return jsx(Br,{value:S.timeLoggedMinutes,onChange:a.onLogTime?Ke=>{a.onLogTime?.(S,Ke);}:void 0,isDark:U,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:Me,lens:O,hourlyRate:Pe(S),financialOverride:le})}case "soldEffortMinutes":{if(Ie&&S.subtasks&&S.subtasks.length>0){let{quoted:Ke}=Cs(S),qe=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx(Br,{value:Ke>0?Ke:void 0,isDark:U,locale:f,disabled:true,isBlurred:qe,lens:O,hourlyRate:Pe(S)})}let le=S.status==="completed"||S.progress===100,Me=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx(Br,{value:S.soldEffortMinutes,onChange:Ke=>te({soldEffortMinutes:Ke}),isDark:U,locale:f,disabled:le,isBlurred:Me,lens:O,hourlyRate:Pe(S)})}case "scheduleVariance":{let le=S.effortMinutes||0,Me=S.soldEffortMinutes||0,Ke=S.timeLoggedMinutes||0,qe=le>0||Me>0||Ke>0;return jsx(t0,{startDate:S.startDate,endDate:S.endDate,scheduleVariance:S.scheduleVariance,isDark:U,locale:f,hasTimeAllocated:qe})}case "hoursBar":{if(Ie&&S.hasChildren){let{spent:le,allocated:Me,quoted:Ke}=Cs(S),qe=le>Me&&Me>0;return jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",U?"text-white/50":"text-gray-500"),children:[jsx("span",{className:g("font-bold",qe?"text-[#FF453A]":U?"text-white/80":"text-gray-800"),children:ks(le)}),Me>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:U?"text-white/60":"text-gray-600",children:ks(Me)})]}),Ke>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:U?"text-amber-400/70":"text-amber-600",children:ks(Ke)})]})]})}return jsx(r0,{task:S,isDark:U,locale:f,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:O,hourlyRate:Pe(S)})}case "teamLoad":return S.hasChildren||S.subtasks&&S.subtasks.length>0?jsx(o0,{task:S,isDark:U,locale:f}):jsx(xl,{value:S.assignees||[],availableUsers:l,onChange:Me=>{a.onTaskUpdate?.({...S,assignees:Me});},isDark:U,locale:f});case "blockers":return jsx(i0,{blockers:S.blockers,isDark:U,locale:f});case "weight":{let le=Q.get(S.id);if(le!==void 0)return jsx("span",{className:g("text-xs font-mono",le>0?U?"text-white/50":"text-gray-400":U?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:le>0?`${Number(le.toFixed(2))}%`:"\u2014"});let Me=S.weight||0;return jsx(cC,{value:Me,onChange:Ke=>te({weight:Ke}),isDark:U})}default:return jsx("span",{className:g("text-sm",U?"text-white/60":"text-gray-500"),children:"-"})}},[a,U,f,l,R,Ie,Q]),Pr=useCallback(S=>{let te={name:R.columns.name,status:R.columns.status,priority:R.columns.priority,assignees:R.columns.assignees,startDate:R.columns.startDate,endDate:R.columns.endDate,progress:R.columns.progress,tags:R.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:R.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:R.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:R.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:R.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:R.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:R.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:R.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:R.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:R.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:R.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:R.columns.weight||(f==="es"?"Peso":"Weight")}[S.type]||S.label;return typeof te=="string"?te:String(te||S.type)},[R,f]),Or=useMemo(()=>{let te=Pt.reduce((Te,_e)=>Te+_e.width,0)+(k?48:0),xe={};for(let Te of Pt)xe[Te.id]=`${Te.width/te*100}%`;return xe},[Pt,k]);return r?jsx("div",{className:g("flex-1 flex items-center justify-center",U?"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",U?"text-white/60":"text-gray-600"),children:[R.empty.noTasks,"..."]})]})}):n?jsx("div",{className:g("flex-1 flex items-center justify-center",U?"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",U?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:g("text-sm",U?"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",U?"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",U?"text-white":"text-gray-900"),children:R.empty.noTasks}),jsx("p",{className:g("text-sm",U?"text-white/60":"text-gray-600"),children:R.empty.addFirstTask})]})}):jsxs("div",{ref:ve,className:g(U?"bg-[#0D0D0D]":"bg-white",$&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[(()=>{let S=!!t.toolbarContainer,Y=jsx("div",{className:S?"flex items-center":g("flex-shrink-0 px-6 py-4 border-b",U?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:S?"flex items-center gap-2":"flex items-center gap-4",children:[jsx("div",{className:g("text-sm whitespace-nowrap",U?"text-white/60":"text-gray-600"),"data-cuenta-de-tareas":true,children:(()=>{let te=wn.filter(_e=>(_e.subtasks?.length??0)>0).length,xe=wn.length-te,Te=f==="es";return jsxs(Fragment,{children:[xe," ",R.pagination.tasks,te>0&&jsxs(Fragment,{children:[" \xB7 ",te," ",Te?te===1?"tarea padre":"tareas padre":te===1?"parent task":"parent tasks"]})]})})()}),h&&!S&&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",U?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:mt,onChange:te=>Et(te.target.value),placeholder:R.toolbar.searchPlaceholder,className:g("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",U?"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")})]}),!S&&jsx("div",{className:"flex-1"}),i&&jsx("div",{className:"flex items-center gap-2",children:i}),b&&ae>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:j,onClick:()=>gt(!ue),className:g("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",U?ue?"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]":ue?"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"}),Wa==="all"?f==="es"?"Todos":"All":`L${Wa}`]}),ue&&jsx("div",{ref:fe,className:g("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",U?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(ae,5)},(te,xe)=>({value:xe+1,label:`L${xe+1}`}))].map(te=>jsxs("button",{onClick:()=>{de(te.value),gt(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",U?Wa===te.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":Wa===te.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:te.label}),Wa===te.value&&jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(te.value)))})]}),jsx(F0,{value:st,hideCompleted:lt,onChange:Ne,onHideCompletedChange:Mt,isDark:U,locale:f}),Se?.enabled&&Se.data&&!Ue&&jsx("button",{onClick:()=>Le(true),className:g("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",U?"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,C&&N&&!S&&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:R.toolbar.newTask})]})]})});return S?createPortal(Y,t.toolbarContainer):Y})(),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",U?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[ca&&jsx("div",{className:"w-5 flex-shrink-0"}),Pt.map(S=>{let Y=S.id!=="name",te=K===S.id&&rt!==S.id;return jsxs("div",{className:g("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",U?"text-white/60":"text-gray-500",Y&&"cursor-grab",S.type!=="name"&&"justify-center",rt===S.id&&"opacity-50",te&&(U?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:Or[S.id],minWidth:S.minWidth},draggable:Y,onDragStart:Y?xe=>_n(xe,S.id):void 0,onDragEnd:Y?Kn:void 0,onDragOver:Y?xe=>bi(xe,S.id):void 0,onDragLeave:Y?jo:void 0,onDrop:Y?xe=>hi(xe,S.id):void 0,onContextMenu:xe=>yo(xe,void 0,S.id),children:[Y&&jsx(GripVertical,{className:g("w-3 h-3 flex-shrink-0 transition-opacity",U?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),u?jsxs("button",{draggable:false,onClick:xe=>{let Te=xe.currentTarget.getBoundingClientRect();u(S.id,Te);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[Pr(S),p?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}}),se===S.id&&jsx(ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):S.sortable?jsxs("button",{draggable:false,onClick:()=>hr(S.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[Pr(S),p?.includes(S.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",se===S.id&&"text-[#00E5CC]")})]}):jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[Pr(S),p?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}})]}),M&&S.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:xe=>Gr(xe,S.id),children:jsx("div",{className:g("w-px h-full transition-colors","pointer-events-none",$===S.id?"bg-[#00E5CC] w-0.5":"bg-current opacity-40 group-hover:bg-[#00E5CC] group-hover:opacity-100 group-hover:w-0.5")})})]},S.id)}),k&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:S=>{S.stopPropagation(),X(Y=>!Y);},className:g("p-0.5 rounded transition-colors",U?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",A&&(U?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(T0,{isOpen:A,onClose:()=>X(false),columns:Oe,customFields:c,mostrarColumnasDensas:w,onColumnsChange:_a,onCreateCustomField:()=>{X(false),B(true);},isDark:U,locale:f})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:wn.map((S,Y)=>{let te=bt.has(S.id),xe=Math.min(Y*.01,.2),Te=S.hasChildren&&S.level===0,_e=S.subtasks?.length||0;if(Te){let{spent:ut,allocated:We,quoted:ha}=Cs(S),ya=lC(S);return jsxs(motion.div,{"data-task-id":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:xe},className:g("flex items-center border-y cursor-pointer transition-colors duration-500",U?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",Be===S.id&&(U?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(S),children:[ca&&jsx("div",{className:"w-5 flex-shrink-0"}),Pt.map(Za=>jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",Za.type!=="name"&&"justify-center"),style:{width:Or[Za.id],minWidth:Za.minWidth},children:Za.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{onClick:Ut=>{Ut.stopPropagation(),Zt(S.id);},className:g("p-0.5 rounded flex-shrink-0 mt-0.5",U?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:te?jsx(ChevronDown,{className:g("w-4 h-4",U?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:g("w-4 h-4",U?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:Ut=>{Ut.stopPropagation(),Zt(S.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:te?jsx(FolderOpen,{className:"w-4 h-4",style:{color:U?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:U?"#FFD60A":"#B45309"}})}),S.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:U?"#FFD60A":"#B45309"},children:S.wbsCode}),jsxs("div",{className:"flex flex-col min-w-0",children:[jsx("span",{className:g("text-[13px] font-bold uppercase tracking-wide",U?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:S.name}),jsxs("span",{className:g("text-[10px] font-mono",U?"text-white/30":"text-gray-500"),children:["(",_e," ",f==="es"?_e===1?"Tarea":"Tareas":_e===1?"Item":"Items",")"]}),ya!==null&&x&&jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",ya>=1?"text-[#32D74B] bg-[#32D74B]/10":ya>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",ya.toFixed(2)]})]})]}):Za.type==="timeLoggedMinutes"?O==="financial"?(()=>{let Ut=S.executedDollarsCanonical,Vt=Ut!=null?Math.round(Ut):Math.round(Ze(S).dollarSpent);return Vt>0?jsxs("span",{className:g("text-sm font-mono",U?"text-white/60":"text-gray-500"),children:["$",Vt.toLocaleString("en-US")]}):null})():jsx(Br,{value:ut>0?ut:void 0,isDark:U,locale:f,disabled:true,lens:O,hourlyRate:Pe(S)}):Za.type==="soldEffortMinutes"?O==="financial"?(()=>{let Ut=Ze(S),Vt=Math.round(Ut.dollarQuoted);return Vt>0?jsxs("span",{className:g("text-sm font-mono",U?"text-white/60":"text-gray-500"),children:["$",Vt.toLocaleString("en-US")]}):null})():jsx(Br,{value:ha>0?ha:void 0,isDark:U,locale:f,disabled:true,lens:O,hourlyRate:Pe(S)}):Za.type==="effortMinutes"?O==="financial"?(()=>{let Ut=Ze(S),Vt=Math.round(Ut.dollarAllocated),Tt=Math.round(Ut.dollarQuoted),Ft=Tt-Vt;return jsxs("div",{className:"flex flex-col",children:[Vt>0?jsxs("span",{className:g("text-sm font-mono",U?"text-white/60":"text-gray-500"),children:["$",Vt.toLocaleString("es-CO")]}):null,Ft!==0&&Vt>0&&Tt>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ft>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ft>0?"+":"",Math.abs(Ft)>=1e3?`$${(Ft/1e3).toFixed(1)}K`:`$${Ft}`]})]})})():jsx(Br,{value:We>0?We:void 0,isDark:U,locale:f,disabled:true,lens:O,hourlyRate:Pe(S)}):_o(S,Za)},Za.id)),k&&jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)}let le=Ae===S.id,Me=ce===S.id,Ke=Me&&at==="above",qe=Me&&at==="below",At=Me&&at==="child";return jsxs(motion.div,{"data-task-id":S.id,"data-listview-row":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:xe},className:g("flex items-center border-b transition-colors relative group",U?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",Be===S.id&&(U?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:le?.4:1,backgroundColor:At?U?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:At?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>a.onTaskClick?.(S),onDoubleClick:()=>a.onTaskDoubleClick?.(S),onContextMenu:ut=>yo(ut,S),onMouseEnter:()=>Bt(S.id),onMouseLeave:()=>Bt(ut=>ut===S.id?null:ut),children:[Ke&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),qe&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),ca&&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(S.id,ut),style:{color:U?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),Pt.map(ut=>{let We=!!(S.subtasks&&S.subtasks.length>0),ha=kr(ut),Za=!!ha&&!We&&Gt===S.id&&!Da,Ut=!!Da&&!!ha&&da(Da.column,ha)&&Ca(S.id);return jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",ut.type!=="name"&&"justify-center"),style:{width:Or[ut.id],minWidth:ut.minWidth,position:"relative",backgroundColor:Ut?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:Ut?"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:[b&&S.level>0&&jsx("div",{style:{width:`${S.level*24}px`},className:"flex-shrink-0"}),b&&S.hasChildren&&jsx("button",{onClick:Vt=>{Vt.stopPropagation(),Zt(S.id);},className:g("p-0.5 rounded flex-shrink-0",U?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:te?jsx(ChevronDown,{className:g("w-4 h-4",U?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:g("w-4 h-4",U?"text-white/60":"text-gray-400")})}),b&&!S.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(S.wbsCode||S.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[S.wbsCode&&jsx("span",{className:g("text-[10px] font-mono",U?"text-[#00E5CC]":"text-[#00C4AE]"),children:S.wbsCode}),S.taskCode&&jsx("span",{className:g("text-[10px] font-mono",U?"text-white/40":"text-gray-400"),children:S.taskCode})]}),jsx("span",{className:g("truncate",S.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",S.progress===100?U?"line-through text-white/50":"line-through text-gray-400":S.hasChildren?U?"text-white":"text-gray-900":U?"text-[#D1D5DB]":"text-gray-600"),children:S.name}),S.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${S.tags[0].color}20`,color:S.tags[0].color},children:S.tags[0].name})]})]}):Za&&ha?jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[_o(S,ut),jsx("span",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Vt=>or(Vt,S.id,ha,Y),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}})]}):_o(S,ut)},ut.id)}),k&&jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)})}),G&&wn.length>0&&(()=>{let{spent:S,allocated:Y,quoted:te}=Fe,xe=Y-S,Te=xe<0,_e=Te?`+${ks(Math.abs(xe))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${ks(xe)} ${f==="es"?"AHORRADO":"SAVED"}`,le=O==="financial"&&J>0,Me=ke?.breakdown,Ke=!!Me&&((Me.equipment??0)>0||(Me.travel??0)>0),qe=Me?.laborSpent!=null?Me.laborSpent:ke?.spent!=null?ke.spent:Fe.dollarSpent,At=Me?.laborAllocated!=null?Me.laborAllocated:ke?.allocated!=null?ke.allocated:Fe.dollarAllocated,ut=ke?.quoted!=null?ke.quoted:Fe.dollarQuoted,We=(Ut,Vt)=>{if(le){let Tt=Vt??Ut/60*J;return `$${Math.round(Tt).toLocaleString("es-CO")}`}return ks(Ut)},ha=le?Math.abs(At-qe):0,ya=le?`+$${ha.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Te?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:_e,Za=le&&Ke?f==="es"?"solo mano de obra":"labor only":void 0;return jsxs("div",{className:g("flex items-center sticky bottom-0 z-[5]",U?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:U?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[ca&&jsx("div",{className:"w-5 flex-shrink-0"}),Pt.map(Ut=>jsx("div",{className:g("flex items-center px-4 py-3",Ut.type!=="name"&&"justify-center"),style:{width:Or[Ut.id],minWidth:Ut.minWidth},children:Ut.type==="name"?jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:g("text-[11px] font-black uppercase tracking-widest",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),Za&&jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",U?"text-white/35":"text-gray-400"),children:[jsx(Info,{className:"w-2.5 h-2.5"}),Za]})]}):Ut.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",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:We(S,le?qe:void 0)}),jsx("span",{className:g("text-[11px]",U?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:g("text-[11px]",U?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:We(Y,le?At:void 0)})]}),Y>0&&jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Te?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:le?ya:_e})]}):Ut.type==="soldEffortMinutes"?jsx("span",{className:g("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:te>0?We(te,le?ut:void 0):"\u2013"}):Ut.type==="effortMinutes"?(()=>{if(le&&te>0&&Y>0){let Vt=Math.round(ut),Tt=Math.round(At),Ft=Vt-Tt,ma=Vt>0?Math.round(Ft/Vt*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:g("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:We(Y,At)}),jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ft>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ft>=0?"+":"",Math.abs(Ft)>=1e3?`$${(Ft/1e3).toFixed(1)}K`:`$${Ft}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",ma,"%)"]})]})]})}return jsx("span",{className:g("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Y>0?We(Y,le?At:void 0):"\u2013"})})():Ut.type==="timeLoggedMinutes"?jsx("span",{className:g("text-[12px] font-bold",U?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:S>0?We(S,le?qe:void 0):"\u2013"}):Ut.type==="progress"?(()=>{let Vt=U0(qd(e||[]));return jsxs("span",{className:g("text-[12px] font-bold font-mono",U?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Vt,"%"]})})():Ut.type==="weight"?(()=>{let Vt=e||[],Tt=[],Ft=mr=>{for(let qa of mr)Tt.push(qa),qa.subtasks?.length&&Ft(qa.subtasks);};Ft(Vt);let sr=Tt.filter(mr=>!mr.subtasks?.length||mr.subtasks.length===0).reduce((mr,qa)=>mr+(qa.weight||0),0),Cr=Math.abs(sr-100)<.1;return jsxs("span",{className:g("text-[12px] font-bold font-mono",Cr?U?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(sr.toFixed(1)),"%"]})})():jsx("span",{className:g("text-[11px]",U?"text-white/30":"text-gray-300"),children:"\u2013"})},Ut.id)),k&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),wn.length===0&&mt&&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",U?"text-white/30":"text-gray-400")}),jsx("p",{className:g(U?"text-white/60":"text-gray-600"),children:R.empty.noResults})]})})]})}),Se?.enabled&&Se.data&&Ue&&jsx(A0,{data:Se.data,isDark:U,locale:f,onClose:()=>Le(false),lens:t?.lens,onUnassignedTaskClick:S=>{let Y=document.querySelector(`[data-task-id="${S}"]`);Y&&(Y.scrollIntoView({behavior:"smooth",block:"center"}),ot(S),setTimeout(()=>ot(null),2e3));}})]}),jsx(g0,{state:q,onClose:jn,isDark:U,locale:f,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:en,onColumnSort:ea,availableUsers:l,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),tt&&Ye&&Ae&&createPortal(jsx("div",{style:{position:"fixed",left:Ye.x+12,top:Ye.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let Y=De.flattenTasks(e).find(te=>te.id===Ae);return Y?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:U?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${U?"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:U?"#e6edf3":"#111827"},children:Y.name})]}):null})()}),document.body),jsx(S0,{isOpen:we,onClose:()=>B(false),onSave:Ka,isDark:U,locale:f})]})}var G0=[{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}],V0=[{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"}],j0=[{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 Yd={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"},Xd={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"},Jd={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"},Fl={dark:Yd,light:Xd,neutral:Jd};function _0(e){return Fl[e]||Fl.dark}function Ll(e,t,a,r,n=5){let s=[],o=[],l=e.filter(m=>m.endSerial>=a&&m.startSerial<=r).sort((m,f)=>m.startSerial-f.startSerial||f.endSerial-m.endSerial);for(let m of l){let f=Math.max(m.startSerial,a),v=Math.min(m.endSerial,r),h=0;for(;(s[h]||[]).some(([b,y])=>!(v<b||f>y));)h++;(s[h]=s[h]||[]).push([f,v]),o.push({t:m,s:f,e:v,lane:h,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 i=[],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],h=[];for(let b=0;b<n;b++)c[f].has(b)||h.push(b);if(v.length<=h.length)v.forEach((b,y)=>i.push({it:b,day:f,lane:h[y]}));else {let b=Math.max(h.length-1,0);v.slice(0,b).forEach((y,x)=>i.push({it:y,day:f,lane:h[x]})),u.push({day:f,lane:h[b]!=null?h[b]:n-1,count:v.length-b,items:v.slice(b)});}});let d=s.length;return i.forEach(m=>{d=Math.max(d,m.lane+1);}),u.forEach(m=>{d=Math.max(d,m.lane+1);}),{bars:o,chips:i,more:u,laneCount:Math.max(d,1)}}var dC=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],uC=["MON","TUE","WED","THU","FRI","SAT","SUN"];function K0(e){return e==="es"?dC:uC}function q0(e){return (e.getDay()+6)%7}function Y0(e,t){let a=new Date(e,t,1),r=q0(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},l=p=>{let d=p.getTime()-n.getTime();return Math.floor(d/864e5)+1},c=l(a),i=new Date(e,t+1,0),u=l(i);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:l,monthStartSerial:c,monthEndSerial:u}}function ii(e,t){return q0(e.serialToDate(t))>=5}function pC(e){let t=[],a=(r,n,s)=>{for(let o of r){let l=n||o.id,c=s||o.name;t.push({t:o,phaseId:l,phaseName:c}),o.subtasks?.length&&a(o.subtasks,l,c);}};return a(e,"",""),t}function X0(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function J0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Al(e){let{tasks:t,grid:a,projectColor:r,hourlyRate:n,projectId:s}=e,o=pC(t),l=42,c=[];for(let{t:u,phaseId:p,phaseName:d}of o){let m=X0(u.startDate),f=X0(u.endDate);if(!m||!f)continue;let v=a.dateToSerial(m),h=a.dateToSerial(f);if(h<1||v>l)continue;let b=u.effortMinutes??0,y=Math.round(b/60*10)/10,x=u.costAtCompletion,w=x!=null?J0(x):J0(y*n),k=u.assignees?.[0],M=k?.initials||(k?.name?fC(k.name):void 0),I=u.displayId||u.wbsCode||"",C=gC(I||u.id)?"":I||u.id;c.push({uid:u.id,id:C,name:u.name,projectId:s,color:u.color,startSerial:Math.max(v,1),endSerial:Math.min(h,l),hrs:y,cost:w,critical:!!u.isCriticalPath,who:M,realStart:m,realEnd:f,phaseId:p,phaseName:d});}let i=[];return {calTasks:c,dayItems:i,isEmpty:c.length===0&&i.length===0}}var mC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function gC(e){return mC.test(e)||/^task-\d+/.test(e)}function fC(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 bC=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],hC=["January","February","March","April","May","June","July","August","September","October","November","December"];function Q0(e,t,a){return `${(a==="es"?bC:hC)[t]} ${e}`}var Qd=26,yC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Il({locale:e}){let t=K0(e);return jsx("div",{className:"cal-dow",children:t.map((a,r)=>jsx("div",{className:r>=5?"wknd":"",children:a},a))})}function Rl({bar:e,ws:t,money:a,projColor:r,slotH:n=Qd}){let{t:s}=e,o=e.s-t,l=e.e-e.s+1,c="cal-bar"+(s.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":""),i=a==="$"?s.cost:`${s.hrs}h`,u={"--proj":e.color??s.color??r,left:`calc(${o}/7*100% + 3px)`,width:`calc(${l}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxs("div",{className:c,style:u,children:[s.critical&&l>=3?jsx("span",{className:"cpm-tag",children:"CPM"}):null,s.id?jsx("span",{className:"tk",children:s.id}):null,jsx("span",{className:"nom",children:s.name}),l>=3?jsx("span",{className:"val",children:i}):null]})}function Bl({chip:e,ws:t,slotH:a=Qd}){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:yC[e.it.type]}),jsx("span",{className:"lbl2",children:e.it.label})]})}function $l({more:e,ws:t,slotH:a=Qd,onClick:r}){let s={left:`calc(${e.day-t}/7*100% + 3px)`,top:`${e.lane*a}px`};return jsxs("div",{className:"cal-more",style:s,role:r?"button":void 0,tabIndex:r?0:void 0,onClick:r?()=>r(e):void 0,children:["+",e.count," m\xE1s"]})}function Z0({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 kC=[{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 Zd({view:e,onViewChange:t,money:a,onMoneyChange:r,mostrarConmutadorDeDinero:n,projectLabel:s,locale:o="es",enCabecera:l=false,hiddenViews:c=[]}){let i=o==="en",u=kC.filter(p=>!c.includes(p.id));return l?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:`${i?p.en:p.es} (${p.key})`,children:i?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:[i?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 ef({monthLabel:e,onPrev:t,onNext:a,onToday:r,layersOpen:n,onToggleLayers:s,layersOff:o,phases:l,phaseFilter:c="all",onPhaseChange:i,locale:u="es",children:p}){let d=o?o.length:0,[m,f]=useState(false),v=useRef(null),h=u==="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 b=c==="all"?h?"Todas":"All":l?.find(y=>y.id===c)?.name??(h?"Todas":"All");return jsxs("div",{className:"cal-toolbar",children:[jsxs("div",{className:"cal-nav-arrows",children:[jsx("button",{type:"button",onClick:t,"aria-label":"Periodo anterior",children:"\u2039"}),jsx("button",{type:"button",onClick: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:h?"Hoy":"Today"}),jsx("div",{className:"cal-vsep"}),l&&l.length>0&&i?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:h?"Fase":"Phase"})," ",b," \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:()=>{i("all"),f(false);},children:jsx("span",{className:"nm",children:h?"Todas las fases":"All phases"})}),l.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:()=>{i(y.id),f(false);},children:jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.name})},y.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 ",h?"Capas":"Layers"," ",jsxs("span",{className:"n",children:[6-d,"/6"]})]})})]})}var CC=[{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 tf({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:CC.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 SC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},EC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function rf({dayLabel:e,items:t,tasks:a=[],itemValue:r,onClose:n,style:s,locale:o="es"}){let l=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 i=a.length+t.length,p=r||(d=>{switch(d.type){case "hito":return l?"Milestone":"Hito";case "desembolso":return l?"Disb.":"Desemb.";case "deadline":return l?"Due":"Vence";case "aus":return l?"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 ${i} ${l?"items":"elementos"}`,children:[jsx("div",{className:"cal-pop-head",children:jsxs("div",{className:"sup",children:[e," \xB7 ",i," ",l?i===1?"item":"items":i===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:EC[d.type]},children:SC[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 af={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 nf({monthLabel:e,upcomingMilestones:t=[],locale:a="es",onCreateTask:r}){let n=af[a]||af.es;return jsxs("div",{className:"cal-empty",children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:n.title}),jsxs("p",{children:[n.body,jsx("br",{}),jsx("b",{children:e})]}),r?jsx("button",{type:"button",className:"cal-empty-crear",onClick:r,children:n.crear}):null,t.length>0?jsxs("div",{className:"cal-empty-hitos",children:[jsx("div",{className:"hd",children:n.upcoming}),t.map((s,o)=>jsxs("div",{className:"cal-empty-hito",children:[jsx("span",{className:"ic "+(s.type==="deadline"?"rd":"cy"),children:s.type==="deadline"?"\u2691":"\u25C6"}),s.label,jsx("span",{className:"d",children:s.date})]},o))]}):null]})}function sf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function FC(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 of=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function LC(e){return of[e%of.length]}function AC(e){return e>1?"over":e>=.9?"warn":"ok"}var eu="\xA0";function Ho(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function lf(e,t,a){let r=new Map,n=new Set;for(let l of t)l.isWeekend||l.isHoliday||n.add(sf(l.date));if(n.size===0)return r;let s=new Map;e.forEach((l,c)=>{s.set(l.userId,{color:LC(c),initials:FC(l.name)});});let o=new Map;for(let l of e)for(let c of l.dailyEstimated){if(!c.date||!n.has(c.date))continue;o.has(c.date)||o.set(c.date,new Map);let i=o.get(c.date);i.set(l.userId,(i.get(l.userId)??0)+(c.hours||0));}for(let l of n){let c=o.get(l)??new Map,i=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=i.reduce((p,d)=>p+d.hours,0);r.set(l,{assigned:Math.round(u*100)/100,capacity:a*e.length,perPerson:i});}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=sf(n.date),o=n.isWeekend||n.isHoliday,l=o?void 0:t.get(s),c=!!l&&l.capacity>0,i=c?l.assigned/l.capacity:0,p="cal-cap-cell "+(o?"off":AC(i))+(a===s?" sel":""),d=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});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":`0h${eu}/${eu}\u2014`}):jsxs(Fragment,{children:[jsxs("b",{children:[Ho(l.assigned),"h"]}),jsxs("span",{children:["/",eu,Ho(l.capacity),"h"]})]})}),jsx("div",{className:"cal-cap-track",children:c?jsx("div",{className:"cal-cap-fill",style:{width:Math.min(i*100,100)+"%"}}):null})]},n.serial)})})}function df({dayLabel:e,perPerson:t,onClose:a,style:r}){let n=useRef(null);useEffect(()=>{let i=p=>{p.key==="Escape"&&a();},u=p=>{n.current&&!n.current.contains(p.target)&&a();};return document.addEventListener("keydown",i),document.addEventListener("mousedown",u),()=>{document.removeEventListener("keydown",i),document.removeEventListener("mousedown",u);}},[a]);let s=t.reduce((i,u)=>i+u.hours,0),o=t.reduce((i,u)=>i+u.capacity,0),l=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:l?{color:"var(--red)"}:void 0,children:[Ho(s),"h asignadas / ",Ho(o),"h"]}),l?jsx("div",{className:"rng",children:jsxs("b",{children:["+",Ho(c),"h sobre capacidad"]})}):jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsx("div",{children:t.map(i=>{let u=i.capacity>0&&i.hours>i.capacity,p=i.capacity>0?i.capacity:1;return jsxs("div",{className:u?"cal-person-row over":"cal-person-row",children:[jsx("span",{className:"pava",style:{background:i.color},children:i.initials}),jsx("span",{className:"nm",title:i.name,children:i.name}),jsx("div",{className:"cal-person-track",children:jsx("div",{className:"cal-person-fill",style:{width:Math.min(i.hours/p*100,100)+"%"}})}),jsxs("span",{className:"hrs",children:[Ho(i.hours),"h / ",Ho(i.capacity),"h"]})]},i.name)})})]})}var tu=28,RC=182;function pf({grid:e,weeks:t,tasks:a,items:r,money:n,projColor:s,todaySerial:o,locale:l,capRows:c,teamSize:i,onTaskOpen:u,onMore:p,onCapDay:d}){let m=l==="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(BC,{grid:e,ws:f.ws,we:f.we,tasks:a,items:r,money:n,projColor:s,todaySerial:o,onTaskOpen:u,onMore:p}),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",i!=null?` \xB7 ${i} ${m?i===1?"persona":"personas":i===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 BC({grid:e,ws:t,we:a,tasks:r,items:n,money:s,projColor:o,todaySerial:l,onTaskOpen:c,onMore:i}){let u=useMemo(()=>Ll(r,n,t,a),[r,n,t,a]),p=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:`${RC}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),h=f>=e.monthStartSerial&&f<=e.monthEndSerial,b="cal-day";return ii(e,f)&&(b+=" wknd"),h||(b+=" out"),f===l&&(b+=" today"),p.has(f)&&(b+=" deadline-day"),jsx("div",{className:b,children:jsx("span",{className:"cal-day-num",children:v.getDate()})},f)})}),jsxs("div",{className:"cal-items",children:[u.bars.map((f,v)=>jsx("div",{onClick:()=>c?.(f.t.uid),style:{cursor:c?"pointer":"default",display:"contents"},children:jsx(Rl,{bar:f,ws:t,money:s,projColor:o,slotH:tu})},`b${v}`)),u.chips.map((f,v)=>jsx(Bl,{chip:f,ws:t,slotH:tu},`c${v}`)),u.more.map((f,v)=>jsx($l,{more:f,ws:t,slotH:tu,onClick:()=>i(f.day,f.items,r.filter(h=>h.startSerial<=f.day&&h.endSerial>=f.day))},`m${v}`))]})]})}var $C=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function OC(e){return $C.test(e)||/^task-\d+/.test(e)}function HC(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 mf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function UC(e){let t=[],a=r=>{for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);};return a(e),t}function gf(e,t){let a=UC(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,l=n.costAtCompletion,c=l!=null?mf(l):mf(o*t),i=n.assignees?.[0],u=i?.initials||(i?.name?HC(i.name):void 0),p=n.displayId||n.wbsCode||"",d=OC(p||n.id)?"":p||n.id;r.push({taskId:n.id,id:d,name:n.name,hrs:o,cost:c,who:u,projColor:n.color});}return r}function ff({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(l=>{let c=r==="$"?l.cost:`${l.hrs}h`;return jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(l.taskId),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),t(l.taskId));},children:[jsxs("div",{className:"row1",children:[l.id?jsx("span",{className:"tk",children:l.id}):null,jsx("span",{className:"pdot",style:{background:l.projColor||n}})]}),jsx("div",{className:"nom",children:l.name}),jsxs("div",{className:"meta",children:[jsxs("span",{children:[jsxs("b",{children:[l.hrs,"h"]})," est"]}),jsx("span",{children:c}),l.who?jsx("span",{className:"cal-ava",children:l.who}):null]})]},l.taskId)})]})}function bf({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 Ns(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function hf({taskName:e,taskId:t,sim:a,busy:r,locale:n,onConfirm:s,onCancel:o,style:l}){let c=useRef(null),i=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} ${i?p===1?"d\xEDa":"d\xEDas":p===1?"day":"days"} \xB7 ${Ns(a.oldProjectEnd,n)} \u2192 ${Ns(a.newProjectEnd,n)}`:`+0 ${i?"d\xEDas":"days"}${a.slackDays>0?` \xB7 ${i?"holgura":"slack"} ${a.slackDays}d`:""}`,m=p>0?i?`Confirmar +${p} ${p===1?"d\xEDa":"d\xEDas"}`:`Confirm +${p} ${p===1?"day":"days"}`:i?"Confirmar movimiento":"Confirm move";return jsxs("div",{ref:c,className:"cal-pop",style:{width:"324px",zIndex:60,...l},role:"dialog",children:[jsxs("div",{className:"cal-pop-head",children:[jsx("div",{className:"sup",children:i?"Confirmar movimiento":"Confirm move"}),jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxs("div",{className:"rng",children:[Ns(a.oldStart,n)," \u2013 ",Ns(a.oldEnd,n)," \u2192 ",jsxs("b",{children:[Ns(a.newStart,n)," \u2013 ",Ns(a.newEnd,n)]})]})]}),u?jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",i?"Esta tarea est\xE1 en ruta cr\xEDtica":"This task is on the critical path"]}):null,jsxs("div",{className:"cal-impact",children:[jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Tareas sucesoras movidas":"Successor tasks moved"}),jsx("span",{className:"v",children:a.movedSuccessors.length===0?i?"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:i?"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:i?"Ruta cr\xEDtica":"Critical path"}),jsx("span",{className:"v",children:a.stillCritical?i?"Sigue en CPM":"Stays critical":a.wasCritical?i?"Sale de CPM":"Leaves critical":i?`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:i?"Cancelar":"Cancel"}),jsx("button",{type:"button",className:u||p>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:r,children:r?i?"Guardando\u2026":"Saving\u2026":m})]})]})}var VC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function yf({grid:e,tasks:t,items:a,money:r,projColor:n,todaySerial:s,locale:o,onTaskOpen:l}){let c=o==="es",i=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(i.length===0)return jsxs("div",{className:"cal-empty",style:{position:"static",padding:"60px 24px"},children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children: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:i.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:()=>l?.(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)),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:VC[d.type]??"\xB7"}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label})]},`it${m}`))]},p.serial))})}function jC(e){let t=[],a=r=>r.forEach(n=>{t.push(n),n.subtasks?.length&&a(n.subtasks);});return a(e),t}function Ol(e){let t=e.dependencies;return Array.isArray(t)?t.map(a=>typeof a=="string"?a:a?.id).filter(a=>!!a):[]}function au(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 xf(e,t){let a=new Map(e.map(i=>[i.id,i])),r=new Map;for(let i of e)for(let u of Ol(i))r.has(u)||r.set(u,[]),r.get(u).push(i.id);let n=new Map,s=new Map,o=new Set,l=i=>{if(s.has(i))return s.get(i);if(o.has(i))return s.get(i)??0;o.add(i);let u=a.get(i);if(!u)return o.delete(i),0;let p=Ol(u).filter(f=>a.has(f)),d=t.has(i)?t.get(i):u.startDate?new Date(u.startDate).getTime():0;for(let f of p){let v=l(f);v>d&&(d=v);}let m=au(u)*864e5;return n.set(i,d),s.set(i,d+m),o.delete(i),s.get(i)};for(let i of e)l(i.id);let c=0;return s.forEach(i=>{i>c&&(c=i);}),{finish:s,start:n,projectEnd:c}}function vf(e,t,a){let r=new Map(e.map(c=>[c.id,c])),n=new Map;for(let c of e)for(let i of Ol(c))n.has(i)||n.set(i,[]),n.get(i).push(c.id);let s=new Map,o=[...e].sort((c,i)=>(t.get(i.id)??0)-(t.get(c.id)??0));for(let c of o){let i=n.get(c.id)??[];if(i.length===0)s.set(c.id,a);else {let u=1/0;for(let p of i){let d=s.get(p),m=r.get(p);d!=null&&m&&(u=Math.min(u,d-au(m)*864e5));}s.set(c.id,u===1/0?a:u);}}let l=new Set;for(let c of e){let i=(s.get(c.id)??0)-(t.get(c.id)??0);Math.abs(i)<864e5/2&&Ol(c).length+(n.get(c.id)?.length??0)>0&&l.add(c.id);}return l}function Hl(e,t,a,r){let n=jC(e),s=n.find(b=>b.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),l=new Date(s.endDate),c=xf(n,new Map),i=vf(n,c.finish,c.projectEnd),u=n.map(b=>b.id===t?{...b,startDate:a,endDate:r}:b),p=xf(u,new Map([[t,a.getTime()]])),d=vf(u,p.finish,p.projectEnd),m=new Map(u.map(b=>[b.id,b])),f=[];for(let b of n){if(b.id===t)continue;let y=c.start.get(b.id),x=p.start.get(b.id);if(y!=null&&x!=null&&Math.abs(x-y)>=864e5/2){let w=au(m.get(b.id))*864e5;f.push({id:b.id,name:b.name,newStart:new Date(x),newEnd:new Date(x+w)});}}let v=Math.round((p.projectEnd-c.projectEnd)/864e5),h=i.has(t)?0:Math.max(0,Math.round((c.projectEnd-(c.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:l,newStart:a,newEnd:r,movedSuccessors:f,projectEndDeltaDays:v,oldProjectEnd:new Date(c.projectEnd),newProjectEnd:new Date(p.projectEnd),wasCritical:i.has(t),stillCritical:d.has(t),slackDays:h}}function wf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var YC=132,Ul=26,XC="#5B7FD4";function kf({tasks:e,projectName:t,projectId:a,projectColor:r,locale:n,themeMode:s,hourlyRate:o,money:l,onMoneyChange:c,onTaskOpen:i,toolbarContainer:u,hiddenViews:p,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:m,onCreateTask:f,canReschedule:v,onReschedule:h,members:b=[],holidayDates:y=[],timesheetSettings:x,onVisibleRangeChange:w}){let[k,M]=useState("mes"),[I,C]=useState(()=>{let ie=new Date,ce={y:ie.getFullYear(),m:ie.getMonth()},He=(e??[]).map(Ye=>Ye.startDate?new Date(Ye.startDate):null).filter(Ye=>!!Ye&&!isNaN(Ye.getTime()));if(He.length===0||(e??[]).some(Ye=>{let vt=Ye.startDate?new Date(Ye.startDate):null,Yt=Ye.endDate?new Date(Ye.endDate):vt;if(!vt||isNaN(vt.getTime()))return false;let ba=new Date(ce.y,ce.m,1),ca=new Date(ce.y,ce.m+1,0,23,59,59);return vt<=ca&&(Yt??vt)>=ba}))return ce;let ft=He.reduce((Ye,vt)=>Ye<vt?Ye:vt);return {y:ft.getFullYear(),m:ft.getMonth()}}),[N,P]=useState(false),[T,V]=useState([]),[O,J]=useState("all"),[L,Ie]=useState(null),[G,ke]=useState(null),[R,U]=useState(false),[Pe,Ze]=useState(null),[oe,Fe]=useState(false),Q=useMemo(()=>Y0(I.y,I.m),[I.y,I.m]),Se=r||XC,Ue=useMemo(()=>{let ie=new Set;for(let ce of y){let He=new Date(`${ce}T12:00:00`),at=Q.dateToSerial(He);at>=1&&at<=42&&ie.add(at);}return ie},[y,Q]);useEffect(()=>{w?.({start:wf(Q.serialToDate(1)),end:wf(Q.serialToDate(42))});},[I.y,I.m]);let Le=b.length,Be=useMemo(()=>{let ie=x?.hoursPerDay;if(!ie)return 8;let ce=[ie.monday,ie.tuesday,ie.wednesday,ie.thursday,ie.friday].map(He=>He||0).filter(He=>He>0);return ce.length?Math.round(ce.reduce((He,at)=>He+at,0)/ce.length*10)/10:8},[x]),ot=useMemo(()=>Al({tasks:e,grid:Q,projectColor:()=>Se,hourlyRate:o,projectId:a}),[e,Q,Se,o,a]),se=useMemo(()=>{if(d===false)return [];let ie=new Map;for(let ce of ot.calTasks)ce.phaseId&&ce.phaseName&&ie.set(ce.phaseId,ce.phaseName);return [...ie.entries()].map(([ce,He])=>({id:ce,name:He})).sort((ce,He)=>ce.name.localeCompare(He.name))},[ot.calTasks,d]),je=!T.includes("tareas"),Xe=!T.includes("cpm"),$e=useMemo(()=>{let ie=je?ot.calTasks:[];return O!=="all"&&(ie=ie.filter(ce=>ce.phaseId===O)),Xe||(ie=ie.map(ce=>ce.critical?{...ce,critical:false}:ce)),ie},[ot.calTasks,je,Xe,O]),mt=useMemo(()=>{let ie=new Set;return T.includes("hitos")&&(ie.add("hito"),ie.add("desembolso")),T.includes("ext")&&ie.add("ext"),T.includes("aus")&&ie.add("aus"),ot.dayItems.filter(ce=>!ie.has(ce.type))},[ot.dayItems,T]),Et=!T.includes("festivos"),st=new Date,Ne=Q.dateToSerial(new Date(st.getFullYear(),st.getMonth(),st.getDate())),lt=ie=>V(ce=>ce.includes(ie)?ce.filter(He=>He!==ie):[...ce,ie]),Mt=()=>C(ie=>{let ce=new Date(ie.y,ie.m-1,1);return {y:ce.getFullYear(),m:ce.getMonth()}}),Oe=()=>C(ie=>{let ce=new Date(ie.y,ie.m+1,1);return {y:ce.getFullYear(),m:ce.getMonth()}}),xt=()=>{let ie=new Date;C({y:ie.getFullYear(),m:ie.getMonth()});},A=(ie,ce,He)=>{if(!v||ce===0)return;let at=ot.calTasks.find(ba=>ba.uid===ie);if(!at)return;let ft=ce*864e5,Ye=new Date(at.realStart.getTime()+ft),vt=new Date(at.realEnd.getTime()+ft),Yt=Hl(e,ie,Ye,vt);Yt&&Ze({uid:ie,taskId:at.id,taskName:at.name,sim:Yt,anchor:He});},X=async()=>{if(!Pe||!h)return;Fe(true);let ie=[{id:Pe.uid,startDate:Pe.sim.newStart,endDate:Pe.sim.newEnd},...Pe.sim.movedSuccessors.map(He=>({id:He.id,startDate:He.newStart,endDate:He.newEnd}))],ce=await h(ie);Fe(false),ce&&Ze(null);},we=Q0(I.y,I.m,n),B=[{id:"",name:t,color:Se}],q=useMemo(()=>gf(e,o),[e,o]),he=useMemo(()=>{if(k==="lookahead"){let ie=Q.weeks.find(He=>Ne>=He.ws&&Ne<=He.we)??Q.weeks[0],ce=Q.weeks.indexOf(ie);return Q.weeks.slice(ce,ce+2)}return k==="semana"?[Q.weeks.find(ce=>Ne>=ce.ws&&Ne<=ce.we)??Q.weeks[0]]:[]},[k,Q.weeks,Ne]),Ae=useMemo(()=>{let ie={};return he.forEach((ce,He)=>{let at=[];for(let Ye=ce.ws;Ye<=ce.we;Ye++)at.push({serial:Ye,date:Q.serialToDate(Ye),isWeekend:ii(Q,Ye),isHoliday:Ue.has(Ye)});let ft=lf(b,at,Be);ie[He]={days:at,capByDay:ft};}),ie},[he,Q,Ue,b,Be]),ye=k==="semana"||k==="lookahead",tt=k==="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(Zd,{enCabecera:true,hiddenViews:p,view:k,onViewChange:M,money:l==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:ie=>c(ie==="$"?"$":"Hrs"),projectLabel:t,locale:n})}),u):jsx(Zd,{view:k,onViewChange:M,money:l==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:ie=>c(ie==="$"?"$":"Hrs"),projectLabel:t,locale:n,hiddenViews:p}),jsx(ef,{monthLabel:we,onPrev:Mt,onNext:Oe,onToday:xt,layersOpen:N,onToggleLayers:()=>P(ie=>!ie),layersOff:T,phases:se,phaseFilter:O,onPhaseChange:J,locale:n,children:N?jsx(tf,{off:T,onToggle:lt}):null}),jsxs("div",{className:"cal-body",children:[jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:tt?"hidden":void 0},children:[tt?jsx(yf,{grid:Q,tasks:$e,items:mt,money:l,projColor:Se,todaySerial:Ne,locale:n,onTaskOpen:i}):ye?jsxs(Fragment,{children:[jsx(Il,{locale:n}),jsx(pf,{grid:Q,weeks:he,tasks:$e,items:mt,money:l,projColor:Se,todaySerial:Ne,locale:n,capRows:Ae,teamSize:Le,onTaskOpen:i,onMore:(ie,ce,He)=>Ie({day:ie,items:ce,tasks:He}),onCapDay:(ie,ce,He)=>{for(let at of Object.keys(Ae)){let ft=Ae[+at].capByDay.get(ie);if(ft){ke({dayLabel:ce,perPerson:ft.perPerson,anchor:He.getBoundingClientRect()});break}}}})]}):ot.isEmpty?jsxs(Fragment,{children:[jsx(Il,{locale:n}),jsx("div",{className:"cal-weeks",children:Q.weeks.map(ie=>jsx(Cf,{grid:Q,ws:ie.ws,we:ie.we,todaySerial:Ne,showFestivos:Et,holidaySerials:Ue,locale:n,deadlineDays:new Set},ie.ws))}),jsx(nf,{monthLabel:we,locale:n,onCreateTask:f})]}):jsxs(Fragment,{children:[jsx(Il,{locale:n}),jsx("div",{className:"cal-weeks",children:Q.weeks.map(ie=>jsx(JC,{grid:Q,ws:ie.ws,we:ie.we,tasks:$e,items:mt,money:l,projColor:Se,todaySerial:Ne,showFestivos:Et,holidaySerials:Ue,locale:n,onTaskOpen:i,onMore:(ce,He,at)=>Ie({day:ce,items:He,tasks:at}),canReschedule:v,onDragReschedule:A,pendingGhost:Pe?{uid:Pe.uid,days:Math.round((Pe.sim.newStart.getTime()-Pe.sim.oldStart.getTime())/864e5)}:null},ie.ws))})]}),L?jsx(rf,{dayLabel:`${Q.serialToDate(L.day).getDate()}`,items:L.items,tasks:L.tasks.map(ie=>({swatch:Se,taskId:ie.id,label:ie.name,critical:ie.critical,value:l==="$"?ie.cost:`${ie.hrs}h`})),onClose:()=>Ie(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40},locale:n==="en"?"en":"es"}):null,G?jsx(df,{dayLabel:G.dayLabel,perPerson:G.perPerson,onClose:()=>ke(null),style:{position:"fixed",top:`${G.anchor.top-8}px`,left:`${G.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,Pe?jsx(hf,{taskName:Pe.taskName,taskId:Pe.sim.taskId,sim:Pe.sim,busy:oe,locale:n,onConfirm:X,onCancel:()=>Ze(null),style:{position:"fixed",top:`${Pe.anchor.top+12}px`,left:`${Math.min(Pe.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),R?jsx(ff,{items:q,money:l,projColor:Se,onItemClick:ie=>i?.(ie),onCollapse:()=>U(false),locale:n==="en"?"en":"es"}):jsx(bf,{onExpand:()=>U(true),locale:n==="en"?"en":"es"})]}),jsx(Z0,{projects:B,locale:n==="en"?"en":"es"})]})}function Cf({grid:e,ws:t,we:a,todaySerial:r,showFestivos:n,holidaySerials:s,deadlineDays:o}){let l=[];for(let c=t;c<=a;c++)l.push(c);return jsx("div",{className:"cal-week-bg",children:l.map(c=>{let i=e.serialToDate(c),u=c>=e.monthStartSerial&&c<=e.monthEndSerial,p=n&&s.has(c),d="cal-day";return ii(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:i.getDate()}),p?jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},c)})})}function JC({grid:e,ws:t,we:a,tasks:r,items:n,money:s,projColor:o,todaySerial:l,showFestivos:c,holidaySerials:i,locale:u,onTaskOpen:p,onMore:d,canReschedule:m,onDragReschedule:f,pendingGhost:v}){let h=useMemo(()=>Ll(r,n,t,a),[r,n,t,a]),b=useMemo(()=>new Set(n.filter(I=>I.type==="deadline").map(I=>I.serial)),[n]),y=Math.max(YC,h.laneCount*Ul+36),x=useRef(null),[w,k]=useState(null),M=(I,C)=>{if(!m||!f){p?.(C);return}I.preventDefault();let N=x.current;if(!N)return;let P=N.getBoundingClientRect().width/7,T=I.clientX,V=0,O=L=>{let Ie=Math.round((L.clientX-T)/P);V=Ie,k({id:C,days:Ie});},J=L=>{if(window.removeEventListener("pointermove",O),window.removeEventListener("pointerup",J),k(null),V===0){p?.(C);return}let Ie=new DOMRect(L.clientX,L.clientY,0,0);f(C,V,Ie);};window.addEventListener("pointermove",O),window.addEventListener("pointerup",J);};return jsxs("div",{ref:x,className:"cal-week",style:{minHeight:`${y}px`},children:[jsx(Cf,{grid:e,ws:t,we:a,todaySerial:l,showFestivos:c,holidaySerials:i,locale:u,deadlineDays:b}),jsxs("div",{className:"cal-items",children:[h.bars.map((I,C)=>{let N=w?.id===I.t.uid?w.days:null,P=v?.uid===I.t.uid?v.days:null,T=N??P??0,V=N==null&&P!=null,O=T!==0?{...I,s:I.s+T,e:I.e+T}:I;return jsx("div",{onPointerDown:J=>M(J,I.t.uid),style:{cursor:m?"grab":p?"pointer":"default",display:"contents",opacity:V?.6:1},children:jsx(Rl,{bar:O,ws:t,money:s,projColor:o,slotH:Ul})},`b${C}`)}),h.chips.map((I,C)=>jsx(Bl,{chip:I,ws:t,slotH:Ul},`c${C}`)),h.more.map((I,C)=>jsx($l,{more:I,ws:t,slotH:Ul,onClick:()=>d(I.day,I.items,r.filter(N=>N.startSerial<=I.day&&N.endSerial>=I.day))},`m${C}`))]})]})}function ZC({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:l}){let[c,i]=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(b=>b.assignedUserIds||[])).size,v=u.map(b=>b.priority).filter(Boolean),h=new Set(u.flatMap(b=>b.labels||[])).size;return {totalCards:m,uniqueAssignees:f,priorities:v,labels:h}},[u]),d=()=>{n?.(e.id);};return jsxs("div",{className:g("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick: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 Nf={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 di(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 Df(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 Sf({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:n,selectedEventId:s,config:o,className:l}){let c=useMemo(()=>({...Nf,...o}),[o]),[i,u]=useState(new Set),p=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],k=y.get(w);k?k.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((k,M)=>M.timestamp.getTime()-k.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=>{u(x=>{let w=new Set(x);return w.has(y)?w.delete(y):w.add(y),w});},h=y=>{let w=new Date().getTime()-y.getTime(),k=Math.floor(w/6e4),M=Math.floor(w/36e5),I=Math.floor(w/864e5);return k<1?"just now":k<60?`${k}m ago`:M<24?`${M}h ago`:I<7?`${I}d ago`:y.toLocaleDateString()},b=useMemo(()=>{let y=0;return t.types&&t.types.length>0&&y++,t.users&&t.users.length>0&&y++,t.dateRange&&y++,t.searchTerm&&y++,y},[t]);return useEffect(()=>{if(s&&p.current){let y=p.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:g("history-timeline-empty",l),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:g("history-timeline",c.compact&&"compact",l),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange: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:[di(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})})]}),b>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",b,")"]})]}),jsx("div",{className:"history-timeline-container",ref:p,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 k=i.has(x.id),M=s===x.id,I=Df(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:I},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:di(x.type)})}),w<y.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:I}})]}),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?h(x.timestamp):x.timestamp.toLocaleString()})]}),Object.keys(x.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),v(x.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(x.changes).map(([C,N])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[C,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(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)})]})]},C)),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(([C,N])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[C,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(N)})]},C))]})]})]})]},x.id)})})]},y.date?.toISOString()||"all"))})]})}function Mf({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:l,onSpeedChange:c,className:i}){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",i),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:g("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:p&&di(p.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:p&&ci(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=>l(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:()=>l(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: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",i),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function nu(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 ou(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 Pf(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 Ff(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function o2(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})),l=new Map(o.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;o.forEach(u=>{let p=a/2,d=r/2;u.vx+=(p-u.x)*n.centerForce*i,u.vy+=(d-u.y)*n.centerForce*i,o.forEach(m=>{if(u.id===m.id)return;let f=u.x-m.x,v=u.y-m.y,h=Math.sqrt(f*f+v*v)||1,b=n.chargeStrength*i/(h*h);u.vx+=f/h*b,u.vy+=v/h*b;});}),t.forEach(u=>{let p=l.get(typeof u.source=="string"?u.source:u.source.id),d=l.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,h=(v-n.linkDistance)/v*n.forceStrength*i;p.vx+=m*h,p.vy+=f*h,d.vx-=m*h,d.vy-=f*h;}),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 Lf({nodes:e,edges:t,config:a,filter:r,onFilterChange:n,criticalPath:s,stats:o,onInteraction:l,className:c}){let i=useRef(null),[u,p]=useState([]),[d,m]=useState(null),[f,v]=useState(null),[h,b]=useState(null),[y,x]=useState(1),[w,k]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let O=o2(e,t,a.width,a.height,a,150);p(O);},[e,t,a]);let M=useCallback((O,J)=>{a.enableDragging&&(J.stopPropagation(),m(O));},[a.enableDragging]),I=useCallback(O=>{if(!d||!i.current)return;let L=i.current.getBoundingClientRect(),Ie=(O.clientX-L.left-w.x)/y,G=(O.clientY-L.top-w.y)/y;p(ke=>ke.map(R=>R.id===d?{...R,x:Ie,y:G,fx:Ie,fy:G}:R));},[d,y,w]),C=useCallback(()=>{m(null);},[]),N=useCallback((O,J)=>{J.stopPropagation(),l?.({type:"node-click",node:O,position:{x:J.clientX,y:J.clientY}});},[l]),P=useCallback((O,J)=>{J.stopPropagation(),l?.({type:"edge-click",edge:O,position:{x:J.clientX,y:J.clientY}});},[l]),T=useCallback(O=>{let J=u.find(L=>L.id===O);return J?{x:J.x,y:J.y}:{x:0,y:0}},[u]),V=useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let J=O.card.priority;return J==="URGENT"?"#ef4444":J==="HIGH"?"#f59e0b":J==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return O.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(O=>Math.min(O+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x(O=>Math.max(O-.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(O=>O.type))).map(O=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:nu(O)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Pf(O)," ",ou(O)]})]},O))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:I,onMouseUp:C,onMouseLeave:C,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${y})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let J=T(typeof O.source=="string"?O.source:O.source.id),L=T(typeof O.target=="string"?O.target:O.target.id),Ie=Ff(O.type),G=h===O.id,ke=O.onCriticalPath;return jsxs("g",{className:g("relationships-graph-edge",G&&"hovered",ke&&"critical"),onMouseEnter:()=>b(O.id),onMouseLeave:()=>b(null),onClick:R=>P(O,R),children:[jsx("line",{x1:J.x,y1:J.y,x2:L.x,y2:L.y,stroke:nu(O.type),strokeWidth:ke?a.edgeWidth*2:a.edgeWidth,strokeOpacity:G?1:.6,markerEnd:Ie?"url(#arrowhead)":void 0}),a.showEdgeLabels&&G&&jsx("text",{x:(J.x+L.x)/2,y:(J.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:ou(O.type)})]},O.id)})}),jsx("g",{className:"relationships-graph-nodes",children:u.map(O=>{let J=f===O.id,L=O.onCriticalPath;return jsxs("g",{className:g("relationships-graph-node",J&&"hovered",L&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:Ie=>M(O.id,Ie),onMouseEnter:()=>v(O.id),onMouseLeave:()=>v(null),onClick:Ie=>N(O,Ie),children:[jsx("circle",{r:L?a.nodeSize*1.2:a.nodeSize,fill:V(O),stroke:L?"#fbbf24":"#ffffff",strokeWidth:L?3:2,opacity:J?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.id)})})]}),jsx("defs",{children:jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Rf({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:n}){let[s,o]=useState(""),[l,c]=useState(false),[i,u]=useState(null),[p,d]=useState(null),m=useRef(null),f=l||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(""),u(null),d(null),t());},h=async()=>{if(!(!s.trim()||f)){c(true),u(null),d(null);try{let y=await r(s.trim());d(y);}catch(y){u(y instanceof Error?y.message:"Failed to generate plan");}finally{c(false);}}},b=()=>{p&&(a(p),v());};return e?jsxs(ia,{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: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((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 (",p.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[p.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)),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:y=>o(y.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled:f}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((y,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"}),p?jsx("button",{onClick:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:h,disabled:!s.trim()||f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:f?"Generating...":"Generate Plan"})]})]})]})})]}):null}var su={"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 i2={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},l2={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 c2(e,t,a){let r=su[e];if(!r)throw new Error(`Unknown model: ${e}`);let n=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return n+s}function ui(e){return `$${e.toFixed(4)}`}var iu=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=c2(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),l=a.filter(p=>p.success),c=a.reduce((p,d)=>p+d.duration,0),i={},u={};return a.forEach(p=>{i[p.feature]=(i[p.feature]||0)+1,u[p.feature]=(u[p.feature]||0)+p.cost;}),{totalOperations:r,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?c/r:0,successRate:r>0?l.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,o=new Date;a==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let l=this.operations.filter(u=>u.timestamp>=o).length,c=Math.max(0,n-l),i=l/n*100;return {used:l,limit:n,remaining:c,percentUsed:i,isExceeded:l>=n}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Wo=new iu;function Of({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,n]=useState(Wo.getStats()),[s,o]=useState(Wo.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{n(Wo.getStats()),o(Wo.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),useEffect(()=>{let c=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let l=Wo.getRecentOperations(5);return jsxs(ia,{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:ui(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,i])=>{let u=r.costsByFeature[c]||0,p=r.totalOperations>0?i/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children: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:[i," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ui(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"}),l.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:l.map(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:ui(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 Wf({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:n,projectName:s}){let[o,l]=useState(""),[c,i]=useState(""),[u,p]=useState(""),[d,m]=useState(false),[f,v]=useState(null),[h,b]=useState(null),[y,x]=useState(null),w=useRef(null),k=d||n;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let P=T=>{T.key==="Escape"&&!k&&M();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,k]);let M=()=>{k||(l(""),i(""),p(""),v(null),b(null),x(null),t());},I=async()=>{if(!(!o.trim()||k)){m(true),v(null),b(null),x(null);try{let P=await r({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});b(P.tasks.tasks),x({from_cache:P.from_cache,tokens_used:P.tokens_used,mock_mode:P.mock_mode,similarity:P.similarity,tokens_saved:P.tokens_saved});}catch(P){v(P instanceof Error?P.message:"Failed to generate tasks");}finally{m(false);}}},C=()=>{h&&(a(h),M());};if(!e)return null;let N=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxs(ia,{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:P=>P.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick: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:h?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[y?.mock_mode&&jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),y?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-[#00E5CC]/20 text-[#00E5CC] border border-[#00E5CC]/30",children:["From Cache (",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:[y?.tokens_used||0," tokens"]}),y?.tokens_saved&&jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[y.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[h.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((P,T)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxs("span",{className:"text-xs text-white/50",children:["#",T+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:P.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),P.start," \u2192 ",P.end]}),jsxs("span",{children:[P.duration," days"]}),P.dependencies.length>0&&jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",P.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${P.priority==="high"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:P.priority})]})},P.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:w,value:o,onChange:P=>l(P.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled: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:P=>i(P.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled: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:P=>p(P.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled: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((P,T)=>jsx("button",{onClick:()=>l(P),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:P},T))})]})]})}),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"}),h?jsx("button",{onClick:C,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:I,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 Gl({initialBoard:e,onPersist:t}){let[a,r]=useState(e),n=useCallback(h=>{t&&Ci(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,y,x)=>{console.warn(`Retry attempt ${y} after ${x}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=useCallback(async(h,b,y)=>{r(x=>{let w=x.cards.find(P=>P.id===h);if(!w)return x;let k=w.columnId,M={...w,columnId:b,position:y},I=x.cards.map(P=>P.id===h?M:P),C=x.columns.map(P=>{if(P.id===k)return {...P,cardIds:P.cardIds.filter(T=>T!==h)};if(P.id===b){let T=I.filter(V=>V.columnId===b).sort((V,O)=>V.position-O.position);return {...P,cardIds:T.map(V=>V.id)}}return P}),N={...x,cards:I,columns:C};return n(N),N});},[n]),o=useCallback(async(h,b)=>{r(y=>{let x=y.cards.map(k=>k.id===h?{...k,...b}:k),w={...y,cards:x};return n(w),w});},[n]),l=useCallback(async h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let x={...h,id:b},w=y.columns.map(M=>M.id===h.columnId?{...M,cardIds:[...M.cardIds,b]}:M),k={...y,cards:[...y.cards,x],columns:w};return n(k),k});},[n]),c=useCallback(async h=>{r(b=>{let y=b.cards.find(M=>M.id===h);if(!y)return b;let x=b.cards.filter(M=>M.id!==h),w=b.columns.map(M=>M.id===y.columnId?{...M,cardIds:M.cardIds.filter(I=>I!==h)}:M),k={...b,cards:x,columns:w};return n(k),k});},[n]),i=useCallback(async h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let x={...h,id:b,cardIds:[]},w={...y,columns:[...y.columns,x]};return n(w),w});},[n]),u=useCallback(async(h,b)=>{r(y=>{let x=y.columns.map(k=>k.id===h?{...k,...b}:k),w={...y,columns:x};return n(w),w});},[n]),p=useCallback(async h=>{r(b=>{let y=b.cards.filter(k=>k.columnId!==h),x=b.columns.filter(k=>k.id!==h),w={...b,cards:y,columns:x};return n(w),w});},[n]),d=useCallback(h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),b},[l]),m=useCallback(h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),b},[i]),f=useCallback(()=>{r(h=>{let b={...h,cards:[],columns:[]};return n(b),b});},[n]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:p},setBoard:r,helpers:{addCard:d,addColumn:m,deleteCard:c,deleteColumn:p,clearBoard:f}}}function Gf({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:n,helpers:s}=Gl({initialBoard:e,onPersist:a}),o=useMemo(()=>({addCard:(c,i,u={})=>{s.addCard({title:i,columnId:c,position:r.cards.filter(p=>p.columnId===c).length,...u});},addColumn:(c,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(p=>p.position)):0;s.addColumn({title:c,position:i??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:n,availableUsers:t}),[r,n,t]),board:r,callbacks:n,utils:o}}var pi={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},jf={by:"none",order:"asc"};function _f({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,n]=useState({...pi,...e}),[s,o]=useState({...jf,...t}),l=useCallback(v=>{n(h=>({...h,...v}));},[]),c=useCallback(v=>{o(h=>({...h,...v}));},[]),i=useCallback(()=>{n(pi),o(jf);},[]),u=useCallback(()=>{a&&n({...pi,assignees:[a]});},[a]),p=useCallback(()=>{n({...pi,dateFilter:"overdue"});},[]),d=useCallback(()=>{n({...pi,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 h=[...v];if(r.search){let b=r.search.toLowerCase();h=h.filter(y=>y.title.toLowerCase().includes(b)||y.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,y=b.getFullYear(),x=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),k=`${y}-${x}-${w}`;h=h.filter(M=>{if(!M.endDate&&!M.dueDate)return false;let I=M.endDate||M.dueDate;if(!I)return false;let C;if(typeof I=="string")C=I.split("T")[0]||I;else {let N=I.getUTCFullYear(),P=String(I.getUTCMonth()+1).padStart(2,"0"),T=String(I.getUTCDate()).padStart(2,"0");C=`${N}-${P}-${T}`;}switch(r.dateFilter){case "overdue":return C<k;case "today":return C===k;case "this-week":let N=new Date(k+"T00:00:00"),P=new Date(C+"T00:00:00"),T=new Date(N);return T.setDate(T.getDate()+7),P>=N&&P<=T;case "custom":if(r.dateRange){let V=typeof I=="string"?new Date(I):I;return V>=r.dateRange.start&&V<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(b=>b.priority&&r.priorities.includes(b.priority))),r.assignees.length>0&&(h=h.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(x=>r.assignees.includes(x)))),r.labels.length>0&&(h=h.filter(b=>b.labels&&b.labels.some(y=>r.labels.includes(y)))),r.columns.length>0&&(h=h.filter(b=>r.columns.includes(b.columnId))),s.by!=="none"&&h.sort((b,y)=>{let x=0;switch(s.by){case "created":let w=b.createdAt?new Date(b.createdAt).getTime():0,k=y.createdAt?new Date(y.createdAt).getTime():0;x=w-k;break;case "priority":let M={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},I=M[b.priority||"LOW"],C=M[y.priority||"LOW"];x=I-C;break;case "dueDate":let N=b.endDate||b.dueDate,P=y.endDate||y.dueDate;if(!N)return 1;if(!P)return -1;let T=typeof N=="string"?new Date(N).getTime():N.getTime(),V=typeof P=="string"?new Date(P).getTime():P.getTime();x=T-V;break;case "title":x=b.title.localeCompare(y.title);break;case "estimate":let O=b.estimatedTime||0,J=y.estimatedTime||0;x=O-J;break;default:x=0;}return s.order==="asc"?x:-x}),h},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:u,filterOverdue:p,filterHighPriority:d,applyFilters:f,hasActiveFilters:m}}var qf,Yf;if(typeof window<"u")try{let e=vi("ai");qf=e.generateObject,Yf=e.generateText;}catch{}function Xf(e={}){let[t,a]=useState(false),[r,n]=useState(null),s=!!(qf&&Yf&&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]),l=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]),i=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:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function cu(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(n=>{t(n);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function Jf(e){let{cards:t}=e,[a,r]=cu(),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(b=>b.id===p),h=t.find(b=>b.id===a.lastSelectedCardId);if(v&&h&&v.columnId===h.columnId){let b=t.filter(C=>C.columnId===v.columnId).sort((C,N)=>C.position-N.position),y=b.findIndex(C=>C.id===a.lastSelectedCardId),x=b.findIndex(C=>C.id===p),[w,k]=y<x?[y,x]:[x,y],M=b.slice(w,k+1).map(C=>C.id),I=Array.from(new Set([...a.selectedCardIds,...M]));r({selectedCardIds:I,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]),l=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=useCallback(()=>{r({selectedCardIds:t.map(p=>p.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=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:l,selectAll:c,toggleCard:i,getSelectedCards:u}}var Qf={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Zf(e){let{cards:t,config:a,aiService:r}=e,n=useMemo(()=>({...Qf,...a}),[a]),[s,o]=useState([]),l=useCallback((v,h,b,y,x)=>{if(h.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:v,cardIds:h,columnId:b,strategy:y,color:x,isExpanded:true,position:s.filter(k=>k.columnId===b).length,createdAt:new Date};o(k=>[...k,w]);},[n.minCardsPerStack,s]),c=useCallback(v=>{o(h=>h.filter(b=>b.id!==v));},[]),i=useCallback(v=>{o(h=>h.map(b=>b.id===v?{...b,isExpanded:!b.isExpanded}:b));},[]),u=useCallback((v,h)=>{o(b=>b.map(y=>y.id===v&&!y.cardIds.includes(h)?{...y,cardIds:[...y.cardIds,h]}:y));},[]),p=useCallback((v,h)=>{o(b=>b.map(y=>{if(y.id===v){let x=y.cardIds.filter(w=>w!==h);return x.length<n.minCardsPerStack?null:{...y,cardIds:x}}return y}).filter(y=>y!==null));},[n.minCardsPerStack]),d=useCallback(v=>s.filter(h=>h.columnId===v).sort((h,b)=>h.position-b.position),[s]),m=useCallback(async v=>{let h=t.filter(k=>k.columnId===v);if(h.length<n.minCardsPerStack*2)return [];let b=[],y=new Map;h.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(M=>{y.has(M)||y.set(M,[]),y.get(M).push(k);});}),y.forEach((k,M)=>{k.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${M}`,cardIds:k.map(I=>I.id),columnId:v,strategy:"labels",color:"#00E5CC"},reason:`${k.length} cards with label "${M}"`,confidence:.85});});let x=new Map;h.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&&b.push({stack:{title:`\u{1F464} Assigned to user-${M.slice(-4)}`,cardIds:k.map(I=>I.id),columnId:v,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(h.forEach(k=>{k.priority&&(w.has(k.priority)||w.set(k.priority,[]),w.get(k.priority).push(k));}),w.forEach((k,M)=>{if(k.length>=n.minCardsPerStack){let I={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[M.toLowerCase()]||"\u26AA";b.push({stack:{title:`${I} ${M} Priority`,cardIds:k.map(C=>C.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 h){let I=(await r.findSimilar(k,h)).filter(C=>C.similarity>=n.autoStackConfidenceThreshold);if(I.length>=n.minCardsPerStack-1){let C=[k.id,...I.map(P=>P.card.id)],N=I.reduce((P,T)=>P+T.similarity,0)/I.length;b.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:C,columnId:v,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${I.length+1} similar tasks`,confidence:N});}}return b.filter(k=>k.confidence>=n.autoStackConfidenceThreshold).sort((k,M)=>M.confidence-k.confidence).slice(0,5)},[t,n,r]),f=useCallback(v=>{l(v.stack.title,v.stack.cardIds,v.stack.columnId,v.stack.strategy,v.stack.color);},[l]);return useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let b=await m(h),y=b[0];b.length>0&&y&&y.confidence>=.9&&f(y);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:u,removeFromStack:p,getStacksForColumn:d,getSuggestions:m,applySuggestion:f,config:n}}var eb=createContext(null);function tb({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:i}=vi("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=vi("@libxai/core");o.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=vi("@libxai/core");l=new c(t.board);}r.current=new BoardStore({board:l,columns:s,cards:o});}let n=r.current;return useEffect(()=>{if(a)return n.subscribeAll(s=>{a(n.getState());})},[n,a]),jsx(eb.Provider,{value:{store:n},children:e})}function Vl(){let e=useContext(eb);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function gi(){let e=Vl(),[t,a]=useState(e.getBoard()),[r,n]=useState(e.getAllColumns()),[s,o]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let l=useCallback(y=>{e.updateBoard(y);},[e]),c=useCallback(y=>{e.addColumn(y);},[e]),i=useCallback((y,x)=>{e.updateColumn(y,x);},[e]),u=useCallback(y=>{e.deleteColumn(y);},[e]),p=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]),h=useCallback(y=>e.getCard(y),[e]),b=useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:u,getColumn:p,addCard:d,updateCard:m,deleteCard:f,moveCard:v,getCard:h,getCardsByColumn:b}}function rb(e){let{cards:t}=gi();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 nb(e="position",t="asc"){let{cards:a}=gi();return useMemo(()=>[...a].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=n.priority?l[n.priority]:0,i=s.priority?l[s.priority]:0;o=c-i;break}case "createdAt":o=n.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":o=n.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":o=n.position-s.position;break}return t==="asc"?o:-o}),[a,e,t])}var jl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Vu.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let n=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let l=await Promise.resolve(o.apply(s,a));l!==void 0&&(n=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,a){let r=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(n,a)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(r);}},D2=new jl;function sb({items:e,height:t,estimateSize:a,renderItem:r,className:n="",overscan:s=5,horizontal:o=false,gap:l=0,getItemKey:c}){let i=useRef(null),u=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:o,gap:l}),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:i,style:d,className:n,children:jsx("div",{style:m,children:p.map(f=>{let v=e[f.index];if(!v)return null;let h=c?c(v,f.index):f.index,b={position:"absolute",top:o?0:f.start,left:o?f.start:0,width:o?f.size:"100%",height:o?"100%":f.size};return jsx("div",{style:b,"data-index":f.index,children:r(v,f.index)},h)})})})}function ib(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 cb({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:n,className:s="",overscan:o=3,gap:l=16,getItemKey:c,horizontal:i=true}){let u=useRef(null),p=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:o,gap:l}),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 h=e[v.index];if(!h)return null;let b=c?c(h,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(h,v.index)},b)})})})}function db(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 ub(e,t=10){return e>t}var mu={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},gu={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},fu={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},bu={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},hu={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},yu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},xu={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},vu={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)"},wu={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)"},ku={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Cu={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}},Tu={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}},_l={spacing:mu,borderRadius:gu,fontSize:fu,fontWeight:bu,lineHeight:hu,zIndex:yu,duration:xu,easing:vu,shadows:wu,opacity:ku,kanban:Cu,gantt:Tu};function pb(e,t,a){return e[t]??a}function Nu(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)?Nu(n,s,a):(typeof n=="string"||typeof n=="number")&&(a[s]=n);}return a}function M2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Du(e="asakaa"){let t=Nu(_l),a=[];for(let[r,n]of Object.entries(t)){let s=`--${e}-${r}`,o=M2(n);a.push(` ${s}: ${o};`);}return `:root {
|
|
415
|
+
${a.join(`
|
|
416
416
|
`)}
|
|
417
|
-
}`}function fi(e,t="asakaa"){let
|
|
418
|
-
${
|
|
417
|
+
}`}function fi(e,t="asakaa"){let a=[],r=Nu(e);for(let[n,s]of Object.entries(r)){let o=`--${t}-color-${n}`;a.push(` ${o}: ${s};`);}return `:root {
|
|
418
|
+
${a.join(`
|
|
419
419
|
`)}
|
|
420
|
-
}`}var Kl={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"}},Su={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"}},Eu={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 Mu(e=Kl,t="asakaa"){let
|
|
420
|
+
}`}var Kl={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"}},Su={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"}},Eu={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 Mu(e=Kl,t="asakaa"){let a=Du(t),r=fi(e,t);return `${a}
|
|
421
421
|
|
|
422
|
-
${
|
|
422
|
+
${r}`}function mb(){return `/**
|
|
423
423
|
* ASAKAA Design Tokens
|
|
424
424
|
* Auto-generated from design-tokens.ts
|
|
425
425
|
* Do not edit this file directly
|
|
@@ -440,6 +440,6 @@ ${fi(Eu,"asakaa").split(`
|
|
|
440
440
|
`).slice(1,-1).join(`
|
|
441
441
|
`)}
|
|
442
442
|
}
|
|
443
|
-
`}var
|
|
444
|
-
export{Of as AIUsageDashboard,
|
|
443
|
+
`}var P2=({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 gb({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:n,themes:s}=ss();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([o,l])=>{let c=o,i=c===r;return jsxs("button",{onClick:()=>n(c),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${l.displayName} theme`,"aria-pressed":i,title:l.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(P2,{theme:c})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:l.displayName})]},c)})})}
|
|
444
|
+
export{Of as AIUsageDashboard,l2 as AI_FEATURES,su as AI_MODELS,Pc as AddCardButton,Nc as AddColumnButton,rs as AttachmentUploader,tb as BoardProvider,Ki as BulkOperationsToolbar,Oc as BurnDownChart,j0 as CUSTOM_FIELD_TYPES,kf as CalendarBoard,In as Card,Mf as CardHistoryReplay,Sf as CardHistoryTimeline,Lf as CardRelationshipsGraph,ZC as CardStack,jc as CardTemplateSelector,nc as CircuitBreaker,Qo as Column,Zi as ColumnManager,Ac as CommandPalette,Yc as ConfigMenu,cs as ContextMenu,Vs as DEFAULT_SHORTCUTS,G0 as DEFAULT_TABLE_COLUMNS,Vc as DEFAULT_TEMPLATES,Ps as DateRangePicker,Ls as DependenciesSelector,Js as DependencyLine,Hc as DistributionCharts,pc as EditableColumnTitle,as as ErrorBoundary,Im as ExportDropdown,Kc as ExportImportModal,qc as FilterBar,fg as GANTT_AI_SYSTEM_PROMPT,ul as GanttAIAssistant,ug as GanttBoard,ls as GanttI18nContext,il as GanttMilestone,Qi as GanttToolbar,Wf as GenerateGanttTasksDialog,Rf as GeneratePlanModal,zc as GroupBySelector,yc as HealthBar,eo as KanbanBoard,Cc as KanbanToolbar,zs as KanbanViewAdapter,Gc as KeyboardShortcutsHelp,z0 as ListView,ra as MenuIcons,jl as PluginManager,Co as PrioritySelector,xc as ProfitabilityReport,Us as QuickTaskCreate,i2 as RATE_LIMITS,V0 as STANDARD_FIELDS,Uc as SwimlaneBoardView,gc as TagBadge,Sp as TagList,Zo as TagPicker,al as TaskBar,Eo as TaskDetailModal,gg as TaskFormModal,tl as TaskGrid,Zc as ThemeModal,Cm as ThemeProvider,gb as ThemeSwitcher,Nn as TimeInputPopover,fc as TimePill,bc as TimePopover,ll as Timeline,No as UserAssignmentSelector,$c as VelocityChart,cb as VirtualGrid,sb as VirtualList,Wo as aiUsageTracker,gu as borderRadius,Al as buildCalendar,ki as calculatePosition,gl as cardToGanttTask,kg as cardsToGanttTasks,g as cn,rm as createKanbanView,Wb as createRetryWrapper,Xc as darkTheme,Kl as darkTokenTheme,Yi as defaultTheme,_l as designTokens,xu as duration,vu as easing,mb as exportTokensToCSS,Un as findTaskByName,fu as fontSize,bu as fontWeight,ui as formatCost,Ji as ganttEnTranslations,Nm as ganttEsTranslations,wg as ganttTaskToCardUpdate,pt as ganttThemes,Tu as ganttTokens,ed as ganttTranslations,De as ganttUtils,Du as generateCSSVariables,Mu as generateCompleteCSS,$b as generateInitialPositions,bg as generateTasksContext,fi as generateThemeVariables,_0 as getListViewTheme,Dd as getListViewTranslations,pb as getToken,Dm as getTranslations,Cu as kanbanTokens,Jc as lightTheme,Su as lightTokenTheme,hu as lineHeight,Yd as listViewDarkTheme,Td as listViewEnTranslations,Nd as listViewEsTranslations,Xd as listViewLightTheme,Jd as listViewNeutralTheme,Fl as listViewThemes,fl as listViewTranslations,bl as mergeListViewTranslations,td as mergeTranslations,Qc as neutralTheme,Eu as neutralTokenTheme,ku as opacity,xg as parseLocalCommand,wd as parseNaturalDate,kd as parseNaturalDuration,Cd as parseProgress,yg as parseStatus,D2 as pluginManager,Ub as retrySyncOperation,Ci as retryWithBackoff,wu as shadows,ub as shouldVirtualizeGrid,Hl as simulateReschedule,mu as spacing,Po as themes,Xf as useAI,Gf as useBoard,gi as useBoardCore,Vl as useBoardStore,Zf as useCardStacking,wc as useDragState,rb as useFilteredCards,_f as useFilters,Kr as useGanttI18n,Gl as useKanbanState,vm as useKeyboardShortcuts,Jf as useMultiSelect,cu as useSelectionState,nb as useSortedCards,ss as useTheme,db as useVirtualGrid,ib as useVirtualList,vg as validateAIResponse,Fc as withErrorBoundary,Di as wouldCreateCircularDependency,yu as zIndex};//# sourceMappingURL=index.js.map
|
|
445
445
|
//# sourceMappingURL=index.js.map
|