@libxai/board 1.5.74 → 1.5.76
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 +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +28 -28
- package/dist/index.js.map +1 -1
- package/dist/styles.css +32 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,selectionStore,BoardStore}from'@libxai/core';export{Board as BoardModel,BoardStore,Card as CardModel,Column as ColumnModel,DependencyEngine,Store}from'@libxai/core';import {createContext,memo,useRef,useState,forwardRef,useContext,useCallback,useEffect,useMemo,useImperativeHandle,useLayoutEffect,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import Bf from'html2canvas';import {createPortal}from'react-dom';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {AnimatePresence,motion}from'framer-motion';import {CheckCircle2,PlayCircle,Circle,Copy,Scissors,Settings,Eye,EyeOff,ArrowDown,ArrowUp,ArrowUpDown,BarChart3,Link2,Minus,Plus,Trash2,Pencil,Edit3,AlertTriangle,CheckSquare,ChevronDown,Calendar,Hash,Type,BarChart,Users,CalendarClock,FileText,Timer,Clock,Tag,CalendarCheck,Flag,CircleDot,Moon,Sun,Palette,Search,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,File,User,Check,CalendarDays,X,Hourglass,Play,Square,Diamond,Upload,MessageSquare,Layers,Filter,Zap,GitBranch,FileImage,FileSpreadsheet,FolderKanban,Share2,Download,ChevronLeft,GripVertical,Smile,Paperclip,Send,FileJson,AlertCircle,Milestone,List,PanelRight,FolderOpen,Folder,Target,DollarSign,Loader2}from'lucide-react';import {Command}from'cmdk';import ty from'react-markdown';import ay from'remark-gfm';import ry from'rehype-sanitize';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart as BarChart$1,Bar}from'recharts';import {toPng}from'html-to-image';var
|
|
2
|
-
`)}async function $f(e,t,a){let r=t;if(!r){let n=document.querySelector(".asakaa-board");n&&(r=n.parentElement||n);}if(r)try{let n=await Bf(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),
|
|
3
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}async function iu(e,t,a,r){switch(t){case "json":return Rf(e,r);case "csv":return Of(e);case "pdf":return await $f(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function lu(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let m=`${r}.pdf`;e.save(m);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},
|
|
4
|
-
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=du(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let i=du(t[n]||"");if(i.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-i.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${i.length})`);continue}for(;i.length<a.length;)i.push("");let l={};a.forEach((g,y)=>{l[g]=i[y]||"";});let m=l.Column||"Unnamed";o.has(m)||o.set(m,{id:`col-${o.size+1}`,title:m,position:o.size+1,cardIds:[]});let d=o.get(m),p={id:l["Card ID"]||`card-${n}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};r.push(p),d.cardIds.push(p.id);}catch(i){s.push(`Line ${n+1}: ${i instanceof Error?i.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function du(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function cu(e,t){switch(t){case "json":return Hf(e);case "csv":return zf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function uu(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=o=>{o.target?.result?t(o.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var vl=createContext(null);function pu(){return useContext(vl)}var mu=createContext(null);function gu({children:e,themeName:t}){return jsx(mu.Provider,{value:{themeName:t},children:e})}function bn(){return useContext(mu)}function Xt({children:e,container:t}){let[a,r]=useState(false),o=pu(),s=bn();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:i,themeName:c}=o,l={"--asakaa-color-background-primary":i.bgPrimary,"--asakaa-color-background-secondary":i.bgSecondary,"--asakaa-color-background-card":i.bgGrid,"--asakaa-color-background-hover":i.hoverBg,"--asakaa-color-text-primary":i.textPrimary,"--asakaa-color-text-secondary":i.textSecondary,"--asakaa-color-text-tertiary":i.textTertiary,"--asakaa-color-text-inverse":i.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":i.border,"--asakaa-color-border-hover":i.borderLight,"--asakaa-color-border-subtle":i.borderLight,"--asakaa-color-interactive-primary":i.accent,"--asakaa-color-interactive-primaryHover":i.accentHover,"--asakaa-color-interactive-primaryBorder":`${i.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${i.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${i.accent}33`,"--asakaa-color-status-success":i.statusCompleted,"--asakaa-color-status-warning":i.milestone,"--asakaa-color-status-error":i.criticalPath,"--asakaa-color-danger":i.criticalPath,"--asakaa-color-danger-border":`${i.criticalPath}4D`,"--asakaa-color-danger-background":`${i.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${i.criticalPath}26`};return createPortal(jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:l,children:e}),n)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):createPortal(e,n)}var xu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},qf="#BDC3C7",Yf=({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 jo({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),i=useRef(null),c=useRef(null),l=()=>{if(!c.current)return;let g=c.current.getBoundingClientRect(),y=window.innerHeight,x=window.innerWidth,h=160,f=220,b=4,w=g.right-h;w<10&&(w=g.left),w+h>x-10&&(w=x-h-10);let C=y-g.bottom,N=g.top,T;C>=f+b?T=g.bottom+b:N>=f+b?T=g.top-f-b:T=C>=N?g.bottom+b:Math.max(10,g.top-f-b),n({top:T,left:w}),o(true);};useEffect(()=>{let g=y=>{i.current&&!i.current.contains(y.target)&&!c.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),useEffect(()=>{let g=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let m=g=>{t(g),o(false);},d=e?xu[e]:null,p=d?.color||qf;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:c,onClick:()=>r?o(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${p}10`:"transparent",boxShadow:e?`0 0 0 2px ${p}30 inset`:"none"},title:d?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:p,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(Xt,{children:jsxs("div",{ref:i,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(xu).map(([g,y])=>jsxs("button",{onClick:()=>m(g),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:y.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx(Yf,{color:y.color}),jsx("span",{className:"font-semibold text-sm",children:y.label}),e===g&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>m(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.currentTarget.style.background="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Xf=[{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 qn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,i]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),p=(bn()?.themeName||"dark")==="dark",g=()=>{if(!l.current)return;let w=l.current.getBoundingClientRect(),C=window.innerHeight,N=window.innerWidth,T=320,k=380,v=4,E=w.left;E+T>N-10&&(E=N-T-10),E<10&&(E=10);let I=C-w.bottom,D=w.top,X;I>=k+v?X=w.bottom+v:D>=k+v?X=w.top-k-v:X=I>=D?w.bottom+v:Math.max(10,w.top-k-v),i({top:X,left:E}),s(true);};useEffect(()=>{let w=C=>{c.current&&!c.current.contains(C.target)&&!l.current?.contains(C.target)&&s(false);};if(o)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),useEffect(()=>{let w=C=>{C.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[o]);let y=w=>{let C=new Date,N=E=>{let I=E.getFullYear(),D=String(E.getMonth()+1).padStart(2,"0"),X=String(E.getDate()).padStart(2,"0");return `${I}-${D}-${X}`},T=N(C),k=new Date(C);k.setDate(k.getDate()+w);let v=N(k);a(T,v),s(false);},x=()=>{if(!e||!t)return "Set date";let w=k=>{if(k instanceof Date)return k;if(typeof k!="string"||!k.match(/^\d{4}-\d{2}-\d{2}$/))return null;let v=k.split("-").map(Number);if(v.length!==3||v.some(X=>isNaN(X)))return null;let E=v[0],I=v[1],D=v[2];return E===void 0||I===void 0||D===void 0?null:new Date(E,I-1,D)},C=w(e),N=w(t);if(!C||!N||isNaN(C.getTime())||isNaN(N.getTime()))return "Set date";let T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${T[C.getMonth()]} ${C.getDate()} \u2013 ${T[N.getMonth()]} ${N.getDate()}`},h=e&&t,b=(()=>{if(!t)return false;let w=typeof t=="string"?new Date(t):t,C=new Date;return C.setHours(0,0,0,0),w<C})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:l,onClick:()=>o?s(false):g(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${x()}`:"Set date range",children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsx("span",{className:"whitespace-nowrap",children:x()})]}),o&&jsx(Xt,{children:jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:p?"#1A1D25":"#FFFFFF",border:`1px solid ${p?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:p?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxs("div",{className:"p-4 border-b",style:{borderColor:p?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:p?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsx("div",{className:"grid grid-cols-2 gap-2",children:Xf.map(w=>jsx("button",{onClick:()=>y(w.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",C.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:C=>{C.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",C.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:w.label},w.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:p?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxs("div",{className:"space-y-3",children:[jsx("input",{type:"date",value:e||"",onChange:w=>a(w.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:w=>a(e,w.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}})]}),(e||t)&&jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Ko({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[i,c]=useState(""),[l,m]=useState({top:0,left:0}),d=useRef(null),p=useRef(null),g=()=>{if(!p.current)return;let b=p.current.getBoundingClientRect(),w=window.innerHeight,C=window.innerWidth,N=300,T=380,k=4,v=b.right-N;v<10&&(v=b.left),v+N>C-10&&(v=C-N-10);let E=w-b.bottom,I=b.top,D;E>=T+k?D=b.bottom+k:I>=T+k?D=b.top-T-k:D=E>=I?b.bottom+k:Math.max(10,b.top-T-k),m({top:D,left:v}),n(true);};useEffect(()=>{let b=w=>{d.current&&!d.current.contains(w.target)&&!p.current?.contains(w.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),useEffect(()=>{let b=w=>{w.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let y=b=>{let w=e.some(C=>C.id===b.id);a(w?e.filter(C=>C.id!==b.id):[...e,b]);},x=t.filter(b=>b.name.toLowerCase().includes(i.toLowerCase())),h=e.slice(0,o),f=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:p,onClick:()=>s?n(false):g(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxs("div",{className:"asakaa-avatar-group",children:[h.map(b=>jsx("div",{className:"asakaa-avatar",title:b.name,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"asakaa-avatar-img"}):b.initials},b.id)),f>0&&jsxs("div",{className:"asakaa-avatar",children:["+",f]})]}):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(Xt,{children:jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:i,onChange:b=>c(b.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:x.length===0?jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):x.map(b=>{let w=e.some(C=>C.id===b.id);return jsxs("button",{onClick:()=>y(b),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:C=>{C.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:b.color,color:"#fff"},children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.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:b.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:w?"#3b82f6":"transparent"},children:w?"\u2713":""})]},b.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Vs(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let l=c.dependencies.map(m=>{if(typeof m=="string")return m;let d=m;return d.taskId||d.targetId||""}).filter(Boolean);r.set(c.id,l);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,i=c=>{if(!s.has(c)){s.add(c),n.add(c);let l=r.get(c)||[];for(let m of l){if(!s.has(m)&&i(m))return true;if(n.has(m))return true}}return n.delete(c),false};return i(a)}function Xn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[i,c]=useState(false),[l,m]=useState(""),[d,p]=useState(t.length>0),[g,y]=useState({top:0,left:0}),[x,h]=useState(null),f=useRef(null),b=useRef(null),w=()=>{if(!b.current)return;let v=b.current.getBoundingClientRect(),E=window.innerHeight,I=window.innerWidth,D=300,X=d?380:120,O=4,H=v.right-D;H<10&&(H=v.left),H+D>I-10&&(H=I-D-10);let F=E-v.bottom,Y=v.top,Z;F>=X+O?Z=v.bottom+O:Y>=X+O?Z=v.top-X-O:Z=F>=Y?v.bottom+O:Math.max(10,v.top-X-O),y({top:Z,left:H}),c(true);};useEffect(()=>{if(!i||!b.current)return;let v=b.current.getBoundingClientRect(),E=window.innerHeight,I=window.innerWidth,D=300,X=d?380:120,O=4,H=v.right-D;H<10&&(H=v.left),H+D>I-10&&(H=I-D-10);let F=E-v.bottom,Y=v.top,Z;F>=X+O?Z=v.bottom+O:Y>=X+O?Z=v.top-X-O:Z=F>=Y?v.bottom+O:Math.max(10,v.top-X-O),y({top:Z,left:H});},[d,i]),useEffect(()=>{let v=E=>{f.current&&!f.current.contains(E.target)&&!b.current?.contains(E.target)&&(c(false),m(""));};if(i)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[i]),useEffect(()=>{let v=E=>{E.key==="Escape"&&(c(false),m(""));};if(i)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[i]);let C=v=>{let E=t.includes(v),I=a.find(D=>D.id===v);if(h(null),E){let D=t.filter(X=>X!==v);r(D),D.length===0&&p(false);}else {if(s&&Vs(a,v,e)){let X=`Cannot add "${I?.title||v}" as dependency - would create circular reference`;h(X),n?.(v,I?.title||v),setTimeout(()=>h(null),3e3);return}r([...t,v]),p(true);}},N=()=>{let v=!d;p(v),v||r([]);},T=a.filter(v=>v.id!==e).filter(v=>v.title.toLowerCase().includes(l.toLowerCase())||v.id.toLowerCase().includes(l.toLowerCase())),k=t.length>0?"#2E94FF":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:b,onClick:()=>i?c(false):w(),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:k,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:k},children:t.length})]}),i&&jsx(Xt,{children:jsxs("div",{ref:f,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[x&&jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:x})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:N,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:l,onChange:v=>m(v.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:T.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"}):T.map(v=>{let E=t.includes(v.id);return jsxs("button",{onClick:()=>C(v.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:I=>{I.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:I=>{I.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:E?"#3b82f6":"transparent",borderColor:E?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:E&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:v.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:v.id})]})]},v.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),p(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 mo=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:i=[],allCards:c=[]})=>{let{attributes:l,listeners:m,setNodeRef:d,transform:p,transition:g,isDragging:y}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),x={transform:zs.Transform.toString(p),transition:g};if(t)return jsx("div",{ref:d,style:x,...l,...m,onClick:()=>a?.(e),children:t(e)});let h=i.filter(C=>e.assignedUserIds?.includes(C.id)),f=e.progress===100,b=(e.attachments||[]).filter(C=>C.type.startsWith("image/")),w={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:d,style:w,className:u("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...l,...m,onClick:C=>{C.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:C=>{C.currentTarget.style.display="none";}})}),b.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:b.length===1&&b[0]?jsx("img",{src:b[0].url,alt:b[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:C=>{C.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:b.slice(0,4).map((C,N)=>jsxs("div",{className:"relative",children:[jsx("img",{src:C.url,alt:C.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:T=>{T.currentTarget.style.display="none";}}),N===3&&b.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:["+",b.length-4]})})]},C.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:f?"line-through":"none",opacity:f?.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:C=>C.stopPropagation(),className:"priority-selector",children:jsx(jo,{priority:e.priority,onChange:C=>n?.(e.id,{priority:C})})}),jsx("div",{onClick:C=>C.stopPropagation(),className:"date-picker",children:jsx(qn,{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:(C,N)=>n?.(e.id,{startDate:C,endDate:N})})}),i.length>0&&jsx("div",{onClick:C=>C.stopPropagation(),className:"user-selector",children:jsx(Ko,{assignedUsers:h,availableUsers:i,onChange:C=>n?.(e.id,{assignedUserIds:C.map(N=>N.id)})})}),jsx("div",{onClick:C=>C.stopPropagation(),className:"dependencies-selector",children:jsx(Xn,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(C=>typeof C=="string"?C:C.taskId):[],availableTasks:c,onChange:C=>n?.(e.id,{dependencies:C})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(C=>jsx("span",{className:"asakaa-label",children:C},C))}),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:"#2E94FF"},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:"#2E94FF"}})})]})]})},(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)));mo.displayName="Card";var js={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"}},Mu=({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 Fu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,i]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),m=[...Object.entries(js).map(([h,f])=>({id:h,label:f.label,color:f.color,icon:f.icon})),...r.filter(h=>!Object.keys(js).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let h=js[e];if(h)return {...h,id:e};let f=r.find(b=>b.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...js.todo,id:"todo"}},p=()=>{if(!l.current)return;let h=l.current.getBoundingClientRect(),f=window.innerHeight,b=window.innerWidth,w=180,C=280,N=4,T=h.right-w;T<10&&(T=h.left),T+w>b-10&&(T=b-w-10);let k=f-h.bottom,v=h.top,E;k>=C+N?E=h.bottom+N:v>=C+N?E=h.top-C-N:E=k>=v?h.bottom+N:Math.max(10,h.top-C-N),i({top:E,left:T}),s(true);};useEffect(()=>{let h=f=>{c.current&&!c.current.contains(f.target)&&!l.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),useEffect(()=>{let h=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let g=h=>{t(h),s(false);},y=d(),x=y.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:l,onClick:()=>o?s(false):p(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${x}10`,boxShadow:`0 0 0 2px ${x}30 inset`},title:y.label,children:jsx(Mu,{icon:y.icon,color:x})}),o&&jsx(Xt,{children:jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:m.map(h=>jsxs("button",{onClick:()=>g(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:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsx(Mu,{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:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}var Pu={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 Au({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=Pu[s]||Pu.en,[i,c]=useState(false),[l,m]=useState(false),[d,p]=useState(e),[g,y]=useState({top:0,left:0}),x=useRef(null),h=useRef(null),f=useRef(null);useEffect(()=>{if(i&&h.current){let N=h.current.getBoundingClientRect();y({top:N.bottom+window.scrollY+8,left:N.left+window.scrollX});}},[i]),useEffect(()=>{let N=T=>{x.current&&!x.current.contains(T.target)&&!h.current?.contains(T.target)&&(c(false),m(false));};if(i)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[i]),useEffect(()=>{let N=T=>{T.key==="Escape"&&(c(false),m(false),p(e));};if(i)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[i,e]),useEffect(()=>{l&&f.current&&(f.current.focus(),f.current.select());},[l]);let b=()=>{m(true),p(e);},w=()=>{let N=d.trim();N&&N!==e&&t(N),m(false),c(false),p(e);},C=N=>{N.key==="Enter"?w():N.key==="Escape"&&(m(false),p(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:h,onClick:()=>c(!i),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:n.columnOptions,"aria-label":n.columnOptions,children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),i&&jsx(Xt,{children:jsx("div",{ref:x,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:l?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:n.renameColumn}),jsx("input",{ref:f,type:"text",value:d,onChange:N=>p(N.target.value),onKeyDown:C,onBlur:w,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:n.columnName,maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:b,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:n.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:n.delete})]})]})]})})})]})}var xn=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:i,availableUsers:c,allCards:l,enableVirtualization:m,cardHeight:d=120,isCollapsed:p,onToggleCollapse:g,onColumnRename:y,onColumnDelete:x,isDeletable:h=false,className:f,renderMetrics:b,locale:w})=>{let{setNodeRef:C,isOver:N}=useDroppable({id:e.id,data:{type:"column",column:e}}),T=useRef(null),k=m??ru(t.length),v=useVirtualizer({count:t.length,getScrollElement:()=>T.current,estimateSize:()=>d,enabled:k});if(a)return jsx("div",{ref:C,className:f,children:a(e,t)});let I=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let O=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:O}:O>=80?{state:"warning",percentage:O}:O>=60?{state:"approaching",percentage:O}:{state:"ok",percentage:O}})(),D=I.state==="exceeded",X=()=>"asakaa-column-count";return jsxs("div",{ref:C,className:u("asakaa-column",N&&"ring-2 ring-asakaa-accent-blue",D&&"ring-2 ring-asakaa-accent-red",f),children:[o?o(e,t.length):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:u(X()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&I.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${I.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[I.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"})]}),I.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"})]}),I.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"})}),I.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"})]})]}),(y||x)&&jsx(Au,{columnTitle:e.title,onRename:O=>y?.(e.id,O),onDelete:x?()=>x(e.id):void 0,isDeletable:h,locale:w}),g&&jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),b&&b(e,t),!p&&jsx("div",{ref:T,className:"asakaa-column-cards",style:{maxHeight:k?"600px":void 0},children:jsx(SortableContext,{items:t.map(O=>O.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"})}):k?jsx("div",{style:{height:`${v.getTotalSize()}px`,position:"relative"},children:v.getVirtualItems().map(O=>{let H=t[O.index];return H?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${O.start}px)`},children:jsx(mo,{card:H,render:r,onClick:n,onUpdate:i,availableUsers:c,allCards:l})},H.id):null})}):t.map(O=>jsx(mo,{card:O,render:r,onClick:n,onUpdate:i,availableUsers:c,allCards:l},O.id))})})]})});xn.displayName="Column";function Nl({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),i=useRef(null);useEffect(()=>{r&&i.current&&(i.current.focus(),i.current.select());},[r]);let c=()=>{let m=s.trim();m&&m!==e?t(m):n(e),o(false);},l=m=>{m.key==="Enter"?c():m.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:i,type:"text",value:s,onChange:m=>n(m.target.value),onBlur:c,onKeyDown:l,className:u("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:u("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function bb(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function $u(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(i=>{let c=i.name.toLowerCase(),l=c.replace(/\s+/g,""),m=c.split(/\s+/);return !!(l===s||c===s||m.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function hb(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function yb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var xb=["\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 Hu({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:i="dark",locale:c="es",currentUser:l,enableEmoji:m=true,enableAttachments:d=true,pendingFiles:p=[],onFilesSelect:g,onRemoveFile:y,maxFileSizeMB:x=10}){let h=i==="dark",[f,b]=useState(false),[w,C]=useState([]),[N,T]=useState(0),[k,v]=useState(null),[E,I]=useState(false),D=useRef(null),X$1=useRef(null),O=useRef(null),H=useRef(null),F=useCallback((z,re)=>{let J=bb(z,re);if(v(J),J){let Pe=r.filter(ve=>ve.name.toLowerCase().includes(J.query)||ve.email&&ve.email.toLowerCase().includes(J.query)).slice(0,5);C(Pe),b(Pe.length>0),T(0);}else b(false),C([]);},[r]),Y=z=>{let re=z.target.value;if(t(re),F(re,z.target.selectionStart||0),D.current){D.current.style.height="24px";let J=D.current.scrollHeight,Pe=280,ve=Math.min(J,Pe);D.current.style.height=`${ve}px`,D.current.style.overflowY=J>Pe?"auto":"hidden";}},Z=()=>{D.current&&F(e,D.current.selectionStart||0);},Se=useCallback(z=>{if(!k||!D.current)return;let re=e.slice(0,k.start),J=e.slice(k.end),Pe=`@${z.name.replace(/\s+/g,"")} `,ve=re+Pe+J;t(ve),b(false),v(null),setTimeout(()=>{if(D.current){let We=k.start+Pe.length;D.current.selectionStart=We,D.current.selectionEnd=We,D.current.focus();}},0);},[k,e,t]),R=z=>{if(f&&w.length>0)switch(z.key){case "ArrowDown":z.preventDefault(),T(re=>re<w.length-1?re+1:0);break;case "ArrowUp":z.preventDefault(),T(re=>re>0?re-1:w.length-1);break;case "Enter":{z.preventDefault();let re=w[N];re&&Se(re);break}case "Tab":{z.preventDefault();let re=w[N];re&&Se(re);break}case "Escape":z.preventDefault(),b(false);break}else z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),a());};useEffect(()=>{let z=re=>{X$1.current&&!X$1.current.contains(re.target)&&D.current&&!D.current.contains(re.target)&&b(false),H.current&&!H.current.contains(re.target)&&I(false);};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);let _=useCallback(z=>{if(!D.current)return;let re=D.current.selectionStart||e.length,J=e.slice(0,re)+z+e.slice(re);t(J),I(false),setTimeout(()=>{if(D.current){let Pe=re+z.length;D.current.selectionStart=Pe,D.current.selectionEnd=Pe,D.current.focus();}},0);},[e,t]),he=useCallback(z=>{if(!g||!z.target.files)return;let re=Array.from(z.target.files),J=x*1024*1024,Pe=re.filter(ve=>ve.size>J?(console.warn(`File ${ve.name} exceeds max size of ${x}MB`),false):true);Pe.length>0&&g(Pe),z.target.value="";},[g,x]),Je=useCallback(z=>z.type.startsWith("image/")?Image:z.type.includes("pdf")||z.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(f&&X$1.current){let z=X$1.current.children[N];z&&z.scrollIntoView({block:"nearest"});}},[N,f]),jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:p.map(z=>{let re=Je(z.file),J=z.file.type.startsWith("image/");return jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",h?"bg-white/10":"bg-gray-100"),children:[J&&z.preview?jsx("img",{src:z.preview,alt:z.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(re,{className:u("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:u("text-xs truncate",h?"text-white":"text-gray-900"),children:z.file.name}),jsx("p",{className:u("text-xs",h?"text-[#6B7280]":"text-gray-400"),children:yb(z.file.size)})]}),y&&jsx("button",{onClick:()=>y(z.id),className:u("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"})})]},z.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[l&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:l.color||"#8B5CF6"},children:l.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:u("flex-1 relative min-w-0"),children:[jsxs("div",{className:u("flex items-end gap-1 px-2 py-2 rounded-lg",h?"bg-white/5":"bg-white border border-gray-200"),children:[m&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>I(!E),disabled:s||n,className:u("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||n)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:E&&jsx(motion.div,{ref:H,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("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:xb.map(z=>jsx("button",{type:"button",onClick:()=>_(z),className:u("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:z},z))})})})]}),d&&g&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>O.current?.click(),disabled:s||n,className:u("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||n)&&"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:he,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:D,value:e,onChange:Y,onSelect:Z,onKeyDown:R,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:u("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||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:n||!e.trim()&&p.length===0||s,className:u("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":h?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]}),jsx(AnimatePresence,{children:f&&w.length>0&&jsx(motion.div,{ref:X$1,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("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:w.map((z,re)=>jsxs("button",{type:"button",onClick:()=>Se(z),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",re===N?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:z.color||"#8B5CF6"},children:hb(z.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:u("text-sm font-medium truncate",h?"text-white":"text-gray-900"),children:z.name}),z.email&&jsx("p",{className:u("text-xs truncate",h?"text-[#6B7280]":"text-gray-500"),children:z.email})]})]},z.id))})})]})]})]})}function zu({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((i,c)=>i.type==="mention"?jsx("span",{className:u("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:i.value},c):jsx("span",{children:i.value},c))})}var Xs=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Do({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[i,c]=useState(false),[l,m]=useState(""),[d,p]=useState(false),[g,y]=useState(Xs[10]||"#2E94FF"),[x,h]=useState({top:0,left:0}),f=useRef(null),b=useRef(null),w=useRef(null),C=useRef(null),N=t.filter(D=>D.name.toLowerCase().includes(l.toLowerCase())),T=t.some(D=>D.name.toLowerCase()===l.toLowerCase());useEffect(()=>{if(i&&b.current){let D=b.current.getBoundingClientRect();h({top:D.bottom+6,left:D.left});}},[i]),useEffect(()=>{let D=X=>{let O=X.target,H=f.current?.contains(O),F=w.current?.contains(O);!H&&!F&&(c(false),m(""),p(false));};if(i)return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[i]),useEffect(()=>{i&&C.current&&C.current.focus();},[i]);let k=D=>{let X=e.some(O=>O.id===D.id);a(X?e.filter(O=>O.id!==D.id):[...e,D]);},v=async()=>{if(!(!r||!l.trim())){p(true);try{let D=await r(l.trim(),g);D&&(a([...e,D]),m(""),y(Xs[Math.floor(Math.random()*Xs.length)]||"#2E94FF"));}finally{p(false);}}},E=(D,X)=>{X.stopPropagation(),a(e.filter(O=>O.id!==D));},I={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:f,className:"relative",children:[jsxs("button",{ref:b,type:"button",onClick:()=>!s&&c(!i),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:I,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(D=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${D.color}20`,color:D.color},children:D.name},D.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:w,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:x.top,left:x.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsx("input",{ref:C,type:"text",value:l,onChange:D=>m(D.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:D=>{D.key==="Enter"&&l.trim()&&!T&&r&&v();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(D=>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:`${D.color}20`,color:D.color},onClick:X=>E(D.id,X),children:[D.name,jsx(X,{className:"w-3 h-3"})]},D.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(D=>{let X=e.some(O=>O.id===D.id);return jsxs("button",{type:"button",onClick:()=>k(D),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:X?`${D.color}15`:"transparent",color:o.textPrimary},onMouseEnter:O=>{X||(O.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:O=>{X||(O.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:D.color}}),jsx("span",{className:"flex-1 text-left",children:D.name}),X&&jsx(Check,{className:"w-4 h-4",style:{color:D.color}})]},D.id)}):l.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),l.trim()&&!T&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Xs.map(D=>jsx("button",{type:"button",onClick:()=>y(D),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:D,outline:g===D?`2px solid ${D}`:"none",outlineOffset:"2px"}},D))}),jsxs("button",{type:"button",onClick:v,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',l.trim(),'"']})]})]})}),document.body)]})}function Sl({tag:e,onRemove:t,size:a="sm"}){return jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function Wu({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsx(Sl,{tag:s,size:a},s.id)),o>0&&jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var Yo=[{name:"Azul",value:"#2E94FF",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function Gu(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 Eb(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 Mb({className:e}){return jsxs("svg",{className:u("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 El({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=Eb(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},i={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Gu(e.loggedMinutes),l=e.estimateMinutes?Gu(e.estimateMinutes):null,m=a&&l?`${c} / ${l}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:u("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsx(Mb,{className:i[t]}),jsx("span",{children:m})]})}function Fb(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 Qs(e){let t=Fb(e);return t!==null?String(t):e}function ju(e){let a=Qs(e).trim().toLowerCase();if(a.includes(":")){let[n,i]=a.split(":").map(Number);return (n||0)*60+(i||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,i=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+i}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function Zs(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 Lb(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 Ib({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function Bb({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 _u({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 Rb({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 Ml({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:i,onStopTimer:c,onDiscardTimer:l,onClose:m,className:d}){let[p,g]=useState(""),[y,x]=useState(t.estimateMinutes?Zs(t.estimateMinutes):""),[h,f]=useState(""),[b,w]=useState(false),[C,N]=useState(false),T=useRef(null);useEffect(()=>{T.current?.focus();},[]);let k=async()=>{let I=ju(p);if(!(I<=0||!s)){w(true);try{await s({durationMinutes:I,note:h.trim()||void 0,source:"manual"}),g(""),f("");}finally{w(false);}}},v=async()=>{if(!n)return;let I=y.trim()?ju(y):null;await n(I),N(false);},E=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),k()),I.key==="Escape"&&m?.();};return jsxs("div",{className:u("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",d),children:[jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsx("button",{onClick:m,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(_u,{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:Lb(o)})]}),jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(Bb,{className:"w-4 h-4"})}),jsx("button",{onClick:l,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(_u,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:i,className:u("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(Ib,{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(Rb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:T,type:"text",value:p,onChange:I=>g(I.target.value),onKeyDown:E,placeholder:"8 (=8h), 2h 30m",className:u("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsx("button",{onClick:k,disabled:b||!p.trim(),className:u("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:h,onChange:I=>f(I.target.value),onKeyDown:E,placeholder:"Note (optional)",className:u("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxs("div",{className:"px-3 py-2",children:[jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Zs(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"}),C?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:y,onChange:I=>x(I.target.value),onKeyDown:I=>{I.key==="Enter"&&v(),I.key==="Escape"&&N(false);},onBlur:v,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>N(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?Zs(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:u("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:u("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(I=>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:I.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Zs(I.durationMinutes)})]},I.id))})]})]})}function Ub(e){let a=Qs(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,i]=a.split(":").map(Number);return (n||0)*60+(i||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,i=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+i}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function Wb(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 ro({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[i,c]=useState(Wb(r)),[l,m]=useState(""),[d,p]=useState(false),g=useRef(null);useEffect(()=>{g.current?.focus();},[]);let y=async()=>{p(true);let w=Ub(i);await o(w&&w>0?w:null,l||void 0),p(false);},x=async()=>{p(true),await o(null),p(false);},h=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),y()),w.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},b=t==="es";return jsxs("div",{className:u("w-56",n),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:w=>w.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":"#2E94FF"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:f[e]})]}),jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsx(X,{className:"w-3 h-3"})})]}),jsxs("div",{className:"p-3 space-y-2",children:[jsx("input",{ref:g,type:"text",value:i,onChange:w=>c(w.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:l,onChange:w=>m(w.target.value),onKeyDown:h,placeholder:b?"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:y,disabled:d||!i.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:d?b?"Guardando...":"Saving...":b?"Registrar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:x,disabled:d,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:b?"Quitar":"Clear"})]})]})}function Gb(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 Vb(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 Pl({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Gb(e.health),s=Vb(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},i=e.progressPercent??0,c=Math.min(100,i),l=i>100;return e.health==="no-estimate"?jsxs("div",{className:u("flex items-center gap-2",r),children:[jsx("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsx("div",{className:u("h-full w-1/4",o)})}),t&&jsx("span",{className:u("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxs("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsx("div",{className:u("h-full transition-all duration-300",o),style:{width:`${c}%`}}),l&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[i,"%"]})]})}function vn(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 _b(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-blue-400":"text-blue-600";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Kb(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-blue-900/30 border-blue-700/50":"bg-blue-50 border-blue-200";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function qb(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 Yb({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",i=a?"text-[#9CA3AF]":"text-gray-500",c=a?"text-[#E5E7EB]":"text-gray-900";return jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-1",i),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",vn(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:u("text-xs mt-1",i),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-2",i),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:u("font-medium",c),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:u("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:u("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-2",i),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:i,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:u("font-medium",c),children:vn(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:i,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:u("font-medium",c),children:vn(e.totalLoggedMinutes)})]}),jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsx("span",{className:i,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:u("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function Xb({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",i=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:u("border-b",s,r&&u("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:u("font-medium",n),children:e.taskName}),e.projectName&&jsx("div",{className:u("text-xs mt-1",i),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?vn(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:vn(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:u("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":i),children:[o,vn(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:u("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":i),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:u("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Kb(e.status,a),_b(e.status,a)),children:qb(e.status,t)})})]})}function Al({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",i=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",l=n?"border-white/[0.08]":"border-gray-200",m=n?"text-white/[0.92]":"text-gray-900",d=n?"text-white/[0.60]":"text-gray-500",p=n?"bg-[#050505]/50":"bg-gray-50",g=useMemo(()=>e?[...e.tasks].sort((y,x)=>y.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-y.varianceMinutes):[],[e]);return t?jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:u("space-y-6 p-6",i,o),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:u("text-2xl font-bold",m),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:u("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(Yb,{summary:e.summary,locale:a,isDark:n}),jsx("div",{className:u("rounded-lg border overflow-hidden",c,l),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:p,children:jsxs("tr",{children:[jsx("th",{className:u("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:u("divide-y",l),children:g.map(y=>jsx(Xb,{task:y,locale:a,isDark:n,onClick:s},y.taskId))})]})})}),jsx("div",{className:u("text-xs text-center",d),children:a==="es"?jsx(Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsx(Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function wn(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 ch(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 ap(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function uh(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 fo({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:i=[],availableTags:c=[],onCreateTag:l,attachments:m=[],onUploadAttachments:d,onDeleteAttachment:p,availableTasks:g=[],comments:y=[],onAddComment:x,currentUser:h,mentionableUsers:f=[],onUploadCommentAttachments:b,enableTimeTracking:w=false,timeTrackingSummary:C,timeEntries:N=[],isTimerRunning:T=false,timerElapsedSeconds:k=0,onTimeLog:v,onEstimateUpdate:E,onSoldEffortUpdate:I,onTimerStart:D,onTimerStop:X$1,onTimerDiscard:O,blurFinancials:H=false}){let F=s==="dark",Y={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)"},Z=e&&"title"in e&&!("name"in e),Se=e,[R,_]=useState(e?ap(e,i):null),[he,Je]=useState(false),[z,re]=useState(false),[J,Pe]=useState(false),[ve,We]=useState(null),[Re,st]=useState(new Date),[ee,it]=useState(false),[le,ot]=useState(false),[yt,Pt]=useState(""),[ke,xt]=useState(false),[ct,rt]=useState(false),[$,de]=useState(false),[S,q]=useState(false),[ce,Ce]=useState(""),W=useRef(null),te=useRef(null),[Ge,Te]=useState(""),Ue=useRef(null),[Ne,Ve]=useState(""),[Tt,gt]=useState(false),[nt,et]=useState([]),[qt,At]=useState(""),[vt,Dt]=useState(false),ft=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 A=ap(e,i);console.log("\u{1F4E5} After normalizeToTask:",{taskId:A?.id,taskName:A?.name,soldEffortMinutes:A?.soldEffortMinutes,quotedMinutes:A?.quotedMinutes,effortMinutes:A?.effortMinutes,timeLoggedMinutes:A?.timeLoggedMinutes}),_(A),Ce(A.description||""),Te(A.name||"");}},[e?.id,e?.quotedMinutes,i,t]),useEffect(()=>{if(!t||!ce)return;let A=setTimeout(()=>{let ge=te.current;ge&&(ge.style.height="auto",ge.style.height=`${Math.max(100,ge.scrollHeight)}px`);},50);return ()=>clearTimeout(A)},[t,ce]),useEffect(()=>()=>{W.current&&clearTimeout(W.current),Ue.current&&clearTimeout(Ue.current);},[]),useEffect(()=>{t&&ft.current&&y.length>0&&setTimeout(()=>{ft.current&&(ft.current.scrollTop=ft.current.scrollHeight);},100);},[t,y.length]);let Wt=useCallback(A=>{_(A),Z&&o&&Se?o(uh(A,Se)):r&&r(A);},[Z,Se,o,r]),Oe=useCallback(()=>{Je(false),re(false),Pe(false),We(null),ot(false),Pt(""),xt(false);},[]),Le=useCallback((A,ge)=>{if(!R)return;let je={...R,[A]:ge};Wt(je);},[R,Wt]),ut=useCallback(()=>{let A=te.current;A&&(A.style.height="auto",A.style.height=`${Math.max(100,A.scrollHeight)}px`);},[]),ne=useCallback(A=>{Ce(A),setTimeout(ut,0),W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{if(R){let ge={...R,description:A};Wt(ge);}},800);},[R,Wt,ut]),fe=useCallback(A=>{Te(A),Ue.current&&clearTimeout(Ue.current),Ue.current=setTimeout(()=>{if(R&&A.trim()){let ge={...R,name:A.trim()};Wt(ge);}},800);},[R,Wt]),L=useCallback(A=>{let ge=A.map(je=>{let tt={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:je};return je.type.startsWith("image/")&&(tt.preview=URL.createObjectURL(je)),tt});et(je=>[...je,...ge]);},[]),j=useCallback(A=>{et(ge=>{let je=ge.find(tt=>tt.id===A);return je?.preview&&URL.revokeObjectURL(je.preview),ge.filter(tt=>tt.id!==A)});},[]),K=useCallback(async()=>{if(!(!R||!Ne.trim()&&nt.length===0||!x)){gt(true);try{let A=$u(Ne,f),ge=[];if(nt.length>0&&b){let je=nt.map(tt=>tt.file);ge=await b(je);}await x(R.id,Ne.trim(),A.length>0?A:void 0,ge.length>0?ge:void 0),Ve(""),nt.forEach(je=>{je.preview&&URL.revokeObjectURL(je.preview);}),et([]);}finally{gt(false);}}},[R,Ne,nt,x,f,b]),me=useCallback(()=>{if(!R||!qt.trim())return;let A=R.subtasks||[],ge={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:qt.trim(),progress:0,startDate:new Date,endDate:new Date,position:A.length},je=[...A,ge],tt={...R,subtasks:je};Wt(tt),At(""),Dt(false);},[R,qt,Wt]),Me=useCallback(A=>{if(!R?.subtasks)return;let ge=R.subtasks.map(tt=>tt.id===A?{...tt,progress:tt.progress===100?0:100}:tt),je={...R,subtasks:ge};Wt(je);},[R,Wt]),qe=useCallback(A=>{if(!R?.subtasks)return;let ge=R.subtasks.filter(tt=>tt.id!==A),je={...R,subtasks:ge};Wt(je);},[R,Wt]),_e=useCallback(A=>{let ge=typeof A=="string"?new Date(A):A,tt=new Date().getTime()-ge.getTime(),oa=Math.floor(tt/6e4),Gt=Math.floor(tt/36e5),Na=Math.floor(tt/864e5);return oa<1?n==="es"?"Ahora":"Just now":oa<60?n==="es"?`Hace ${oa} min`:`${oa}m ago`:Gt<24?n==="es"?`Hace ${Gt}h`:`${Gt}h ago`:Na<7?n==="es"?`Hace ${Na}d`:`${Na}d ago`:ge.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Ie=useCallback(A=>{if(!R)return;let ge=R.progress||0;A==="completed"?ge=100:A==="in-progress"&&ge===0?ge=10:A==="todo"&&(ge=0);let je={...R,status:A,progress:ge};Wt(je),Je(false);},[R,Wt]),bt=useCallback((A,ge)=>{if(!R)return;let je={...R,startDate:A,endDate:ge};Wt(je);},[R,Wt]),Nt=useCallback(()=>{let A=Re.getFullYear(),ge=Re.getMonth(),je=new Date(A,ge,1),oa=new Date(A,ge+1,0).getDate(),Gt=je.getDay(),Na=[],Ma=new Date(A,ge,0).getDate();for(let ha=Gt-1;ha>=0;ha--)Na.push({date:new Date(A,ge-1,Ma-ha),isCurrentMonth:false});for(let ha=1;ha<=oa;ha++)Na.push({date:new Date(A,ge,ha),isCurrentMonth:true});let Ga=42-Na.length;for(let ha=1;ha<=Ga;ha++)Na.push({date:new Date(A,ge+1,ha),isCurrentMonth:false});return Na},[Re]),Ut=useCallback(async A=>{if(A.preventDefault(),A.stopPropagation(),de(false),!R||!d)return;let ge=Array.from(A.dataTransfer.files);if(ge.length!==0){q(true);try{await d(R.id,ge);}finally{q(false);}}},[R,d]),Ta=useCallback(async A=>{if(!R||!d||!A.target.files)return;let ge=Array.from(A.target.files);if(ge.length!==0){q(true);try{await d(R.id,ge);}finally{q(false);}A.target.value="";}},[R,d]),ta=useCallback(A=>{A.preventDefault(),A.stopPropagation(),de(true);},[]),U=useCallback(A=>{A.preventDefault(),A.stopPropagation(),de(false);},[]),oe=useCallback(A=>A<1024?`${A} B`:A<1024*1024?`${(A/1024).toFixed(1)} KB`:`${(A/(1024*1024)).toFixed(1)} MB`,[]),$e=useCallback(A=>A.startsWith("image/")?Image:A.includes("pdf")||A.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:u("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:u("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:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",F?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:u("text-xs font-mono",F?"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 A=R.progress===100?0:100,je={...R,progress:A,status:A===100?"completed":"todo"};Wt(je);},className:u("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":F?"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:Ge,onChange:A=>fe(A.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:u("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]":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:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Oe(),Je(!he);},className:u("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-blue-500/20 text-blue-400":F?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.progress===100||R.status==="completed"?n==="es"?"COMPLETADO":"DONE":R.progress&&R.progress>0||R.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:he&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Je(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("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:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(A=>jsxs("button",{onClick:()=>Ie(A.id),className:u("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",R.status===A.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",A.color)}),jsx("span",{className:F?"text-white":"text-gray-900",children:A.label})]},A.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Oe(),Pe(!J);},className:u("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:[R.assignees&&R.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[R.assignees.slice(0,3).map((A,ge)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:A.color||"#8B5CF6"},title:A.name,children:A.initials||A.name.slice(0,2).toUpperCase()},ge)),R.assignees.length>3&&jsxs("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:["+",R.assignees.length-3]})]}):jsx("span",{className:u("text-sm",F?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:u("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:u("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:i.length>0?i.map(A=>{let ge=R.assignees?.some(je=>je.name===A.name);return jsxs("button",{onClick:()=>{let je=R.assignees||[],tt;ge?tt=je.filter(oa=>oa.name!==A.name):tt=[...je,A],Le("assignees",tt);},className:u("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",ge&&(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:A.color||"#8B5CF6"},children:A.initials||A.name.slice(0,2).toUpperCase()}),jsx("span",{className:u("flex-1",F?"text-white":"text-gray-900"),children:A.name}),ge&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},A.name)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{We(ve?null:"start"),st(R.startDate||new Date);},className:u("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:[R.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:u("mx-1",F?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),R.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:ve&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>We(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:u("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:A=>A.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",F?"border-white/10":"border-gray-200"),children:[(()=>{let A=new Date,ge=new Date(A);ge.setDate(A.getDate()+1);let je=new Date(A);je.setDate(A.getDate()+((6-A.getDay()+7)%7||7));let tt=new Date(A);tt.setDate(A.getDate()+((1-A.getDay()+7)%7||7));let oa=new Date(A);oa.setDate(A.getDate()+(6-A.getDay()+7)%7+7);let Gt=new Date(A);Gt.setDate(A.getDate()+14);let Na=new Date(A);return Na.setDate(A.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:A,display:A.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ge,display:ge.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:je,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:tt,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:oa,display:oa.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Gt,display:Gt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Na,display:Na.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ga,ha)=>jsxs("button",{className:u("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(ve==="start"){let nr=R.endDate&&Ga.date>R.endDate?Ga.date:R.endDate;bt(Ga.date,nr),We("end");}else {let nr=R.startDate&&Ga.date<R.startDate?Ga.date:R.startDate;bt(nr,Ga.date),We(null);}},children:[jsx("span",{children:Ga.label}),jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:Ga.display})]},ha))})(),jsx("div",{className:u("border-t mt-2 pt-2",F?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{bt(void 0,void 0),We(null);},className:u("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:n==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",F?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:ve==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:u("font-medium",F?"text-white":"text-gray-900"),children:Re.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>st(new Date),className:u("p-1 rounded text-sm transition-colors",F?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>st(new Date(Re.getFullYear(),Re.getMonth()-1)),className:u("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:()=>st(new Date(Re.getFullYear(),Re.getMonth()+1)),className:u("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:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(A=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",F?"text-[#6B7280]":"text-gray-400"),children:A},A))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:Nt().map((A,ge)=>{let je=A.date.toDateString()===new Date().toDateString(),tt=R.startDate?.toDateString()===A.date.toDateString(),oa=R.endDate?.toDateString()===A.date.toDateString(),Gt=tt||oa,Na=R.startDate&&R.endDate&&A.date>=R.startDate&&A.date<=R.endDate;return jsx("button",{onClick:()=>{let Ma=new Date(A.date);if(ve==="start"){let Ga=R.endDate&&Ma>R.endDate?Ma:R.endDate;bt(Ma,Ga),We("end");}else {let Ga=R.startDate&&Ma<R.startDate?Ma:R.startDate;bt(Ga,Ma),We(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!A.isCurrentMonth&&(F?"text-[#4B5563]":"text-gray-300"),A.isCurrentMonth&&(F?"text-white":"text-gray-900"),je&&"ring-2 ring-[#2E94FF]",tt&&"bg-[#2E94FF] text-white",oa&&!tt&&"bg-[#7C3AED] text-white",Na&&!Gt&&(F?"bg-[#7C3AED]/20":"bg-purple-100"),!Gt&&(F?"hover:bg-white/10":"hover:bg-gray-100")),children:A.date.getDate()},ge)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Oe(),re(!z);},className:u("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":F?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.priority?R.priority==="high"||R.priority==="urgent"?n==="es"?"Alta":"High":R.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:z&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>re(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("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:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(A=>jsxs("button",{onClick:()=>{Le("priority",A.id),re(false);},className:u("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",R.priority===A.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",A.color)}),jsx("span",{className:F?"text-white":"text-gray-900",children:A.label})]},A.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:u("text-sm",F?"text-white":"text-gray-900"),children:R.startDate&&R.endDate?`${Math.ceil((R.endDate.getTime()-R.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:u("w-4 h-4 rounded-full border-2",F?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ee?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:R.progress||0,onChange:A=>{let ge=parseInt(A.target.value),je=R.status;ge===100?je="completed":ge>0?je="in-progress":je="todo";let tt={...R,progress:ge,status:je};Wt(tt);},onBlur:()=>it(false),className:u("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-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>it(true),className:u("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:u("h-full rounded-full transition-all",R.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${R.progress||0}%`}})}),jsxs("span",{className:u("text-sm font-medium min-w-[40px]",F?"text-white":"text-gray-900"),children:[R.progress||0,"%"]})]})]}),w&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="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:u("text-sm px-2 py-0.5 cursor-not-allowed",F?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:C?.estimateMinutes?wn(C.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):C?.estimateMinutes?jsx("button",{type:"button",onClick:()=>rt("estimate"),className:u("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:wn(C.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>rt("estimate"),className:u("text-sm",F?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:ct==="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(ro,{mode:"estimate",locale:n,isDark:F,currentValue:C?.estimateMinutes||null,onSave:async A=>{await E?.(R.id,A),rt(false);},onClose:()=>rt(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:H?jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",F?"text-[#94A3B8]":"text-gray-500"),title:n==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):R.status==="completed"||R.progress===100?jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",F?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:R.quotedMinutes?wn(R.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):R.quotedMinutes?jsx("button",{type:"button",onClick:()=>rt("quoted"),className:u("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:wn(R.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>rt("quoted"),className:u("text-sm",F?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:ct==="quoted"&&!H&&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(ro,{mode:"quoted",locale:n,isDark:F,currentValue:R.quotedMinutes||null,onSave:async A=>{I?(await I(R.id,A),_(ge=>ge?{...ge,quotedMinutes:A}:null)):Le("quotedMinutes",A),rt(false);},onClose:()=>rt(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="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:u("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:n==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):T?jsxs("button",{type:"button",onClick:()=>X$1?.(R.id),className:u("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"}),ch(k||0)]}):jsx("button",{type:"button",onClick:()=>D?.(R.id),className:u("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:n==="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:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",F?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>rt("log"),className:u("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"}),n==="es"?"Agregar tiempo":"Add time"]}),C&&C.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:u("text-sm font-medium",C.health==="over-budget"?"text-red-500":C.health==="at-risk"?"text-yellow-500":F?"text-white":"text-gray-900"),children:[wn(C.loggedMinutes),C.estimateMinutes&&jsxs("span",{className:u("font-normal",F?"text-[#6B7280]":"text-gray-400"),children:[" / ",wn(C.estimateMinutes)]})]}),C.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:u("h-full rounded-full transition-all",C.health==="over-budget"?"bg-red-500":C.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,C.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:ct==="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(ro,{mode:"log",locale:n,isDark:F,currentValue:null,onSave:async(A,ge)=>{A&&await v?.(R.id,{durationMinutes:A,note:ge,source:"manual"}),rt(false);},onClose:()=>rt(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(Do,{selectedTags:R.tags||[],availableTags:c,onChange:A=>{Le("tags",A);},onCreateTag:l,theme:Y})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:u("w-4 h-4 mt-1.5",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="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(A=>{let ge=g.find(je=>je.id===A);return jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",F?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ge?.name||A.slice(0,8),jsx("button",{onClick:()=>{let je=(R.dependencies||[]).filter(tt=>tt!==A);Le("dependencies",je);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},A)})}),jsxs("button",{onClick:()=>{Oe(),ot(!le);},className:u("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:u("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:le&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ot(false),Pt("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("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:u("p-2 border-b",F?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:yt,onChange:A=>Pt(A.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("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:g.length>0?g.filter(A=>A.id!==R.id).filter(A=>yt===""||A.name.toLowerCase().includes(yt.toLowerCase())).map(A=>{let ge=R.dependencies?.includes(A.id);return jsxs("button",{onClick:()=>{let je=R.dependencies||[],tt;ge?tt=je.filter(oa=>oa!==A.id):tt=[...je,A.id],Le("dependencies",tt);},className:u("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",ge&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ge?"bg-blue-500 border-blue-500":F?"border-white/30":"border-gray-300"),children:ge&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:u("block truncate",F?"text-white":"text-gray-900"),children:A.name}),jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:A.id.slice(0,8)})]})]},A.id)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Oe(),xt(!ke);},className:u("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:R.color||"#6366F1"}}),jsx("span",{className:u("text-sm",F?"text-white":"text-gray-900"),children:Yo.find(A=>A.value===R.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:u("w-3 h-3",F?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:ke&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>xt(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("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:Yo.map(A=>{let ge=R.color===A.value;return jsx("button",{onClick:()=>{Le("color",A.value),xt(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",ge&&"ring-2 ring-offset-2",F?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:A.value,outlineColor:ge?A.value:void 0},title:A.name,children:ge&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},A.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:R.isMilestone||false,onChange:A=>Le("isMilestone",A.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",R.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:u("text-sm",F?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:u("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:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:te,value:ce,onChange:A=>ne(A.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:u("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:u("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:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",R.subtasks&&R.subtasks.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",R.subtasks.filter(A=>A.progress===100).length,"/",R.subtasks.length,")"]})]})}),R.subtasks&&R.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...R.subtasks].sort((A,ge)=>(A.position??0)-(ge.position??0)).map(A=>jsxs("div",{className:u("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:()=>Me(A.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",A.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:A.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:u("text-sm flex-1",A.progress===100?"line-through text-[#6B7280]":F?"text-white":"text-gray-900"),children:A.name}),jsx("button",{onClick:()=>qe(A.id),className:u("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"})})]},A.id))}),vt?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:qt,onChange:A=>At(A.target.value),onKeyDown:A=>{A.key==="Enter"&&qt.trim()?me():A.key==="Escape"&&(Dt(false),At(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:u("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-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsx("button",{onClick:me,disabled:!qt.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",qt.trim()?"bg-blue-500 hover:bg-blue-600 text-white":F?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{Dt(false),At("");},className:u("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:()=>Dt(true),className:u("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"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",F?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold mb-3",F?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",m.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",m.length,")"]})]}),m.length>0&&jsx("div",{className:"space-y-2 mb-4",children:m.map(A=>{let ge=$e(A.type),je=A.type.startsWith("image/");return jsxs("div",{className:u("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:[je&&A.thumbnailUrl?jsx("img",{src:A.thumbnailUrl,alt:A.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",F?"bg-white/10":"bg-gray-200"),children:jsx(ge,{className:u("w-5 h-5",F?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:A.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",F?"text-white":"text-gray-900"),children:A.name}),jsx("p",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:oe(A.size)})]}),p&&jsx("button",{onClick:()=>p(A.id),className:u("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:n==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},A.id)})}),jsxs("div",{onDragOver:ta,onDragLeave:U,onDrop:Ut,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",$?F?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":F?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",S&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:Ta,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||S}),S?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsx("p",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:u("w-6 h-6 mx-auto mb-2",$?"text-blue-500":F?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:$?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsx("p",{className:u("text-xs mt-1",F?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:u("w-96 border-l flex flex-col",F?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between h-[49px]",F?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",y.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",y.length,")"]})]}),jsx("button",{onClick:a,className:u("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 Bf from'html2canvas';import {createPortal}from'react-dom';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {AnimatePresence,motion}from'framer-motion';import {CheckCircle2,PlayCircle,Circle,Copy,Scissors,Settings,Eye,EyeOff,ArrowDown,ArrowUp,ArrowUpDown,BarChart3,Link2,Minus,Plus,Trash2,Pencil,Edit3,AlertTriangle,CheckSquare,ChevronDown,Calendar,Hash,Type,BarChart,Users,CalendarClock,FileText,Timer,Clock,Tag,CalendarCheck,Flag,CircleDot,Moon,Sun,Palette,Search,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,File,User,Check,CalendarDays,X,Hourglass,Play,Square,Diamond,Upload,MessageSquare,Layers,Filter,Zap,GitBranch,FileImage,FileSpreadsheet,FolderKanban,Share2,Download,ChevronLeft,GripVertical,Smile,Paperclip,Send,FileJson,AlertCircle,Milestone,List,PanelRight,FolderOpen,Folder,Target,DollarSign,Loader2}from'lucide-react';import {Command}from'cmdk';import ty from'react-markdown';import ay from'remark-gfm';import ry from'rehype-sanitize';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart as BarChart$1,Bar}from'recharts';import {toPng}from'html-to-image';var Us=(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 Ws=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 [Ws.Translate.toString(e),Ws.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function u(...e){return twMerge(clsx(e))}function Gs(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 Ff(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function hl(e,t){return e.length===0?1e3:t===0?Gs(null,e[0].position):t>=e.length?Gs(e[e.length-1].position,null):Gs(e[t-1].position,e[t].position)}function ru(e,t=100){return e>t}var Pf=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 Af(e,t,a,r){let o=t*Math.pow(a,e-1),s=o*.2*Math.random();return Math.min(o+s,r)}async function Vs(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Pf,onRetry:l}=t,c,i=0;for(let m=1;m<=a;m++){i=m;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(c=d,m===a||!n(c,m))return {error:c,attempts:i,success:false};let g=Af(m,r,o,s);if(l)try{l(c,m,g);}catch(y){console.error("Error in retry callback:",y);}await new Promise(y=>setTimeout(y,g));}}return {error:c||new Error("Unknown error"),attempts:i,success:false}}function Lf(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(o){if(a=o,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function If(e,t={}){return async(...a)=>Vs(()=>e(...a),t)}var yl=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 ou=(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))(ou||{}),jo=class jo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,l=`[${a}] [${r}] [${s}]`,c=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(l,o,c?n:"");break;case "INFO":console.info(l,o,c?n:"");break;case "WARN":console.warn(l,o,c?n:"");break;case "ERROR":console.error(l,o,c?n:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...jo.globalOptions};}static configure(t){jo.globalOptions={...jo.globalOptions,...t};}child(t){return new jo({...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 js((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new js(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:ou[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};jo.globalOptions={};var xl=jo,js=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}},nu=new xl;function Rf(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 Of(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let n=e.columns.find(l=>l.id===s.columnId);return [s.id,vl(s.title),vl(s.description||""),vl(n?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
|
|
2
|
+
`)}async function $f(e,t,a){let r=t;if(!r){let n=document.querySelector(".asakaa-board");n&&(r=n.parentElement||n);}if(r)try{let n=await Bf(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=n.toDataURL("image/png"),c=297,i=210,m=n.width/n.height,d=c-20,p=d/m;p>i-20&&(p=i-20,d=p*m);let g=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});g.setFontSize(16),g.setTextColor(255,255,255),g.setFillColor(10,10,10),g.rect(0,0,c,15,"F"),g.text(e.title||"Kanban Board",10,10);let y=(c-d)/2;return g.addImage(l,"PNG",y,20,d,p),g}catch(n){console.error("Error capturing board:",n);}let o=new jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(n=>{let l=e.cards.filter(c=>c.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,l.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):l.forEach(c=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(c.title,25,s),s+=6,c.description){o.setFontSize(9),o.setFont("helvetica","normal");let m=o.splitTextToSize(c.description,160);o.text(m,25,s),s+=m.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 m=[];c.startDate&&m.push(`Start: ${c.startDate}`),c.endDate&&m.push(`End: ${c.endDate}`),i.push(m.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function vl(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function iu(e,t,a,r){switch(t){case "json":return Rf(e,r);case "csv":return Of(e);case "pdf":return await $f(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function lu(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let m=`${r}.pdf`;e.save(m);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},l=new Blob([e],{type:n[t]}),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 Hf(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 zf(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=du(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=du(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((g,y)=>{i[g]=l[y]||"";});let m=i.Column||"Unnamed";o.has(m)||o.set(m,{id:`col-${o.size+1}`,title:m,position:o.size+1,cardIds:[]});let d=o.get(m),p={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(p),d.cardIds.push(p.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function du(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function cu(e,t){switch(t){case "json":return Hf(e);case "csv":return zf(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function uu(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=o=>{o.target?.result?t(o.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var wl=createContext(null);function pu(){return useContext(wl)}var mu=createContext(null);function gu({children:e,themeName:t}){return jsx(mu.Provider,{value:{themeName:t},children:e})}function hn(){return useContext(mu)}function Qt({children:e,container:t}){let[a,r]=useState(false),o=pu(),s=hn();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:l,themeName:c}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return createPortal(jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:i,children:e}),n)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):createPortal(e,n)}var xu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},qf="#BDC3C7",Yf=({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 _o({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),l=useRef(null),c=useRef(null),i=()=>{if(!c.current)return;let g=c.current.getBoundingClientRect(),y=window.innerHeight,x=window.innerWidth,h=160,f=220,b=4,w=g.right-h;w<10&&(w=g.left),w+h>x-10&&(w=x-h-10);let C=y-g.bottom,N=g.top,T;C>=f+b?T=g.bottom+b:N>=f+b?T=g.top-f-b:T=C>=N?g.bottom+b:Math.max(10,g.top-f-b),n({top:T,left:w}),o(true);};useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&!c.current?.contains(y.target)&&o(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),useEffect(()=>{let g=y=>{y.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let m=g=>{t(g),o(false);},d=e?xu[e]:null,p=d?.color||qf;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:c,onClick:()=>r?o(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${p}10`:"transparent",boxShadow:e?`0 0 0 2px ${p}30 inset`:"none"},title:d?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:p,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(Qt,{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(xu).map(([g,y])=>jsxs("button",{onClick:()=>m(g),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:y.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx(Yf,{color:y.color}),jsx("span",{className:"font-semibold text-sm",children:y.label}),e===g&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>m(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.currentTarget.style.background="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Xf=[{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 Xn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,l]=useState({top:0,left:0}),c=useRef(null),i=useRef(null),p=(hn()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let w=i.current.getBoundingClientRect(),C=window.innerHeight,N=window.innerWidth,T=320,k=380,v=4,E=w.left;E+T>N-10&&(E=N-T-10),E<10&&(E=10);let I=C-w.bottom,S=w.top,X;I>=k+v?X=w.bottom+v:S>=k+v?X=w.top-k-v:X=I>=S?w.bottom+v:Math.max(10,w.top-k-v),l({top:X,left:E}),s(true);};useEffect(()=>{let w=C=>{c.current&&!c.current.contains(C.target)&&!i.current?.contains(C.target)&&s(false);};if(o)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),useEffect(()=>{let w=C=>{C.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[o]);let y=w=>{let C=new Date,N=E=>{let I=E.getFullYear(),S=String(E.getMonth()+1).padStart(2,"0"),X=String(E.getDate()).padStart(2,"0");return `${I}-${S}-${X}`},T=N(C),k=new Date(C);k.setDate(k.getDate()+w);let v=N(k);a(T,v),s(false);},x=()=>{if(!e||!t)return "Set date";let w=k=>{if(k instanceof Date)return k;if(typeof k!="string"||!k.match(/^\d{4}-\d{2}-\d{2}$/))return null;let v=k.split("-").map(Number);if(v.length!==3||v.some(X=>isNaN(X)))return null;let E=v[0],I=v[1],S=v[2];return E===void 0||I===void 0||S===void 0?null:new Date(E,I-1,S)},C=w(e),N=w(t);if(!C||!N||isNaN(C.getTime())||isNaN(N.getTime()))return "Set date";let T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${T[C.getMonth()]} ${C.getDate()} \u2013 ${T[N.getMonth()]} ${N.getDate()}`},h=e&&t,b=(()=>{if(!t)return false;let w=typeof t=="string"?new Date(t):t,C=new Date;return C.setHours(0,0,0,0),w<C})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,onClick:()=>o?s(false):g(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:h?`${x()}`:"Set date range",children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsx("span",{className:"whitespace-nowrap",children:x()})]}),o&&jsx(Qt,{children:jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:p?"#1A1D25":"#FFFFFF",border:`1px solid ${p?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:p?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxs("div",{className:"p-4 border-b",style:{borderColor:p?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:p?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsx("div",{className:"grid grid-cols-2 gap-2",children:Xf.map(w=>jsx("button",{onClick:()=>y(w.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:C=>{C.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",C.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:C=>{C.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",C.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:w.label},w.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:p?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxs("div",{className:"space-y-3",children:[jsx("input",{type:"date",value:e||"",onChange:w=>a(w.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:w=>a(e,w.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}})]}),(e||t)&&jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:w=>{w.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function qo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[l,c]=useState(""),[i,m]=useState({top:0,left:0}),d=useRef(null),p=useRef(null),g=()=>{if(!p.current)return;let b=p.current.getBoundingClientRect(),w=window.innerHeight,C=window.innerWidth,N=300,T=380,k=4,v=b.right-N;v<10&&(v=b.left),v+N>C-10&&(v=C-N-10);let E=w-b.bottom,I=b.top,S;E>=T+k?S=b.bottom+k:I>=T+k?S=b.top-T-k:S=E>=I?b.bottom+k:Math.max(10,b.top-T-k),m({top:S,left:v}),n(true);};useEffect(()=>{let b=w=>{d.current&&!d.current.contains(w.target)&&!p.current?.contains(w.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),useEffect(()=>{let b=w=>{w.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let y=b=>{let w=e.some(C=>C.id===b.id);a(w?e.filter(C=>C.id!==b.id):[...e,b]);},x=t.filter(b=>b.name.toLowerCase().includes(l.toLowerCase())),h=e.slice(0,o),f=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:p,onClick:()=>s?n(false):g(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxs("div",{className:"asakaa-avatar-group",children:[h.map(b=>jsx("div",{className:"asakaa-avatar",title:b.name,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"asakaa-avatar-img"}):b.initials},b.id)),f>0&&jsxs("div",{className:"asakaa-avatar",children:["+",f]})]}):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(Qt,{children:jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:l,onChange:b=>c(b.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:x.length===0?jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):x.map(b=>{let w=e.some(C=>C.id===b.id);return jsxs("button",{onClick:()=>y(b),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:C=>{C.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:C=>{C.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:b.color,color:"#fff"},children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.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:b.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:w?"#3b82f6":"transparent"},children:w?"\u2713":""})]},b.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),n(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function _s(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let i=c.dependencies.map(m=>{if(typeof m=="string")return m;let d=m;return d.taskId||d.targetId||""}).filter(Boolean);r.set(c.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,l=c=>{if(!s.has(c)){s.add(c),n.add(c);let i=r.get(c)||[];for(let m of i){if(!s.has(m)&&l(m))return true;if(n.has(m))return true}}return n.delete(c),false};return l(a)}function Qn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,c]=useState(false),[i,m]=useState(""),[d,p]=useState(t.length>0),[g,y]=useState({top:0,left:0}),[x,h]=useState(null),f=useRef(null),b=useRef(null),w=()=>{if(!b.current)return;let v=b.current.getBoundingClientRect(),E=window.innerHeight,I=window.innerWidth,S=300,X=d?380:120,O=4,$=v.right-S;$<10&&($=v.left),$+S>I-10&&($=I-S-10);let F=E-v.bottom,Y=v.top,Z;F>=X+O?Z=v.bottom+O:Y>=X+O?Z=v.top-X-O:Z=F>=Y?v.bottom+O:Math.max(10,v.top-X-O),y({top:Z,left:$}),c(true);};useEffect(()=>{if(!l||!b.current)return;let v=b.current.getBoundingClientRect(),E=window.innerHeight,I=window.innerWidth,S=300,X=d?380:120,O=4,$=v.right-S;$<10&&($=v.left),$+S>I-10&&($=I-S-10);let F=E-v.bottom,Y=v.top,Z;F>=X+O?Z=v.bottom+O:Y>=X+O?Z=v.top-X-O:Z=F>=Y?v.bottom+O:Math.max(10,v.top-X-O),y({top:Z,left:$});},[d,l]),useEffect(()=>{let v=E=>{f.current&&!f.current.contains(E.target)&&!b.current?.contains(E.target)&&(c(false),m(""));};if(l)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[l]),useEffect(()=>{let v=E=>{E.key==="Escape"&&(c(false),m(""));};if(l)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[l]);let C=v=>{let E=t.includes(v),I=a.find(S=>S.id===v);if(h(null),E){let S=t.filter(X=>X!==v);r(S),S.length===0&&p(false);}else {if(s&&_s(a,v,e)){let X=`Cannot add "${I?.title||v}" as dependency - would create circular reference`;h(X),n?.(v,I?.title||v),setTimeout(()=>h(null),3e3);return}r([...t,v]),p(true);}},N=()=>{let v=!d;p(v),v||r([]);},T=a.filter(v=>v.id!==e).filter(v=>v.title.toLowerCase().includes(i.toLowerCase())||v.id.toLowerCase().includes(i.toLowerCase())),k=t.length>0?"#2E94FF":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:b,onClick:()=>l?c(false):w(),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:k,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:k},children:t.length})]}),l&&jsx(Qt,{children:jsxs("div",{ref:f,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[x&&jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:x})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:N,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:i,onChange:v=>m(v.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:T.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"}):T.map(v=>{let E=t.includes(v.id);return jsxs("button",{onClick:()=>C(v.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:I=>{I.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:I=>{I.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:E?"#3b82f6":"transparent",borderColor:E?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:E&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:v.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:v.id})]})]},v.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),p(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 go=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:c=[]})=>{let{attributes:i,listeners:m,setNodeRef:d,transform:p,transition:g,isDragging:y}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),x={transform:Ws.Transform.toString(p),transition:g};if(t)return jsx("div",{ref:d,style:x,...i,...m,onClick:()=>a?.(e),children:t(e)});let h=l.filter(C=>e.assignedUserIds?.includes(C.id)),f=e.progress===100,b=(e.attachments||[]).filter(C=>C.type.startsWith("image/")),w={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:d,style:w,className:u("asakaa-card",y&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...m,onClick:C=>{C.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:C=>{C.currentTarget.style.display="none";}})}),b.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:b.length===1&&b[0]?jsx("img",{src:b[0].url,alt:b[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:C=>{C.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:b.slice(0,4).map((C,N)=>jsxs("div",{className:"relative",children:[jsx("img",{src:C.url,alt:C.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:T=>{T.currentTarget.style.display="none";}}),N===3&&b.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:["+",b.length-4]})})]},C.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:f?"line-through":"none",opacity:f?.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:C=>C.stopPropagation(),className:"priority-selector",children:jsx(_o,{priority:e.priority,onChange:C=>n?.(e.id,{priority:C})})}),jsx("div",{onClick:C=>C.stopPropagation(),className:"date-picker",children:jsx(Xn,{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:(C,N)=>n?.(e.id,{startDate:C,endDate:N})})}),l.length>0&&jsx("div",{onClick:C=>C.stopPropagation(),className:"user-selector",children:jsx(qo,{assignedUsers:h,availableUsers:l,onChange:C=>n?.(e.id,{assignedUserIds:C.map(N=>N.id)})})}),jsx("div",{onClick:C=>C.stopPropagation(),className:"dependencies-selector",children:jsx(Qn,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(C=>typeof C=="string"?C:C.taskId):[],availableTasks:c,onChange:C=>n?.(e.id,{dependencies:C})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(C=>jsx("span",{className:"asakaa-label",children:C},C))}),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:"#2E94FF"},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:"#2E94FF"}})})]})]})},(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)));go.displayName="Card";var Ks={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"}},Mu=({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 Fu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,l]=useState({top:0,left:0}),c=useRef(null),i=useRef(null),m=[...Object.entries(Ks).map(([h,f])=>({id:h,label:f.label,color:f.color,icon:f.icon})),...r.filter(h=>!Object.keys(Ks).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let h=Ks[e];if(h)return {...h,id:e};let f=r.find(b=>b.id===e);return f?{id:f.id,label:f.title,color:f.color||"#8B5CF6",icon:"circle-dot"}:{...Ks.todo,id:"todo"}},p=()=>{if(!i.current)return;let h=i.current.getBoundingClientRect(),f=window.innerHeight,b=window.innerWidth,w=180,C=280,N=4,T=h.right-w;T<10&&(T=h.left),T+w>b-10&&(T=b-w-10);let k=f-h.bottom,v=h.top,E;k>=C+N?E=h.bottom+N:v>=C+N?E=h.top-C-N:E=k>=v?h.bottom+N:Math.max(10,h.top-C-N),l({top:E,left:T}),s(true);};useEffect(()=>{let h=f=>{c.current&&!c.current.contains(f.target)&&!i.current?.contains(f.target)&&s(false);};if(o)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[o]),useEffect(()=>{let h=f=>{f.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[o]);let g=h=>{t(h),s(false);},y=d(),x=y.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:i,onClick:()=>o?s(false):p(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${x}10`,boxShadow:`0 0 0 2px ${x}30 inset`},title:y.label,children:jsx(Mu,{icon:y.icon,color:x})}),o&&jsx(Qt,{children:jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:m.map(h=>jsxs("button",{onClick:()=>g(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:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsx(Mu,{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:"#2E94FF",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}var Pu={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 Au({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o,locale:s="en"}){let n=Pu[s]||Pu.en,[l,c]=useState(false),[i,m]=useState(false),[d,p]=useState(e),[g,y]=useState({top:0,left:0}),x=useRef(null),h=useRef(null),f=useRef(null);useEffect(()=>{if(l&&h.current){let N=h.current.getBoundingClientRect();y({top:N.bottom+window.scrollY+8,left:N.left+window.scrollX});}},[l]),useEffect(()=>{let N=T=>{x.current&&!x.current.contains(T.target)&&!h.current?.contains(T.target)&&(c(false),m(false));};if(l)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),useEffect(()=>{let N=T=>{T.key==="Escape"&&(c(false),m(false),p(e));};if(l)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[l,e]),useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]);let b=()=>{m(true),p(e);},w=()=>{let N=d.trim();N&&N!==e&&t(N),m(false),c(false),p(e);},C=N=>{N.key==="Enter"?w():N.key==="Escape"&&(m(false),p(e));};return jsxs("div",{className:`relative ${o||""}`,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:n.columnOptions,"aria-label":n.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(Qt,{children:jsx("div",{ref:x,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:i?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:n.renameColumn}),jsx("input",{ref:f,type:"text",value:d,onChange:N=>p(N.target.value),onKeyDown:C,onBlur:w,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:n.columnName,maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:b,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:n.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:n.delete})]})]})]})})})]})}var vn=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:c,allCards:i,enableVirtualization:m,cardHeight:d=120,isCollapsed:p,onToggleCollapse:g,onColumnRename:y,onColumnDelete:x,isDeletable:h=false,className:f,renderMetrics:b,locale:w})=>{let{setNodeRef:C,isOver:N}=useDroppable({id:e.id,data:{type:"column",column:e}}),T=useRef(null),k=m??ru(t.length),v=useVirtualizer({count:t.length,getScrollElement:()=>T.current,estimateSize:()=>d,enabled:k});if(a)return jsx("div",{ref:C,className:f,children:a(e,t)});let I=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let O=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:O}:O>=80?{state:"warning",percentage:O}:O>=60?{state:"approaching",percentage:O}:{state:"ok",percentage:O}})(),S=I.state==="exceeded",X=()=>"asakaa-column-count";return jsxs("div",{ref:C,className:u("asakaa-column",N&&"ring-2 ring-asakaa-accent-blue",S&&"ring-2 ring-asakaa-accent-red",f),children:[o?o(e,t.length):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:u(X()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&I.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${I.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[I.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"})]}),I.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"})]}),I.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"})}),I.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"})]})]}),(y||x)&&jsx(Au,{columnTitle:e.title,onRename:O=>y?.(e.id,O),onDelete:x?()=>x(e.id):void 0,isDeletable:h,locale:w}),g&&jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),b&&b(e,t),!p&&jsx("div",{ref:T,className:"asakaa-column-cards",style:{maxHeight:k?"600px":void 0},children:jsx(SortableContext,{items:t.map(O=>O.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"})}):k?jsx("div",{style:{height:`${v.getTotalSize()}px`,position:"relative"},children:v.getVirtualItems().map(O=>{let $=t[O.index];return $?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${O.start}px)`},children:jsx(go,{card:$,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i})},$.id):null})}):t.map(O=>jsx(go,{card:O,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i},O.id))})})]})});vn.displayName="Column";function Dl({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),l=useRef(null);useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let c=()=>{let m=s.trim();m&&m!==e?t(m):n(e),o(false);},i=m=>{m.key==="Enter"?c():m.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:l,type:"text",value:s,onChange:m=>n(m.target.value),onBlur:c,onKeyDown:i,className:u("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:u("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function bb(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function $u(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(l=>{let c=l.name.toLowerCase(),i=c.replace(/\s+/g,""),m=c.split(/\s+/);return !!(i===s||c===s||m.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function hb(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function yb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var xb=["\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 Hu({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:c="es",currentUser:i,enableEmoji:m=true,enableAttachments:d=true,pendingFiles:p=[],onFilesSelect:g,onRemoveFile:y,maxFileSizeMB:x=10}){let h=l==="dark",[f,b]=useState(false),[w,C]=useState([]),[N,T]=useState(0),[k,v]=useState(null),[E,I]=useState(false),S=useRef(null),X$1=useRef(null),O=useRef(null),$=useRef(null),F=useCallback((z,re)=>{let J=bb(z,re);if(v(J),J){let Ae=r.filter(ve=>ve.name.toLowerCase().includes(J.query)||ve.email&&ve.email.toLowerCase().includes(J.query)).slice(0,5);C(Ae),b(Ae.length>0),T(0);}else b(false),C([]);},[r]),Y=z=>{let re=z.target.value;if(t(re),F(re,z.target.selectionStart||0),S.current){S.current.style.height="24px";let J=S.current.scrollHeight,Ae=280,ve=Math.min(J,Ae);S.current.style.height=`${ve}px`,S.current.style.overflowY=J>Ae?"auto":"hidden";}},Z=()=>{S.current&&F(e,S.current.selectionStart||0);},Ee=useCallback(z=>{if(!k||!S.current)return;let re=e.slice(0,k.start),J=e.slice(k.end),Ae=`@${z.name.replace(/\s+/g,"")} `,ve=re+Ae+J;t(ve),b(false),v(null),setTimeout(()=>{if(S.current){let ze=k.start+Ae.length;S.current.selectionStart=ze,S.current.selectionEnd=ze,S.current.focus();}},0);},[k,e,t]),R=z=>{if(f&&w.length>0)switch(z.key){case "ArrowDown":z.preventDefault(),T(re=>re<w.length-1?re+1:0);break;case "ArrowUp":z.preventDefault(),T(re=>re>0?re-1:w.length-1);break;case "Enter":{z.preventDefault();let re=w[N];re&&Ee(re);break}case "Tab":{z.preventDefault();let re=w[N];re&&Ee(re);break}case "Escape":z.preventDefault(),b(false);break}else z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),a());};useEffect(()=>{let z=re=>{X$1.current&&!X$1.current.contains(re.target)&&S.current&&!S.current.contains(re.target)&&b(false),$.current&&!$.current.contains(re.target)&&I(false);};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);let _=useCallback(z=>{if(!S.current)return;let re=S.current.selectionStart||e.length,J=e.slice(0,re)+z+e.slice(re);t(J),I(false),setTimeout(()=>{if(S.current){let Ae=re+z.length;S.current.selectionStart=Ae,S.current.selectionEnd=Ae,S.current.focus();}},0);},[e,t]),ye=useCallback(z=>{if(!g||!z.target.files)return;let re=Array.from(z.target.files),J=x*1024*1024,Ae=re.filter(ve=>ve.size>J?(console.warn(`File ${ve.name} exceeds max size of ${x}MB`),false):true);Ae.length>0&&g(Ae),z.target.value="";},[g,x]),Je=useCallback(z=>z.type.startsWith("image/")?Image:z.type.includes("pdf")||z.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(f&&X$1.current){let z=X$1.current.children[N];z&&z.scrollIntoView({block:"nearest"});}},[N,f]),jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:p.map(z=>{let re=Je(z.file),J=z.file.type.startsWith("image/");return jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",h?"bg-white/10":"bg-gray-100"),children:[J&&z.preview?jsx("img",{src:z.preview,alt:z.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(re,{className:u("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:u("text-xs truncate",h?"text-white":"text-gray-900"),children:z.file.name}),jsx("p",{className:u("text-xs",h?"text-[#6B7280]":"text-gray-400"),children:yb(z.file.size)})]}),y&&jsx("button",{onClick:()=>y(z.id),className:u("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"})})]},z.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[i&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:u("flex-1 relative min-w-0"),children:[jsxs("div",{className:u("flex items-end gap-1 px-2 py-2 rounded-lg",h?"bg-white/5":"bg-white border border-gray-200"),children:[m&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>I(!E),disabled:s||n,className:u("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||n)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:E&&jsx(motion.div,{ref:$,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("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:xb.map(z=>jsx("button",{type:"button",onClick:()=>_(z),className:u("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:z},z))})})})]}),d&&g&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>O.current?.click(),disabled:s||n,className:u("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||n)&&"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:ye,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:S,value:e,onChange:Y,onSelect:Z,onKeyDown:R,placeholder:o||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:u("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||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:n||!e.trim()&&p.length===0||s,className:u("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":h?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]}),jsx(AnimatePresence,{children:f&&w.length>0&&jsx(motion.div,{ref:X$1,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:u("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:w.map((z,re)=>jsxs("button",{type:"button",onClick:()=>Ee(z),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",re===N?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:z.color||"#8B5CF6"},children:hb(z.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:u("text-sm font-medium truncate",h?"text-white":"text-gray-900"),children:z.name}),z.email&&jsx("p",{className:u("text-xs truncate",h?"text-[#6B7280]":"text-gray-500"),children:z.email})]})]},z.id))})})]})]})]})}function zu({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((l,c)=>l.type==="mention"?jsx("span",{className:u("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:l.value},c):jsx("span",{children:l.value},c))})}var Qs=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#2E94FF","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function So({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,c]=useState(false),[i,m]=useState(""),[d,p]=useState(false),[g,y]=useState(Qs[10]||"#2E94FF"),[x,h]=useState({top:0,left:0}),f=useRef(null),b=useRef(null),w=useRef(null),C=useRef(null),N=t.filter(S=>S.name.toLowerCase().includes(i.toLowerCase())),T=t.some(S=>S.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(l&&b.current){let S=b.current.getBoundingClientRect();h({top:S.bottom+6,left:S.left});}},[l]),useEffect(()=>{let S=X=>{let O=X.target,$=f.current?.contains(O),F=w.current?.contains(O);!$&&!F&&(c(false),m(""),p(false));};if(l)return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[l]),useEffect(()=>{l&&C.current&&C.current.focus();},[l]);let k=S=>{let X=e.some(O=>O.id===S.id);a(X?e.filter(O=>O.id!==S.id):[...e,S]);},v=async()=>{if(!(!r||!i.trim())){p(true);try{let S=await r(i.trim(),g);S&&(a([...e,S]),m(""),y(Qs[Math.floor(Math.random()*Qs.length)]||"#2E94FF"));}finally{p(false);}}},E=(S,X)=>{X.stopPropagation(),a(e.filter(O=>O.id!==S));},I={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:f,className:"relative",children:[jsxs("button",{ref:b,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:I,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(S=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${S.color}20`,color:S.color},children:S.name},S.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:w,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:x.top,left:x.left,zIndex:99999,backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsx("input",{ref:C,type:"text",value:i,onChange:S=>m(S.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:S=>{S.key==="Enter"&&i.trim()&&!T&&r&&v();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(S=>jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${S.color}20`,color:S.color},onClick:X=>E(S.id,X),children:[S.name,jsx(X,{className:"w-3 h-3"})]},S.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(S=>{let X=e.some(O=>O.id===S.id);return jsxs("button",{type:"button",onClick:()=>k(S),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:X?`${S.color}15`:"transparent",color:o.textPrimary},onMouseEnter:O=>{X||(O.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:O=>{X||(O.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:S.color}}),jsx("span",{className:"flex-1 text-left",children:S.name}),X&&jsx(Check,{className:"w-4 h-4",style:{color:S.color}})]},S.id)}):i.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!T&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Qs.map(S=>jsx("button",{type:"button",onClick:()=>y(S),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:S,outline:g===S?`2px solid ${S}`:"none",outlineOffset:"2px"}},S))}),jsxs("button",{type:"button",onClick:v,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function El({tag:e,onRemove:t,size:a="sm"}){return jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function Wu({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsx(El,{tag:s,size:a},s.id)),o>0&&jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var Xo=[{name:"Azul",value:"#2E94FF",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function Gu(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 Eb(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 Mb({className:e}){return jsxs("svg",{className:u("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 Ml({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=Eb(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=Gu(e.loggedMinutes),i=e.estimateMinutes?Gu(e.estimateMinutes):null,m=a&&i?`${c} / ${i}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:u("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsx(Mb,{className:l[t]}),jsx("span",{children:m})]})}function Fb(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 ei(e){let t=Fb(e);return t!==null?String(t):e}function ju(e){let a=ei(e).trim().toLowerCase();if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function ti(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Lb(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 Ib({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function Bb({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 _u({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 Rb({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 Fl({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:l,onStopTimer:c,onDiscardTimer:i,onClose:m,className:d}){let[p,g]=useState(""),[y,x]=useState(t.estimateMinutes?ti(t.estimateMinutes):""),[h,f]=useState(""),[b,w]=useState(false),[C,N]=useState(false),T=useRef(null);useEffect(()=>{T.current?.focus();},[]);let k=async()=>{let I=ju(p);if(!(I<=0||!s)){w(true);try{await s({durationMinutes:I,note:h.trim()||void 0,source:"manual"}),g(""),f("");}finally{w(false);}}},v=async()=>{if(!n)return;let I=y.trim()?ju(y):null;await n(I),N(false);},E=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),k()),I.key==="Escape"&&m?.();};return jsxs("div",{className:u("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",d),children:[jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsx("button",{onClick:m,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(_u,{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:Lb(o)})]}),jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(Bb,{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(_u,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:l,className:u("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(Ib,{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(Rb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:T,type:"text",value:p,onChange:I=>g(I.target.value),onKeyDown:E,placeholder:"8 (=8h), 2h 30m",className:u("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsx("button",{onClick:k,disabled:b||!p.trim(),className:u("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:h,onChange:I=>f(I.target.value),onKeyDown:E,placeholder:"Note (optional)",className:u("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxs("div",{className:"px-3 py-2",children:[jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ti(t.loggedMinutes)})]}),jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),C?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:y,onChange:I=>x(I.target.value),onKeyDown:I=>{I.key==="Enter"&&v(),I.key==="Escape"&&N(false);},onBlur:v,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>N(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?ti(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxs("div",{className:"mt-2",children:[jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxs("span",{className:u("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:u("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(I=>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:I.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:ti(I.durationMinutes)})]},I.id))})]})]})}function Ub(e){let a=ei(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[n,l]=a.split(":").map(Number);return (n||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),o=a.match(/(\d+)\s*m/);if(r||o){let n=r?.[1]?parseFloat(r[1]):0,l=o?.[1]?parseInt(o[1],10):0;return Math.round(n*60)+l}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function Wb(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 oo({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,c]=useState(Wb(r)),[i,m]=useState(""),[d,p]=useState(false),g=useRef(null);useEffect(()=>{g.current?.focus();},[]);let y=async()=>{p(true);let w=Ub(l);await o(w&&w>0?w:null,i||void 0),p(false);},x=async()=>{p(true),await o(null),p(false);},h=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),y()),w.key==="Escape"&&s();},f={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},b=t==="es";return jsxs("div",{className:u("w-56",n),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:w=>w.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":"#2E94FF"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:f[e]})]}),jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsx(X,{className:"w-3 h-3"})})]}),jsxs("div",{className:"p-3 space-y-2",children:[jsx("input",{ref:g,type:"text",value:l,onChange:w=>c(w.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:w=>m(w.target.value),onKeyDown:h,placeholder:b?"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:y,disabled:d||!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,127,255,0.3)":"1px solid #2E94FF",background:a?"rgba(0,127,255,0.15)":"#2E94FF",color:a?"#007FFF":"#FFFFFF"},children:d?b?"Guardando...":"Saving...":b?"Registrar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:x,disabled:d,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:b?"Quitar":"Clear"})]})]})}function Gb(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 Vb(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 Al({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Gb(e.health),s=Vb(e.health),n={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:u("flex items-center gap-2",r),children:[jsx("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsx("div",{className:u("h-full w-1/4",o)})}),t&&jsx("span",{className:u("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:u("flex items-center gap-2",r),children:[jsxs("div",{className:u("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsx("div",{className:u("h-full transition-all duration-300",o),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:u("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function wn(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function _b(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-blue-400":"text-blue-600";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Kb(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-blue-900/30 border-blue-700/50":"bg-blue-50 border-blue-200";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function qb(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 Yb({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",l=a?"text-[#9CA3AF]":"text-gray-500",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:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",wn(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:u("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("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:u("font-medium",c),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:u("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:u("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:u("p-4 rounded-lg border",s,n),children:[jsx("div",{className:u("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:u("font-medium",c),children:wn(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:u("font-medium",c),children:wn(e.totalLoggedMinutes)})]}),jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:u("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function Xb({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:u("border-b",s,r&&u("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:u("font-medium",n),children:e.taskName}),e.projectName&&jsx("div",{className:u("text-xs mt-1",l),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?wn(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:wn(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:u("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),children:[o,wn(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:u("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:u("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Kb(e.status,a),_b(e.status,a)),children:qb(e.status,t)})})]})}function Ll({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",l=n?"bg-[#050505]":"bg-gray-50",c=n?"bg-[#0A0A0A]":"bg-white",i=n?"border-white/[0.08]":"border-gray-200",m=n?"text-white/[0.92]":"text-gray-900",d=n?"text-white/[0.60]":"text-gray-500",p=n?"bg-[#050505]/50":"bg-gray-50",g=useMemo(()=>e?[...e.tasks].sort((y,x)=>y.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-y.varianceMinutes):[],[e]);return t?jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:u("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:u("space-y-6 p-6",l,o),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:u("text-2xl font-bold",m),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:u("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(Yb,{summary:e.summary,locale:a,isDark:n}),jsx("div",{className:u("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:p,children:jsxs("tr",{children:[jsx("th",{className:u("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:u("divide-y",i),children:g.map(y=>jsx(Xb,{task:y,locale:a,isDark:n,onClick:s},y.taskId))})]})})}),jsx("div",{className:u("text-xs text-center",d),children:a==="es"?jsx(Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsx(Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function kn(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 ch(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 ap(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function uh(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 bo({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:c=[],onCreateTag:i,attachments:m=[],onUploadAttachments:d,onDeleteAttachment:p,availableTasks:g=[],comments:y=[],onAddComment:x,currentUser:h,mentionableUsers:f=[],onUploadCommentAttachments:b,enableTimeTracking:w=false,timeTrackingSummary:C,timeEntries:N=[],isTimerRunning:T=false,timerElapsedSeconds:k=0,onTimeLog:v,onEstimateUpdate:E,onSoldEffortUpdate:I,onTimerStart:S,onTimerStop:X$1,onTimerDiscard:O,blurFinancials:$=false}){let F=s==="dark",Y={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)"},Z=e&&"title"in e&&!("name"in e),Ee=e,[R,_]=useState(e?ap(e,l):null),[ye,Je]=useState(false),[z,re]=useState(false),[J,Ae]=useState(false),[ve,ze]=useState(null),[Be,st]=useState(new Date),[ee,it]=useState(false),[de,lt]=useState(false),[rt,At]=useState(""),[we,vt]=useState(false),[gt,tt]=useState(false),[H,le]=useState(false),[D,K]=useState(false),[pe,Te]=useState(""),G=useRef(null),te=useRef(null),[Re,De]=useState(""),Ue=useRef(null),[Fe,_e]=useState(""),[ft,dt]=useState(false),[ut,at]=useState([]),[Vt,Mt]=useState(""),[Dt,wt]=useState(false),bt=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 A=ap(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:A?.id,taskName:A?.name,soldEffortMinutes:A?.soldEffortMinutes,quotedMinutes:A?.quotedMinutes,effortMinutes:A?.effortMinutes,timeLoggedMinutes:A?.timeLoggedMinutes}),_(A),Te(A.description||""),De(A.name||"");}},[e?.id,e?.quotedMinutes,l,t]),useEffect(()=>{if(!t||!pe)return;let A=setTimeout(()=>{let ge=te.current;ge&&(ge.style.height="auto",ge.style.height=`${Math.max(100,ge.scrollHeight)}px`);},50);return ()=>clearTimeout(A)},[t,pe]),useEffect(()=>()=>{G.current&&clearTimeout(G.current),Ue.current&&clearTimeout(Ue.current);},[]),useEffect(()=>{t&&bt.current&&y.length>0&&setTimeout(()=>{bt.current&&(bt.current.scrollTop=bt.current.scrollHeight);},100);},[t,y.length]);let Ut=useCallback(A=>{_(A),Z&&o&&Ee?o(uh(A,Ee)):r&&r(A);},[Z,Ee,o,r]),Ge=useCallback(()=>{Je(false),re(false),Ae(false),ze(null),lt(false),At(""),vt(false);},[]),Le=useCallback((A,ge)=>{if(!R)return;let Ve={...R,[A]:ge};Ut(Ve);},[R,Ut]),nt=useCallback(()=>{let A=te.current;A&&(A.style.height="auto",A.style.height=`${Math.max(100,A.scrollHeight)}px`);},[]),oe=useCallback(A=>{Te(A),setTimeout(nt,0),G.current&&clearTimeout(G.current),G.current=setTimeout(()=>{if(R){let ge={...R,description:A};Ut(ge);}},800);},[R,Ut,nt]),fe=useCallback(A=>{De(A),Ue.current&&clearTimeout(Ue.current),Ue.current=setTimeout(()=>{if(R&&A.trim()){let ge={...R,name:A.trim()};Ut(ge);}},800);},[R,Ut]),L=useCallback(A=>{let ge=A.map(Ve=>{let Ze={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Ve};return Ve.type.startsWith("image/")&&(Ze.preview=URL.createObjectURL(Ve)),Ze});at(Ve=>[...Ve,...ge]);},[]),j=useCallback(A=>{at(ge=>{let Ve=ge.find(Ze=>Ze.id===A);return Ve?.preview&&URL.revokeObjectURL(Ve.preview),ge.filter(Ze=>Ze.id!==A)});},[]),q=useCallback(async()=>{if(!(!R||!Fe.trim()&&ut.length===0||!x)){dt(true);try{let A=$u(Fe,f),ge=[];if(ut.length>0&&b){let Ve=ut.map(Ze=>Ze.file);ge=await b(Ve);}await x(R.id,Fe.trim(),A.length>0?A:void 0,ge.length>0?ge:void 0),_e(""),ut.forEach(Ve=>{Ve.preview&&URL.revokeObjectURL(Ve.preview);}),at([]);}finally{dt(false);}}},[R,Fe,ut,x,f,b]),me=useCallback(()=>{if(!R||!Vt.trim())return;let A=R.subtasks||[],ge={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Vt.trim(),progress:0,startDate:new Date,endDate:new Date,position:A.length},Ve=[...A,ge],Ze={...R,subtasks:Ve};Ut(Ze),Mt(""),wt(false);},[R,Vt,Ut]),Ne=useCallback(A=>{if(!R?.subtasks)return;let ge=R.subtasks.map(Ze=>Ze.id===A?{...Ze,progress:Ze.progress===100?0:100}:Ze),Ve={...R,subtasks:ge};Ut(Ve);},[R,Ut]),Xe=useCallback(A=>{if(!R?.subtasks)return;let ge=R.subtasks.filter(Ze=>Ze.id!==A),Ve={...R,subtasks:ge};Ut(Ve);},[R,Ut]),je=useCallback(A=>{let ge=typeof A=="string"?new Date(A):A,Ze=new Date().getTime()-ge.getTime(),na=Math.floor(Ze/6e4),jt=Math.floor(Ze/36e5),La=Math.floor(Ze/864e5);return na<1?n==="es"?"Ahora":"Just now":na<60?n==="es"?`Hace ${na} min`:`${na}m ago`:jt<24?n==="es"?`Hace ${jt}h`:`${jt}h ago`:La<7?n==="es"?`Hace ${La}d`:`${La}d ago`:ge.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Oe=useCallback(A=>{if(!R)return;let ge=R.progress||0;A==="completed"?ge=100:A==="in-progress"&&ge===0?ge=10:A==="todo"&&(ge=0);let Ve={...R,status:A,progress:ge};Ut(Ve),Je(false);},[R,Ut]),kt=useCallback((A,ge)=>{if(!R)return;let Ve={...R,startDate:A,endDate:ge};Ut(Ve);},[R,Ut]),pt=useCallback(()=>{let A=Be.getFullYear(),ge=Be.getMonth(),Ve=new Date(A,ge,1),na=new Date(A,ge+1,0).getDate(),jt=Ve.getDay(),La=[],qa=new Date(A,ge,0).getDate();for(let ga=jt-1;ga>=0;ga--)La.push({date:new Date(A,ge-1,qa-ga),isCurrentMonth:false});for(let ga=1;ga<=na;ga++)La.push({date:new Date(A,ge,ga),isCurrentMonth:true});let Ia=42-La.length;for(let ga=1;ga<=Ia;ga++)La.push({date:new Date(A,ge+1,ga),isCurrentMonth:false});return La},[Be]),Wt=useCallback(async A=>{if(A.preventDefault(),A.stopPropagation(),le(false),!R||!d)return;let ge=Array.from(A.dataTransfer.files);if(ge.length!==0){K(true);try{await d(R.id,ge);}finally{K(false);}}},[R,d]),Ta=useCallback(async A=>{if(!R||!d||!A.target.files)return;let ge=Array.from(A.target.files);if(ge.length!==0){K(true);try{await d(R.id,ge);}finally{K(false);}A.target.value="";}},[R,d]),Xt=useCallback(A=>{A.preventDefault(),A.stopPropagation(),le(true);},[]),U=useCallback(A=>{A.preventDefault(),A.stopPropagation(),le(false);},[]),ne=useCallback(A=>A<1024?`${A} B`:A<1024*1024?`${(A/1024).toFixed(1)} KB`:`${(A/(1024*1024)).toFixed(1)} MB`,[]),$e=useCallback(A=>A.startsWith("image/")?Image:A.includes("pdf")||A.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:u("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:u("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:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",F?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:u("text-xs font-mono",F?"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 A=R.progress===100?0:100,Ve={...R,progress:A,status:A===100?"completed":"todo"};Ut(Ve);},className:u("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":F?"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:Re,onChange:A=>fe(A.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:u("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]":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:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Ge(),Je(!ye);},className:u("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-blue-500/20 text-blue-400":F?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.progress===100||R.status==="completed"?n==="es"?"COMPLETADO":"DONE":R.progress&&R.progress>0||R.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:ye&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Je(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("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:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(A=>jsxs("button",{onClick:()=>Oe(A.id),className:u("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",R.status===A.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",A.color)}),jsx("span",{className:F?"text-white":"text-gray-900",children:A.label})]},A.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Ge(),Ae(!J);},className:u("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:[R.assignees&&R.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[R.assignees.slice(0,3).map((A,ge)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:A.color||"#8B5CF6"},title:A.name,children:A.initials||A.name.slice(0,2).toUpperCase()},ge)),R.assignees.length>3&&jsxs("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:["+",R.assignees.length-3]})]}):jsx("span",{className:u("text-sm",F?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:u("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:()=>Ae(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("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(A=>{let ge=R.assignees?.some(Ve=>Ve.name===A.name);return jsxs("button",{onClick:()=>{let Ve=R.assignees||[],Ze;ge?Ze=Ve.filter(na=>na.name!==A.name):Ze=[...Ve,A],Le("assignees",Ze);},className:u("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",ge&&(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:A.color||"#8B5CF6"},children:A.initials||A.name.slice(0,2).toUpperCase()}),jsx("span",{className:u("flex-1",F?"text-white":"text-gray-900"),children:A.name}),ge&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},A.name)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{ze(ve?null:"start"),st(R.startDate||new Date);},className:u("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:[R.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:u("mx-1",F?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),R.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:ve&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ze(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:u("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:A=>A.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",F?"border-white/10":"border-gray-200"),children:[(()=>{let A=new Date,ge=new Date(A);ge.setDate(A.getDate()+1);let Ve=new Date(A);Ve.setDate(A.getDate()+((6-A.getDay()+7)%7||7));let Ze=new Date(A);Ze.setDate(A.getDate()+((1-A.getDay()+7)%7||7));let na=new Date(A);na.setDate(A.getDate()+(6-A.getDay()+7)%7+7);let jt=new Date(A);jt.setDate(A.getDate()+14);let La=new Date(A);return La.setDate(A.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:A,display:A.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ge,display:ge.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Ve,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ze,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:na,display:na.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:jt,display:jt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:La,display:La.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ia,ga)=>jsxs("button",{className:u("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(ve==="start"){let cr=R.endDate&&Ia.date>R.endDate?Ia.date:R.endDate;kt(Ia.date,cr),ze("end");}else {let cr=R.startDate&&Ia.date<R.startDate?Ia.date:R.startDate;kt(cr,Ia.date),ze(null);}},children:[jsx("span",{children:Ia.label}),jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:Ia.display})]},ga))})(),jsx("div",{className:u("border-t mt-2 pt-2",F?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{kt(void 0,void 0),ze(null);},className:u("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:n==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",F?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:ve==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:u("font-medium",F?"text-white":"text-gray-900"),children:Be.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>st(new Date),className:u("p-1 rounded text-sm transition-colors",F?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>st(new Date(Be.getFullYear(),Be.getMonth()-1)),className:u("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:()=>st(new Date(Be.getFullYear(),Be.getMonth()+1)),className:u("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:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(A=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",F?"text-[#6B7280]":"text-gray-400"),children:A},A))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:pt().map((A,ge)=>{let Ve=A.date.toDateString()===new Date().toDateString(),Ze=R.startDate?.toDateString()===A.date.toDateString(),na=R.endDate?.toDateString()===A.date.toDateString(),jt=Ze||na,La=R.startDate&&R.endDate&&A.date>=R.startDate&&A.date<=R.endDate;return jsx("button",{onClick:()=>{let qa=new Date(A.date);if(ve==="start"){let Ia=R.endDate&&qa>R.endDate?qa:R.endDate;kt(qa,Ia),ze("end");}else {let Ia=R.startDate&&qa<R.startDate?qa:R.startDate;kt(Ia,qa),ze(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!A.isCurrentMonth&&(F?"text-[#4B5563]":"text-gray-300"),A.isCurrentMonth&&(F?"text-white":"text-gray-900"),Ve&&"ring-2 ring-[#2E94FF]",Ze&&"bg-[#2E94FF] text-white",na&&!Ze&&"bg-[#7C3AED] text-white",La&&!jt&&(F?"bg-[#7C3AED]/20":"bg-purple-100"),!jt&&(F?"hover:bg-white/10":"hover:bg-gray-100")),children:A.date.getDate()},ge)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Ge(),re(!z);},className:u("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":F?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.priority?R.priority==="high"||R.priority==="urgent"?n==="es"?"Alta":"High":R.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:z&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>re(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("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:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(A=>jsxs("button",{onClick:()=>{Le("priority",A.id),re(false);},className:u("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",R.priority===A.id&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",A.color)}),jsx("span",{className:F?"text-white":"text-gray-900",children:A.label})]},A.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:u("text-sm",F?"text-white":"text-gray-900"),children:R.startDate&&R.endDate?`${Math.ceil((R.endDate.getTime()-R.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:u("w-4 h-4 rounded-full border-2",F?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ee?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:R.progress||0,onChange:A=>{let ge=parseInt(A.target.value),Ve=R.status;ge===100?Ve="completed":ge>0?Ve="in-progress":Ve="todo";let Ze={...R,progress:ge,status:Ve};Ut(Ze);},onBlur:()=>it(false),className:u("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-[#2E94FF] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>it(true),className:u("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:u("h-full rounded-full transition-all",R.progress===100?"bg-green-500":"bg-[#2E94FF]"),style:{width:`${R.progress||0}%`}})}),jsxs("span",{className:u("text-sm font-medium min-w-[40px]",F?"text-white":"text-gray-900"),children:[R.progress||0,"%"]})]})]}),w&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="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:u("text-sm px-2 py-0.5 cursor-not-allowed",F?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:C?.estimateMinutes?kn(C.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):C?.estimateMinutes?jsx("button",{type:"button",onClick:()=>tt("estimate"),className:u("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:kn(C.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>tt("estimate"),className:u("text-sm",F?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:gt==="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(oo,{mode:"estimate",locale:n,isDark:F,currentValue:C?.estimateMinutes||null,onSave:async A=>{await E?.(R.id,A),tt(false);},onClose:()=>tt(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:$?jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",F?"text-[#94A3B8]":"text-gray-500"),title:n==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):R.status==="completed"||R.progress===100?jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",F?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:R.quotedMinutes?kn(R.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):R.quotedMinutes?jsx("button",{type:"button",onClick:()=>tt("quoted"),className:u("text-sm px-2 py-0.5 rounded",F?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:kn(R.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>tt("quoted"),className:u("text-sm",F?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:gt==="quoted"&&!$&&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(oo,{mode:"quoted",locale:n,isDark:F,currentValue:R.quotedMinutes||null,onSave:async A=>{I?(await I(R.id,A),_(ge=>ge?{...ge,quotedMinutes:A}:null)):Le("quotedMinutes",A),tt(false);},onClose:()=>tt(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="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:u("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:n==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):T?jsxs("button",{type:"button",onClick:()=>X$1?.(R.id),className:u("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"}),ch(k||0)]}):jsx("button",{type:"button",onClick:()=>S?.(R.id),className:u("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:n==="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:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",F?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>tt("log"),className:u("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"}),n==="es"?"Agregar tiempo":"Add time"]}),C&&C.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:u("text-sm font-medium",C.health==="over-budget"?"text-red-500":C.health==="at-risk"?"text-yellow-500":F?"text-white":"text-gray-900"),children:[kn(C.loggedMinutes),C.estimateMinutes&&jsxs("span",{className:u("font-normal",F?"text-[#6B7280]":"text-gray-400"),children:[" / ",kn(C.estimateMinutes)]})]}),C.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:u("h-full rounded-full transition-all",C.health==="over-budget"?"bg-red-500":C.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,C.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:gt==="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(oo,{mode:"log",locale:n,isDark:F,currentValue:null,onSave:async(A,ge)=>{A&&await v?.(R.id,{durationMinutes:A,note:ge,source:"manual"}),tt(false);},onClose:()=>tt(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(So,{selectedTags:R.tags||[],availableTags:c,onChange:A=>{Le("tags",A);},onCreateTag:i,theme:Y})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:u("w-4 h-4 mt-1.5",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="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(A=>{let ge=g.find(Ve=>Ve.id===A);return jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",F?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ge?.name||A.slice(0,8),jsx("button",{onClick:()=>{let Ve=(R.dependencies||[]).filter(Ze=>Ze!==A);Le("dependencies",Ve);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},A)})}),jsxs("button",{onClick:()=>{Ge(),lt(!de);},className:u("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:u("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:de&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{lt(false),At("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("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:u("p-2 border-b",F?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:rt,onChange:A=>At(A.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("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:g.length>0?g.filter(A=>A.id!==R.id).filter(A=>rt===""||A.name.toLowerCase().includes(rt.toLowerCase())).map(A=>{let ge=R.dependencies?.includes(A.id);return jsxs("button",{onClick:()=>{let Ve=R.dependencies||[],Ze;ge?Ze=Ve.filter(na=>na!==A.id):Ze=[...Ve,A.id],Le("dependencies",Ze);},className:u("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",ge&&(F?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",ge?"bg-blue-500 border-blue-500":F?"border-white/30":"border-gray-300"),children:ge&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:u("block truncate",F?"text-white":"text-gray-900"),children:A.name}),jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:A.id.slice(0,8)})]})]},A.id)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Ge(),vt(!we);},className:u("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:R.color||"#6366F1"}}),jsx("span",{className:u("text-sm",F?"text-white":"text-gray-900"),children:Xo.find(A=>A.value===R.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:u("w-3 h-3",F?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:we&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>vt(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("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:Xo.map(A=>{let ge=R.color===A.value;return jsx("button",{onClick:()=>{Le("color",A.value),vt(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",ge&&"ring-2 ring-offset-2",F?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:A.value,outlineColor:ge?A.value:void 0},title:A.name,children:ge&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},A.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:R.isMilestone||false,onChange:A=>Le("isMilestone",A.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",R.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:u("text-sm",F?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:u("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:u("w-4 h-4",F?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:te,value:pe,onChange:A=>oe(A.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:u("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:u("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:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",R.subtasks&&R.subtasks.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",R.subtasks.filter(A=>A.progress===100).length,"/",R.subtasks.length,")"]})]})}),R.subtasks&&R.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...R.subtasks].sort((A,ge)=>(A.position??0)-(ge.position??0)).map(A=>jsxs("div",{className:u("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:()=>Ne(A.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",A.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:A.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:u("text-sm flex-1",A.progress===100?"line-through text-[#6B7280]":F?"text-white":"text-gray-900"),children:A.name}),jsx("button",{onClick:()=>Xe(A.id),className:u("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"})})]},A.id))}),Dt?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:Vt,onChange:A=>Mt(A.target.value),onKeyDown:A=>{A.key==="Enter"&&Vt.trim()?me():A.key==="Escape"&&(wt(false),Mt(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:u("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-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsx("button",{onClick:me,disabled:!Vt.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Vt.trim()?"bg-blue-500 hover:bg-blue-600 text-white":F?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{wt(false),Mt("");},className:u("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:()=>wt(true),className:u("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"}),n==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",F?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold mb-3",F?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",m.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",m.length,")"]})]}),m.length>0&&jsx("div",{className:"space-y-2 mb-4",children:m.map(A=>{let ge=$e(A.type),Ve=A.type.startsWith("image/");return jsxs("div",{className:u("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:[Ve&&A.thumbnailUrl?jsx("img",{src:A.thumbnailUrl,alt:A.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",F?"bg-white/10":"bg-gray-200"),children:jsx(ge,{className:u("w-5 h-5",F?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:A.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",F?"text-white":"text-gray-900"),children:A.name}),jsx("p",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:ne(A.size)})]}),p&&jsx("button",{onClick:()=>p(A.id),className:u("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:n==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},A.id)})}),jsxs("div",{onDragOver:Xt,onDragLeave:U,onDrop:Wt,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",H?F?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":F?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",D&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:Ta,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||D}),D?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsx("p",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:u("w-6 h-6 mx-auto mb-2",H?"text-blue-500":F?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-500"),children:H?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsx("p",{className:u("text-xs mt-1",F?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:u("w-96 border-l flex flex-col",F?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between h-[49px]",F?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold",F?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",y.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",F?"text-[#6B7280]":"text-gray-400"),children:["(",y.length,")"]})]}),jsx("button",{onClick:a,className:u("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:`
|
|
5
5
|
.activity-comments-scroll::-webkit-scrollbar {
|
|
6
6
|
width: 4px !important;
|
|
7
7
|
}
|
|
@@ -15,8 +15,8 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
15
15
|
.activity-comments-scroll:hover::-webkit-scrollbar-thumb {
|
|
16
16
|
background: ${F?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
|
|
17
17
|
}
|
|
18
|
-
`}),jsx("div",{ref:ft,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",F?"scrollbar-slim":"scrollbar-slim-light"),children:y.length>0?jsx("div",{className:"space-y-4",children:[...y].sort((A,ge)=>{let je=typeof A.createdAt=="string"?new Date(A.createdAt):A.createdAt,tt=typeof ge.createdAt=="string"?new Date(ge.createdAt):ge.createdAt;return je.getTime()-tt.getTime()}).map(A=>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:A.user?.color||"#8B5CF6"},children:A.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:u("text-sm font-medium",F?"text-white":"text-gray-900"),children:A.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:_e(A.createdAt)})]}),jsx("div",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-600"),children:jsx(zu,{content:A.content,theme:s})}),A.attachments&&A.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:A.attachments.map(ge=>{let je=ge.type.startsWith("image/");return jsxs("a",{href:ge.url,target:"_blank",rel:"noopener noreferrer",className:u("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:[je?jsx(Image,{className:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:u("text-xs truncate max-w-[100px]",F?"text-white":"text-gray-900"),children:ge.name})]},ge.id)})})]})]},A.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:u("w-10 h-10 mb-3",F?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:u("text-sm",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:u("py-4 pl-4 pr-2 border-t",F?"border-white/10":"border-gray-200"),children:jsx(Hu,{value:Ne,onChange:Ve,onSubmit:K,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:Tt,theme:s,locale:n,currentUser:h,enableEmoji:true,enableAttachments:!!b,pendingFiles:nt,onFilesSelect:L,onRemoveFile:j})})]})]})]})})}function Il(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function Mo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:i,isLoading:c,error:l,children:m,availableTags:d=[],onCreateTag:p,attachmentsByCard:g,onUploadAttachments:y,onDeleteAttachment:x,comments:h,onAddComment:f,currentUser:b,mentionableUsers:w,onTaskOpen:C,onUploadCommentAttachments:N,enableTimeTracking:T,timeTrackingSummary:k,timeEntries:v,timerState:E,onLogTime:I,onUpdateEstimate:D,onUpdateSoldEffort:X,onStartTimer:O,onStopTimer:H,onDiscardTimer:F,blurFinancials:Y=false,sidePanel:Z,renderColumnMetrics:Se,suppressDetailModal:R=false}){let[_,he]=Il(),[Je,z]=useState(null),[re,J]=useState(false),Pe=useRef(null),ve=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),We=o?.theme||"dark",Re=We==="dark"||We==="neutral",st=Re?"dark":"",ee=useCallback((S,q)=>{t.onCardUpdate?.(S,q);},[t]),it=useCallback((S,q)=>{t.onColumnUpdate?.(S,{title:q});},[t]),le=useCallback(S=>{t.onColumnDelete?.(S);},[t]),ot=["todo","in-progress","completed"],yt=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Pt=useMemo(()=>{let S=new Map;return e.columns.forEach(q=>{let ce=q.cardIds.map(Ce=>e.cards.find(W=>W.id===Ce)).filter(Ce=>Ce!==void 0).sort((Ce,W)=>Ce.position-W.position);S.set(q.id,ce);}),S},[e.cards,e.columns]);useEffect(()=>{let S=Pe.current;if(!S)return;let q=te=>{let Ge=te.target,Te=te.button===1,Ue=Ge===S||Ge.classList.contains("asakaa-column")&&!Ge.closest(".asakaa-card");(Te||te.button===0&&Ue&&!_.isDragging)&&(te.preventDefault(),J(true),ve.current={x:te.clientX,y:te.clientY,scrollLeft:S.scrollLeft,scrollTop:S.scrollTop},S.style.cursor="grabbing",S.style.userSelect="none");},ce=te=>{if(!re)return;let Ge=te.clientX-ve.current.x,Te=te.clientY-ve.current.y;S.scrollLeft=ve.current.scrollLeft-Ge,S.scrollTop=ve.current.scrollTop-Te;},Ce=()=>{re&&(J(false),S.style.cursor="",S.style.userSelect="");},W=()=>{re&&(J(false),S.style.cursor="",S.style.userSelect="");};return S.addEventListener("mousedown",q),document.addEventListener("mousemove",ce),document.addEventListener("mouseup",Ce),S.addEventListener("mouseleave",W),()=>{S.removeEventListener("mousedown",q),document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",Ce),S.removeEventListener("mouseleave",W);}},[re,_.isDragging]);let ke=useMemo(()=>e.cards.map(S=>({id:S.id,name:S.title,startDate:S.startDate?new Date(S.startDate):void 0,endDate:S.endDate?new Date(S.endDate):void 0,progress:S.progress||0,status:S.columnId,priority:S.priority?.toLowerCase(),dependencies:Array.isArray(S.dependencies)?S.dependencies.map(q=>typeof q=="string"?q:q.taskId):[]})),[e.cards]),xt=useCallback(S=>{let{active:q}=S,ce=e.cards.find(Ce=>Ce.id===q.id);ce&&he({isDragging:true,draggedCardId:ce.id,sourceColumnId:ce.columnId,targetColumnId:ce.columnId});},[e.cards,he]),ct=useCallback(S=>{let{active:q,over:ce}=S;if(!ce||!e.cards.find(te=>te.id===q.id))return;let W=null;ce.data.current?.type==="column"?W=ce.id:ce.data.current?.type==="card"&&(W=e.cards.find(Ge=>Ge.id===ce.id)?.columnId||null),W&&W!==_.targetColumnId&&he({..._,targetColumnId:W});},[e.cards,_,he]),rt=useCallback(async S=>{let{active:q,over:ce}=S;if(he({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!ce)return;let Ce=e.cards.find(Te=>Te.id===q.id);if(!Ce)return;let W,te;if(ce.data.current?.type==="column"){W=ce.id;let Te=Pt.get(W)||[];te=bl(Te,0);}else {let Te=e.cards.find(Ve=>Ve.id===ce.id);if(!Te)return;W=Te.columnId;let Ue=Pt.get(W)||[],Ne=Ue.findIndex(Ve=>Ve.id===ce.id);te=bl(Ue,Ne);}let Ge=e.columns.find(Te=>Te.id===W);if(Ge&&Ge.wipLimit&&Ge.wipLimitType==="hard"){let Te=Pt.get(W)||[];if(Ce.columnId!==W&&Te.length>=Ge.wipLimit){t.onWipLimitExceeded?.(Ge,Ce);return}}(Ce.columnId!==W||Ce.position!==te)&&await t.onCardMove?.(Ce.id,W,te);},[e.cards,e.columns,Pt,t,he]),$=useCallback(S=>{R||z(S),a?.(S),C?.(S.id);},[a,C,R]),de=useCallback(S=>{t.onCardUpdate?.(S.id,S),z(S);},[t]);return c?jsx("div",{className:u("asakaa-board",st,n),style:i,children:jsx(Ch,{columnCount:3})}):l?jsx("div",{className:u("asakaa-board",st,n),style:i,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof l=="string"?l:l.message})]})})}):jsxs(gu,{themeName:We,children:[jsxs("div",{className:u("flex h-full overflow-hidden",Z?"flex-row":""),children:[jsxs(DndContext,{sensors:yt,collisionDetection:closestCorners,onDragStart:xt,onDragOver:ct,onDragEnd:rt,children:[jsxs("div",{ref:Pe,className:u("asakaa-board",Z?"flex-1":"",st,n),style:{...i,cursor:re?"grabbing":void 0},"data-theme":We,children:[e.columns.sort((S,q)=>S.position-q.position).map(S=>{let q=Pt.get(S.id)||[],ce=!ot.includes(S.id),Ce=r?.renderColumnFooter?.(S);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(xn,{column:S,cards:q,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Se?(W,te)=>Se(W,te):void 0,onCardClick:$,onCardUpdate:ee,onColumnRename:t.onColumnUpdate?it:void 0,onColumnDelete:t.onColumnDelete?le:void 0,isDeletable:ce,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),Ce]},S.id)}),m]}),jsx(DragOverlay,{children:_.draggedCardId?jsx(mo,{card:e.cards.find(S=>S.id===_.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),Z]}),!R&&jsx(fo,{task:Je,isOpen:!!Je,onClose:()=>z(null),onCardUpdate:de,theme:Re?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:p,attachments:Je?g?.get(Je.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:x,availableTasks:ke,comments:h,onAddComment:f,currentUser:b,mentionableUsers:w,onUploadCommentAttachments:N,enableTimeTracking:T,timeTrackingSummary:k,timeEntries:v,isTimerRunning:E?.isRunning,timerElapsedSeconds:E?.elapsedSeconds,onTimeLog:I,onEstimateUpdate:D,onSoldEffortUpdate:X,onTimerStart:O,onTimerStop:H,onTimerDiscard:F,blurFinancials:Y})]})}function Ch({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 Eh={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, 127, 255, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},Mh={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:"#2E94FF",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Fh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Ph={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Ah({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),i=useRef(null);useEffect(()=>{let l=m=>{i.current&&!i.current.contains(m.target)&&n(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let c=l=>{t(l),n(false);};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((l,m)=>l.position-m.position).map((l,m)=>jsxs(motion.button,{onClick:()=>c(l.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:m<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:l.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function Lh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[i,c]=useState(null),l=useRef(null);if(useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),p=async(g,y)=>{if(y){c(g);try{await y();}catch(x){console.error(`Export ${g} failed:`,x);}finally{c(null),n(false);}}};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:d.map((g,y)=>jsxs(motion.button,{onClick:()=>p(g.id,g.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===g.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):g.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Ih({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, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function Rl({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:i,onExportExcel:c,translations:l,toolbarRightContent:m,toolbarEndContent:d}){let p=r==="dark"?Eh:Mh,g={...o==="es"?Fh:Ph,...l},y=n||i||c;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxs("div",{className:"flex items-center gap-3",children:[m&&jsxs(Fragment,{children:[m,jsx("div",{className:"w-px h-5",style:{backgroundColor:p.borderLight}})]}),y&&jsxs(Fragment,{children:[jsx(Lh,{theme:p,t:g,onExportCSV:n,onExportJSON:i,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),d,t&&(s?jsx(Ah,{columns:e,onSelect:t,theme:p,t:g,createTaskLabel:a}):jsx(Ih,{onClick:()=>t(),label:a||g.newTask}))]})})}function $l({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[i,c]=useState(""),l=useCallback(()=>{let p=i.trim();p&&(e(p),c(""),n(false));},[i,e]),m=useCallback(p=>{p.key==="Enter"?(p.preventDefault(),l()):p.key==="Escape"&&(c(""),n(false));},[l]),d=useCallback(()=>{setTimeout(()=>{i.trim()||n(false);},150);},[i]);return s?jsx("div",{className:u("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:i,onChange:p=>c(p.target.value),onKeyDown:m,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:l,disabled:!i.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{c(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:u("asakaa-add-column",t),children:jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Xo({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:i="up"}){let[c,l]=useState(""),[m,d]=useState(void 0),[p,g]=useState(null),[y,x]=useState(null),[h,f]=useState(false),[b,w]=useState(false),[C,N]=useState(false),[T,k]=useState(s||new Date),v=useRef(null),E=o==="es",I=i==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{v.current?.focus();},[]);let D=useCallback(()=>{f(false),w(false),N(false);},[]),X=useCallback(()=>{l(""),d(void 0),g(null),x(null),D(),t();},[t,D]),O=useCallback(()=>{let Y=c.trim();if(!Y)return;let Z=a.find(R=>R.id===p),Se=y||s;e({name:Y,priority:m,assignee:Z||void 0,assigneeId:p,startDate:Se,endDate:Se}),l(""),d(void 0),g(null),x(null),D(),v.current?.focus();},[c,m,p,y,s,a,e,D]),H=useCallback(Y=>{Y.key==="Enter"&&c.trim()&&(Y.preventDefault(),O()),Y.key==="Escape"&&X();},[O,X,c]),F=y||s||new Date;return jsxs("div",{className:u("quick-task-create",n),onClick:()=>D(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:v,type:"text",value:c,onChange:Y=>l(Y.target.value),placeholder:E?"Nombre de la tarea...":"Task name...",className:u("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:H})}),jsxs("div",{className:u("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:Y=>{Y.stopPropagation(),f(!h),w(false),N(false);},type:"button",className:u("p-1 rounded transition-colors",m?m==="urgent"||m==="high"?"text-red-400 bg-red-500/20":m==="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:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",I,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>Y.stopPropagation(),children:[{id:"urgent",label:E?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:E?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:E?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:E?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:E?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(Y=>jsxs("button",{onClick:()=>{d(Y.id),f(false);},type:"button",className:u("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",m===Y.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",Y.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:Y.label})]},Y.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:Y=>{Y.stopPropagation(),N(!C),f(false),w(false),k(y||s||new Date);},type:"button",className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",y?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-blue-500/20 text-blue-600":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"}),F.toLocaleDateString(E?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:C&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",I,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>Y.stopPropagation(),children:[jsx("div",{className:u("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let Y=new Date,Z=new Date(Y);Z.setDate(Y.getDate()+1);let Se=new Date(Y);Se.setDate(Y.getDate()+((6-Y.getDay()+7)%7||7));let R=new Date(Y);R.setDate(Y.getDate()+((1-Y.getDay()+7)%7||7));let _=new Date(Y);_.setDate(Y.getDate()+14);let he=new Date(Y);he.setDate(Y.getDate()+28);let Je=E?"es-ES":"en-US";return [{label:E?"Hoy":"Today",date:Y,display:Y.toLocaleDateString(Je,{weekday:"short"}).slice(0,3)+"."},{label:E?"Ma\xF1ana":"Tomorrow",date:Z,display:Z.toLocaleDateString(Je,{weekday:"short"}).slice(0,3)+"."},{label:E?"Este fin de semana":"This weekend",date:Se,display:E?"s\xE1b.":"sat."},{label:E?"Pr\xF3xima semana":"Next week",date:R,display:E?"lun.":"mon."},{label:E?"2 semanas":"2 weeks",date:_,display:_.toLocaleDateString(Je,{day:"numeric",month:"short"})},{label:E?"4 semanas":"4 weeks",date:he,display:he.toLocaleDateString(Je,{day:"numeric",month:"short"})}].map((re,J)=>jsxs("button",{type:"button",className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{x(re.date),N(false);},children:[jsx("span",{children:re.label}),jsx("span",{className:u("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:re.display})]},J))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:u("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:T.toLocaleDateString(E?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>k(new Date),className:u("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:E?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>k(new Date(T.getFullYear(),T.getMonth()-1)),className:u("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:()=>k(new Date(T.getFullYear(),T.getMonth()+1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(E?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(Y=>jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:Y},Y))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Y=T.getFullYear(),Z=T.getMonth(),Se=new Date(Y,Z,1).getDay(),R=new Date(Y,Z+1,0).getDate(),_=new Date(Y,Z,0).getDate(),he=new Date().toDateString(),Je=[];for(let re=Se-1;re>=0;re--)Je.push({dayNum:_-re,isCurrent:false,date:new Date(Y,Z-1,_-re)});for(let re=1;re<=R;re++)Je.push({dayNum:re,isCurrent:true,date:new Date(Y,Z,re)});let z=42-Je.length;for(let re=1;re<=z;re++)Je.push({dayNum:re,isCurrent:false,date:new Date(Y,Z+1,re)});return Je.map((re,J)=>{let Pe=re.date.toDateString()===he,ve=(y||s)?.toDateString()===re.date.toDateString();return jsx("button",{type:"button",className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!re.isCurrent&&(r?"text-white/20":"text-gray-300"),re.isCurrent&&(r?"text-white":"text-gray-900"),Pe&&"ring-1 ring-[#007FFF]",ve&&"bg-[#007FFF] text-white",!ve&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(re.date),N(false);},children:re.dayNum},J)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:Y=>{Y.stopPropagation(),w(!b),f(false),N(false);},type:"button",className:u("p-1 rounded transition-colors",p?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:p?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(Y=>Y.id===p)?.color||"#007FFF"},children:a.find(Y=>Y.id===p)?.initials||a.find(Y=>Y.id===p)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:b&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",I,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>Y.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{g(null),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!p&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:r?"text-white/40":"text-gray-500",children:E?"Sin asignar":"Unassigned"})]}),a.map(Y=>jsxs("button",{type:"button",onClick:()=>{g(Y.id),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===Y.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:Y.color||"#007FFF"},children:Y.initials||Y.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:Y.name})]},Y.id)),a.length===0&&jsx("div",{className:u("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:E?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:O,disabled:!c.trim(),type:"button",className:u("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:E?"Guardar":"Save"})]})]})}function Gl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:i="es"}){let[c,l]=useState(false),m=useRef(null),d=useRef(null),[p,g]=useState({}),[y,x]=useState(false),h=n==="dark",b={buttonLabel:o||(i==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!c||!m.current)return;let C=90,N=()=>{let T=m.current.getBoundingClientRect(),v=window.innerHeight-T.bottom<C+8;x(v),g({position:"fixed",...v?{bottom:window.innerHeight-T.top+4}:{top:T.bottom+4},left:T.left,width:T.width,zIndex:9999});};return N(),window.addEventListener("scroll",N,true),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,true),window.removeEventListener("resize",N);}},[c]),useEffect(()=>{if(!c)return;let C=N=>{let T=N.target;d.current&&!d.current.contains(T)&&m.current&&!m.current.contains(T)&&l(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]);let w=useCallback(C=>{t({name:C.name,columnId:e,assigneeIds:C.assigneeId?[C.assigneeId]:void 0,startDate:C.startDate,endDate:C.endDate,priority:C.priority});},[t,e]);return jsxs("div",{ref:m,className:u("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>l(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),b.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:d,initial:{opacity:0,y:y?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:y?4:-4,scale:.97},transition:{duration:.12},style:p,className:u("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(Xo,{onSubmit:w,onCancel:()=>l(false),availableUsers:a,isDark:h,locale:i,dropdownDirection:"up"})})}),document.body)]})}var ns=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(Mo,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
19
|
-
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function yp(e={}){return new ns(e)}var kn=class extends Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxs("div",{className:"flex items-start gap-3",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxs("details",{className:"mb-3",children:[jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function Vl(e,t){let a=r=>jsx(kn,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function _l({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:i,onOpenAIUsage:c,shortcut:l="k",className:m=""}){let[d,p]=useState(false),[g,y]=useState(""),[x,h]=useState("home"),[f,b]=useState(""),[w,C]=useState("");useEffect(()=>{let v=E=>{(E.metaKey||E.ctrlKey)&&E.key===l&&(E.preventDefault(),p(I=>!I)),E.key==="Escape"&&(p(false),h("home"),y(""));};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[l]),useEffect(()=>{d||(h("home"),y(""),b(""),C(""));},[d]);let N=useCallback(()=>{p(false);},[]),T=useCallback(v=>{let[E,I]=v.split(":");switch(E){case "create-card":h("create-card");break;case "create-card-in":b(I||"");break;case "navigate":I?(a?.(I),N()):h("navigate");break;case "search":r?.(g),N();break;case "priority":h("priority");break;case "set-priority":w&&I&&(o?.(w,I),N());break;case "assign":h("assign");break;case "assign-user":w&&I&&(s?.(w,I),N());break;case "ai":h("ai");break;case "ai-generate-plan":n?.(),N();break;case "ai-predict-risks":i?.(),N();break;case "ai-usage":c?.(),N();break;case "back":h("home");break;}},[g,w,t,a,r,o,s,n,i,c,N]),k=useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),N());},[f,g,t,N]);return d?jsx(Xt,{children:jsx("div",{className:"command-palette-overlay",onClick:N,children:jsx("div",{className:`command-palette ${m}`,onClick:v=>v.stopPropagation(),children:jsxs(Command,{value:g,onValueChange:y,label:"Command Menu",children:[jsxs("div",{className:"command-palette-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx(Command.Input,{placeholder:x==="create-card"&&f?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:v=>{v.key==="Enter"&&x==="create-card"&&f&&k();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),x==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:T,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:T,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:T,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:T,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(v=>jsxs(Command.Item,{value:`navigate:${v.id}`,onSelect:T,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:v.priority==="URGENT"?"#EF4444":v.priority==="HIGH"?"#F59E0B":v.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:v.title}),v.labels&&v.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:v.labels.slice(0,2).map(E=>jsx("span",{className:"command-palette-item-label",children:E},E))})]},v.id))})]}),x==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:T,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(v=>jsxs(Command.Item,{value:`create-card-in:${v.id}`,onSelect:T,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:v.title}),jsxs("div",{className:"command-palette-item-count",children:[v.cardIds.length," cards"]})]},v.id))})]}),x==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:T,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(v=>{let E=e.columns.find(I=>I.id===v.columnId);return jsxs(Command.Item,{value:`navigate:${v.id}`,onSelect:T,className:"command-palette-item",keywords:[v.title,v.description||"",...v.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:v.priority==="URGENT"?"#EF4444":v.priority==="HIGH"?"#F59E0B":v.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:v.title}),jsx("div",{className:"command-palette-item-meta",children:E?.title})]}),v.labels&&v.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:v.labels.slice(0,2).map(I=>jsx("span",{className:"command-palette-item-label",children:I},I))})]},v.id)})})]}),x==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:T,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:T,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:T,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:T,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 wp(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
|
|
18
|
+
`}),jsx("div",{ref:bt,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",F?"scrollbar-slim":"scrollbar-slim-light"),children:y.length>0?jsx("div",{className:"space-y-4",children:[...y].sort((A,ge)=>{let Ve=typeof A.createdAt=="string"?new Date(A.createdAt):A.createdAt,Ze=typeof ge.createdAt=="string"?new Date(ge.createdAt):ge.createdAt;return Ve.getTime()-Ze.getTime()}).map(A=>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:A.user?.color||"#8B5CF6"},children:A.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:u("text-sm font-medium",F?"text-white":"text-gray-900"),children:A.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:u("text-xs",F?"text-[#6B7280]":"text-gray-400"),children:je(A.createdAt)})]}),jsx("div",{className:u("text-sm",F?"text-[#9CA3AF]":"text-gray-600"),children:jsx(zu,{content:A.content,theme:s})}),A.attachments&&A.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:A.attachments.map(ge=>{let Ve=ge.type.startsWith("image/");return jsxs("a",{href:ge.url,target:"_blank",rel:"noopener noreferrer",className:u("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:[Ve?jsx(Image,{className:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:u("w-4 h-4",F?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:u("text-xs truncate max-w-[100px]",F?"text-white":"text-gray-900"),children:ge.name})]},ge.id)})})]})]},A.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:u("w-10 h-10 mb-3",F?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:u("text-sm",F?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:u("py-4 pl-4 pr-2 border-t",F?"border-white/10":"border-gray-200"),children:jsx(Hu,{value:Fe,onChange:_e,onSubmit:q,users:f,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:ft,theme:s,locale:n,currentUser:h,enableEmoji:true,enableAttachments:!!b,pendingFiles:ut,onFilesSelect:L,onRemoveFile:j})})]})]})]})})}function Bl(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function Fo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:c,error:i,children:m,availableTags:d=[],onCreateTag:p,attachmentsByCard:g,onUploadAttachments:y,onDeleteAttachment:x,comments:h,onAddComment:f,currentUser:b,mentionableUsers:w,onTaskOpen:C,onUploadCommentAttachments:N,enableTimeTracking:T,timeTrackingSummary:k,timeEntries:v,timerState:E,onLogTime:I,onUpdateEstimate:S,onUpdateSoldEffort:X,onStartTimer:O,onStopTimer:$,onDiscardTimer:F,blurFinancials:Y=false,sidePanel:Z,renderColumnMetrics:Ee,suppressDetailModal:R=false}){let[_,ye]=Bl(),[Je,z]=useState(null),[re,J]=useState(false),Ae=useRef(null),ve=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),ze=o?.theme||"dark",Be=ze==="dark"||ze==="neutral",st=Be?"dark":"",ee=useCallback((D,K)=>{t.onCardUpdate?.(D,K);},[t]),it=useCallback((D,K)=>{t.onColumnUpdate?.(D,{title:K});},[t]),de=useCallback(D=>{t.onColumnDelete?.(D);},[t]),lt=["todo","in-progress","completed"],rt=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),At=useMemo(()=>{let D=new Map;return e.columns.forEach(K=>{let pe=K.cardIds.map(Te=>e.cards.find(G=>G.id===Te)).filter(Te=>Te!==void 0).sort((Te,G)=>Te.position-G.position);D.set(K.id,pe);}),D},[e.cards,e.columns]);useEffect(()=>{let D=Ae.current;if(!D)return;let K=te=>{let Re=te.target,De=te.button===1,Ue=Re===D||Re.classList.contains("asakaa-column")&&!Re.closest(".asakaa-card");(De||te.button===0&&Ue&&!_.isDragging)&&(te.preventDefault(),J(true),ve.current={x:te.clientX,y:te.clientY,scrollLeft:D.scrollLeft,scrollTop:D.scrollTop},D.style.cursor="grabbing",D.style.userSelect="none");},pe=te=>{if(!re)return;let Re=te.clientX-ve.current.x,De=te.clientY-ve.current.y;D.scrollLeft=ve.current.scrollLeft-Re,D.scrollTop=ve.current.scrollTop-De;},Te=()=>{re&&(J(false),D.style.cursor="",D.style.userSelect="");},G=()=>{re&&(J(false),D.style.cursor="",D.style.userSelect="");};return D.addEventListener("mousedown",K),document.addEventListener("mousemove",pe),document.addEventListener("mouseup",Te),D.addEventListener("mouseleave",G),()=>{D.removeEventListener("mousedown",K),document.removeEventListener("mousemove",pe),document.removeEventListener("mouseup",Te),D.removeEventListener("mouseleave",G);}},[re,_.isDragging]);let we=useMemo(()=>e.cards.map(D=>({id:D.id,name:D.title,startDate:D.startDate?new Date(D.startDate):void 0,endDate:D.endDate?new Date(D.endDate):void 0,progress:D.progress||0,status:D.columnId,priority:D.priority?.toLowerCase(),dependencies:Array.isArray(D.dependencies)?D.dependencies.map(K=>typeof K=="string"?K:K.taskId):[]})),[e.cards]),vt=useCallback(D=>{let{active:K}=D,pe=e.cards.find(Te=>Te.id===K.id);pe&&ye({isDragging:true,draggedCardId:pe.id,sourceColumnId:pe.columnId,targetColumnId:pe.columnId});},[e.cards,ye]),gt=useCallback(D=>{let{active:K,over:pe}=D;if(!pe||!e.cards.find(te=>te.id===K.id))return;let G=null;pe.data.current?.type==="column"?G=pe.id:pe.data.current?.type==="card"&&(G=e.cards.find(Re=>Re.id===pe.id)?.columnId||null),G&&G!==_.targetColumnId&&ye({..._,targetColumnId:G});},[e.cards,_,ye]),tt=useCallback(async D=>{let{active:K,over:pe}=D;if(ye({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!pe)return;let Te=e.cards.find(De=>De.id===K.id);if(!Te)return;let G,te;if(pe.data.current?.type==="column"){G=pe.id;let De=At.get(G)||[];te=hl(De,0);}else {let De=e.cards.find(_e=>_e.id===pe.id);if(!De)return;G=De.columnId;let Ue=At.get(G)||[],Fe=Ue.findIndex(_e=>_e.id===pe.id);te=hl(Ue,Fe);}let Re=e.columns.find(De=>De.id===G);if(Re&&Re.wipLimit&&Re.wipLimitType==="hard"){let De=At.get(G)||[];if(Te.columnId!==G&&De.length>=Re.wipLimit){t.onWipLimitExceeded?.(Re,Te);return}}(Te.columnId!==G||Te.position!==te)&&await t.onCardMove?.(Te.id,G,te);},[e.cards,e.columns,At,t,ye]),H=useCallback(D=>{R||z(D),a?.(D),C?.(D.id);},[a,C,R]),le=useCallback(D=>{t.onCardUpdate?.(D.id,D),z(D);},[t]);return c?jsx("div",{className:u("asakaa-board",st,n),style:l,children:jsx(Ch,{columnCount:3})}):i?jsx("div",{className:u("asakaa-board",st,n),style:l,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxs(gu,{themeName:ze,children:[jsxs("div",{className:u("flex h-full overflow-hidden",Z?"flex-row":""),children:[jsxs(DndContext,{sensors:rt,collisionDetection:closestCorners,onDragStart:vt,onDragOver:gt,onDragEnd:tt,children:[jsxs("div",{ref:Ae,className:u("asakaa-board",Z?"flex-1":"",st,n),style:{...l,cursor:re?"grabbing":void 0},"data-theme":ze,children:[e.columns.sort((D,K)=>D.position-K.position).map(D=>{let K=At.get(D.id)||[],pe=!lt.includes(D.id),Te=r?.renderColumnFooter?.(D);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(vn,{column:D,cards:K,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Ee?(G,te)=>Ee(G,te):void 0,onCardClick:H,onCardUpdate:ee,onColumnRename:t.onColumnUpdate?it:void 0,onColumnDelete:t.onColumnDelete?de:void 0,isDeletable:pe,locale:o?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight}),Te]},D.id)}),m]}),jsx(DragOverlay,{children:_.draggedCardId?jsx(go,{card:e.cards.find(D=>D.id===_.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),Z]}),!R&&jsx(bo,{task:Je,isOpen:!!Je,onClose:()=>z(null),onCardUpdate:le,theme:Be?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:p,attachments:Je?g?.get(Je.id)||[]:[],onUploadAttachments:y,onDeleteAttachment:x,availableTasks:we,comments:h,onAddComment:f,currentUser:b,mentionableUsers:w,onUploadCommentAttachments:N,enableTimeTracking:T,timeTrackingSummary:k,timeEntries:v,isTimerRunning:E?.isRunning,timerElapsedSeconds:E?.elapsedSeconds,onTimeLog:I,onEstimateUpdate:S,onSoldEffortUpdate:X,onTimerStart:O,onTimerStop:$,onTimerDiscard:F,blurFinancials:Y})]})}function Ch({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 Eh={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, 127, 255, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},Mh={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:"#2E94FF",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Fh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Ph={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Ah({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let i=m=>{l.current&&!l.current.contains(m.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let c=i=>{t(i),n(false);};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,m)=>i.position-m.position).map((i,m)=>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:m<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.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 Lh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[l,c]=useState(null),i=useRef(null);if(useEffect(()=>{let g=y=>{i.current&&!i.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(g=>g.handler),p=async(g,y)=>{if(y){c(g);try{await y();}catch(x){console.error(`Export ${g} failed:`,x);}finally{c(null),n(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:d.map((g,y)=>jsxs(motion.button,{onClick:()=>p(g.id,g.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===g.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):g.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Ih({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, 127, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 127, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function Ol({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:c,translations:i,toolbarRightContent:m,toolbarEndContent:d}){let p=r==="dark"?Eh:Mh,g={...o==="es"?Fh:Ph,...i},y=n||l||c;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxs("div",{className:"flex items-center gap-3",children:[m&&jsxs(Fragment,{children:[m,jsx("div",{className:"w-px h-5",style:{backgroundColor:p.borderLight}})]}),y&&jsxs(Fragment,{children:[jsx(Lh,{theme:p,t:g,onExportCSV:n,onExportJSON:l,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),d,t&&(s?jsx(Ah,{columns:e,onSelect:t,theme:p,t:g,createTaskLabel:a}):jsx(Ih,{onClick:()=>t(),label:a||g.newTask}))]})})}function Hl({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[l,c]=useState(""),i=useCallback(()=>{let p=l.trim();p&&(e(p),c(""),n(false));},[l,e]),m=useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(c(""),n(false));},[i]),d=useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsx("div",{className:u("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:l,onChange:p=>c(p.target.value),onKeyDown:m,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!l.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{c(""),n(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:u("asakaa-add-column",t),children:jsxs("button",{onClick:()=>n(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Jo({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:o="es",defaultDate:s,className:n,dropdownDirection:l="up"}){let[c,i]=useState(""),[m,d]=useState(void 0),[p,g]=useState(null),[y,x]=useState(null),[h,f]=useState(false),[b,w]=useState(false),[C,N]=useState(false),[T,k]=useState(s||new Date),v=useRef(null),E=o==="es",I=l==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{v.current?.focus();},[]);let S=useCallback(()=>{f(false),w(false),N(false);},[]),X=useCallback(()=>{i(""),d(void 0),g(null),x(null),S(),t();},[t,S]),O=useCallback(()=>{let Y=c.trim();if(!Y)return;let Z=a.find(R=>R.id===p),Ee=y||s;e({name:Y,priority:m,assignee:Z||void 0,assigneeId:p,startDate:Ee,endDate:Ee}),i(""),d(void 0),g(null),x(null),S(),v.current?.focus();},[c,m,p,y,s,a,e,S]),$=useCallback(Y=>{Y.key==="Enter"&&c.trim()&&(Y.preventDefault(),O()),Y.key==="Escape"&&X();},[O,X,c]),F=y||s||new Date;return jsxs("div",{className:u("quick-task-create",n),onClick:()=>S(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:v,type:"text",value:c,onChange:Y=>i(Y.target.value),placeholder:E?"Nombre de la tarea...":"Task name...",className:u("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:$})}),jsxs("div",{className:u("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:Y=>{Y.stopPropagation(),f(!h),w(false),N(false);},type:"button",className:u("p-1 rounded transition-colors",m?m==="urgent"||m==="high"?"text-red-400 bg-red-500/20":m==="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:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",I,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>Y.stopPropagation(),children:[{id:"urgent",label:E?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:E?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:E?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:E?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:E?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(Y=>jsxs("button",{onClick:()=>{d(Y.id),f(false);},type:"button",className:u("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",m===Y.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",Y.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:Y.label})]},Y.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:Y=>{Y.stopPropagation(),N(!C),f(false),w(false),k(y||s||new Date);},type:"button",className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",y?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-blue-500/20 text-blue-600":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"}),F.toLocaleDateString(E?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:C&&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:u("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",I,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>Y.stopPropagation(),children:[jsx("div",{className:u("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let Y=new Date,Z=new Date(Y);Z.setDate(Y.getDate()+1);let Ee=new Date(Y);Ee.setDate(Y.getDate()+((6-Y.getDay()+7)%7||7));let R=new Date(Y);R.setDate(Y.getDate()+((1-Y.getDay()+7)%7||7));let _=new Date(Y);_.setDate(Y.getDate()+14);let ye=new Date(Y);ye.setDate(Y.getDate()+28);let Je=E?"es-ES":"en-US";return [{label:E?"Hoy":"Today",date:Y,display:Y.toLocaleDateString(Je,{weekday:"short"}).slice(0,3)+"."},{label:E?"Ma\xF1ana":"Tomorrow",date:Z,display:Z.toLocaleDateString(Je,{weekday:"short"}).slice(0,3)+"."},{label:E?"Este fin de semana":"This weekend",date:Ee,display:E?"s\xE1b.":"sat."},{label:E?"Pr\xF3xima semana":"Next week",date:R,display:E?"lun.":"mon."},{label:E?"2 semanas":"2 weeks",date:_,display:_.toLocaleDateString(Je,{day:"numeric",month:"short"})},{label:E?"4 semanas":"4 weeks",date:ye,display:ye.toLocaleDateString(Je,{day:"numeric",month:"short"})}].map((re,J)=>jsxs("button",{type:"button",className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{x(re.date),N(false);},children:[jsx("span",{children:re.label}),jsx("span",{className:u("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:re.display})]},J))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:u("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:T.toLocaleDateString(E?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>k(new Date),className:u("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:E?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>k(new Date(T.getFullYear(),T.getMonth()-1)),className:u("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:()=>k(new Date(T.getFullYear(),T.getMonth()+1)),className:u("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(E?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(Y=>jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:Y},Y))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Y=T.getFullYear(),Z=T.getMonth(),Ee=new Date(Y,Z,1).getDay(),R=new Date(Y,Z+1,0).getDate(),_=new Date(Y,Z,0).getDate(),ye=new Date().toDateString(),Je=[];for(let re=Ee-1;re>=0;re--)Je.push({dayNum:_-re,isCurrent:false,date:new Date(Y,Z-1,_-re)});for(let re=1;re<=R;re++)Je.push({dayNum:re,isCurrent:true,date:new Date(Y,Z,re)});let z=42-Je.length;for(let re=1;re<=z;re++)Je.push({dayNum:re,isCurrent:false,date:new Date(Y,Z+1,re)});return Je.map((re,J)=>{let Ae=re.date.toDateString()===ye,ve=(y||s)?.toDateString()===re.date.toDateString();return jsx("button",{type:"button",className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!re.isCurrent&&(r?"text-white/20":"text-gray-300"),re.isCurrent&&(r?"text-white":"text-gray-900"),Ae&&"ring-1 ring-[#007FFF]",ve&&"bg-[#007FFF] text-white",!ve&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(re.date),N(false);},children:re.dayNum},J)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:Y=>{Y.stopPropagation(),w(!b),f(false),N(false);},type:"button",className:u("p-1 rounded transition-colors",p?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:p?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(Y=>Y.id===p)?.color||"#007FFF"},children:a.find(Y=>Y.id===p)?.initials||a.find(Y=>Y.id===p)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:b&&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:u("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",I,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>Y.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{g(null),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!p&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:r?"text-white/40":"text-gray-500",children:E?"Sin asignar":"Unassigned"})]}),a.map(Y=>jsxs("button",{type:"button",onClick:()=>{g(Y.id),w(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===Y.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:Y.color||"#007FFF"},children:Y.initials||Y.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:Y.name})]},Y.id)),a.length===0&&jsx("div",{className:u("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:E?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:O,disabled:!c.trim(),type:"button",className:u("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:E?"Guardar":"Save"})]})]})}function Vl({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:o,disabled:s=false,theme:n="dark",locale:l="es"}){let[c,i]=useState(false),m=useRef(null),d=useRef(null),[p,g]=useState({}),[y,x]=useState(false),h=n==="dark",b={buttonLabel:o||(l==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!c||!m.current)return;let C=90,N=()=>{let T=m.current.getBoundingClientRect(),v=window.innerHeight-T.bottom<C+8;x(v),g({position:"fixed",...v?{bottom:window.innerHeight-T.top+4}:{top:T.bottom+4},left:T.left,width:T.width,zIndex:9999});};return N(),window.addEventListener("scroll",N,true),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,true),window.removeEventListener("resize",N);}},[c]),useEffect(()=>{if(!c)return;let C=N=>{let T=N.target;d.current&&!d.current.contains(T)&&m.current&&!m.current.contains(T)&&i(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]);let w=useCallback(C=>{t({name:C.name,columnId:e,assigneeIds:C.assigneeId?[C.assigneeId]:void 0,startDate:C.startDate,endDate:C.endDate,priority:C.priority});},[t,e]);return jsxs("div",{ref:m,className:u("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"})]}),b.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:d,initial:{opacity:0,y:y?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:y?4:-4,scale:.97},transition:{duration:.12},style:p,className:u("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(Jo,{onSubmit:w,onCancel:()=>i(false),availableUsers:a,isDark:h,locale:l,dropdownDirection:"up"})})}),document.body)]})}var is=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(Fo,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
19
|
+
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function yp(e={}){return new is(e)}var Cn=class extends Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=this.props;return a&&r?s?s(r,this.resetError):jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxs("div",{className:"flex items-start gap-3",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:n?`Error in ${n}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxs("details",{className:"mb-3",children:[jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function jl(e,t){let a=r=>jsx(Cn,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Kl({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:c,shortcut:i="k",className:m=""}){let[d,p]=useState(false),[g,y]=useState(""),[x,h]=useState("home"),[f,b]=useState(""),[w,C]=useState("");useEffect(()=>{let v=E=>{(E.metaKey||E.ctrlKey)&&E.key===i&&(E.preventDefault(),p(I=>!I)),E.key==="Escape"&&(p(false),h("home"),y(""));};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[i]),useEffect(()=>{d||(h("home"),y(""),b(""),C(""));},[d]);let N=useCallback(()=>{p(false);},[]),T=useCallback(v=>{let[E,I]=v.split(":");switch(E){case "create-card":h("create-card");break;case "create-card-in":b(I||"");break;case "navigate":I?(a?.(I),N()):h("navigate");break;case "search":r?.(g),N();break;case "priority":h("priority");break;case "set-priority":w&&I&&(o?.(w,I),N());break;case "assign":h("assign");break;case "assign-user":w&&I&&(s?.(w,I),N());break;case "ai":h("ai");break;case "ai-generate-plan":n?.(),N();break;case "ai-predict-risks":l?.(),N();break;case "ai-usage":c?.(),N();break;case "back":h("home");break;}},[g,w,t,a,r,o,s,n,l,c,N]),k=useCallback(()=>{f&&g.trim()&&(t?.(f,g.trim()),N());},[f,g,t,N]);return d?jsx(Qt,{children:jsx("div",{className:"command-palette-overlay",onClick:N,children:jsx("div",{className:`command-palette ${m}`,onClick:v=>v.stopPropagation(),children:jsxs(Command,{value:g,onValueChange:y,label:"Command Menu",children:[jsxs("div",{className:"command-palette-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx(Command.Input,{placeholder:x==="create-card"&&f?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:v=>{v.key==="Enter"&&x==="create-card"&&f&&k();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),x==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:T,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:T,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:T,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:T,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(v=>jsxs(Command.Item,{value:`navigate:${v.id}`,onSelect:T,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:v.priority==="URGENT"?"#EF4444":v.priority==="HIGH"?"#F59E0B":v.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:v.title}),v.labels&&v.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:v.labels.slice(0,2).map(E=>jsx("span",{className:"command-palette-item-label",children:E},E))})]},v.id))})]}),x==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:T,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(v=>jsxs(Command.Item,{value:`create-card-in:${v.id}`,onSelect:T,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:v.title}),jsxs("div",{className:"command-palette-item-count",children:[v.cardIds.length," cards"]})]},v.id))})]}),x==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:T,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(v=>{let E=e.columns.find(I=>I.id===v.columnId);return jsxs(Command.Item,{value:`navigate:${v.id}`,onSelect:T,className:"command-palette-item",keywords:[v.title,v.description||"",...v.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:v.priority==="URGENT"?"#EF4444":v.priority==="HIGH"?"#F59E0B":v.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:v.title}),jsx("div",{className:"command-palette-item-meta",children:E?.title})]}),v.labels&&v.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:v.labels.slice(0,2).map(I=>jsx("span",{className:"command-palette-item-label",children:I},I))})]},v.id)})})]}),x==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:T,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:T,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:T,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:T,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 wp(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
|
|
20
20
|
position: fixed !important;
|
|
21
21
|
inset: 0 !important;
|
|
22
22
|
z-index: 2147483647 !important;
|
|
@@ -25,12 +25,12 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
25
25
|
justify-content: center !important;
|
|
26
26
|
background: rgba(0, 0, 0, 0.95) !important;
|
|
27
27
|
cursor: pointer !important;
|
|
28
|
-
`;let
|
|
28
|
+
`;let l=document.createElement("img");l.src=e,l.alt=t,l.className="attachment-lightbox-image",l.style.cssText=`
|
|
29
29
|
max-width: 92vw !important;
|
|
30
30
|
max-height: 92vh !important;
|
|
31
31
|
object-fit: contain !important;
|
|
32
32
|
cursor: default !important;
|
|
33
|
-
`,
|
|
33
|
+
`,l.onclick=d=>d.stopPropagation();let c=document.createElement("div");c.className="attachment-lightbox-hint",c.textContent="Click anywhere or press ESC to close",c.style.cssText=`
|
|
34
34
|
position: absolute !important;
|
|
35
35
|
bottom: 24px !important;
|
|
36
36
|
left: 50% !important;
|
|
@@ -38,7 +38,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
38
38
|
font-size: 12px !important;
|
|
39
39
|
color: rgba(255, 255, 255, 0.4) !important;
|
|
40
40
|
pointer-events: none !important;
|
|
41
|
-
`;let
|
|
41
|
+
`;let i=()=>{n.remove(),document.removeEventListener("keydown",m);},m=d=>{if(d.key==="Escape")i();else if(d.key==="ArrowLeft"&&a.length>1){let p=r>0?r-1:a.length-1;i(),o(p);}else if(d.key==="ArrowRight"&&a.length>1){let p=r<a.length-1?r+1:0;i(),o(p);}};if(n.onclick=i,document.addEventListener("keydown",m),a.length>1){let d=document.createElement("div");d.className="attachment-lightbox-dots",d.style.cssText=`
|
|
42
42
|
position: absolute !important;
|
|
43
43
|
bottom: 48px !important;
|
|
44
44
|
left: 50% !important;
|
|
@@ -56,7 +56,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
56
56
|
border: none !important;
|
|
57
57
|
padding: 0 !important;
|
|
58
58
|
cursor: pointer !important;
|
|
59
|
-
`,h.onclick=f=>{f.stopPropagation(),
|
|
59
|
+
`,h.onclick=f=>{f.stopPropagation(),i(),o(x);},d.appendChild(h);});let p=document.createElement("button");p.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",p.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',p.style.cssText=`
|
|
60
60
|
position: absolute !important;
|
|
61
61
|
left: 0 !important;
|
|
62
62
|
top: 0 !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
|
-
`,p.onmouseenter=()=>{p.style.opacity="1";},p.onmouseleave=()=>{p.style.opacity="0.5";},p.onclick=y=>{y.stopPropagation();let x=r>0?r-1:a.length-1;
|
|
72
|
+
`,p.onmouseenter=()=>{p.style.opacity="1";},p.onmouseleave=()=>{p.style.opacity="0.5";},p.onclick=y=>{y.stopPropagation();let x=r>0?r-1:a.length-1;i(),o(x);};let g=document.createElement("button");g.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",g.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>',g.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
|
-
`,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=y=>{y.stopPropagation();let x=r<a.length-1?r+1:0;l(),o(x);},n.appendChild(d),n.appendChild(p),n.appendChild(g);}n.appendChild(i),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function Yh(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 Xh(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 ql(e){return e.startsWith("image/")}function so({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,i]=useState(false),[c,l]=useState(false),[m,d]=useState(null),p=useRef(null),g=useRef(e);g.current=e;let y=useCallback((v,E)=>{E.preventDefault(),E.stopPropagation();let I=g.current.filter(O=>ql(O.type)),D=I.findIndex(O=>O.id===v.id),X=O=>{let H=g.current.filter(Y=>ql(Y.type)),F=H[O];F&&wp(F.url,F.name,H,O,X);};wp(v.url,v.name,I,D,X);},[]),x=useCallback(v=>{let E=[],I=[];return e.length+v.length>s?(I.push(`Maximum ${s} files allowed`),{valid:E,errors:I}):(v.forEach(D=>{if(D.size/1048576>r){I.push(`${D.name} is too large (max ${r}MB)`);return}if(o&&!o.some(O=>D.type.match(O))){I.push(`${D.name} has invalid file type`);return}E.push(D);}),{valid:E,errors:I})},[e.length,s,r,o]),h=useCallback(async v=>{let{valid:E,errors:I}=x(v);if(I.length>0){d(I.join(", ")),setTimeout(()=>d(null),5e3);return}if(E.length!==0){l(true),d(null);try{await t?.(E);}catch(D){d(D instanceof Error?D.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{l(false);}}},[x,t]),f=useCallback(v=>{v.preventDefault(),v.stopPropagation(),i(true);},[]),b=useCallback(v=>{v.preventDefault(),v.stopPropagation(),i(false);},[]),w=useCallback(v=>{v.preventDefault(),v.stopPropagation();},[]),C=useCallback(v=>{v.preventDefault(),v.stopPropagation(),i(false);let E=Array.from(v.dataTransfer.files);h(E);},[h]),N=useCallback(v=>{let E=v.target.files?Array.from(v.target.files):[];h(E),p.current&&(p.current.value="");},[h]),T=useCallback(()=>{p.current?.click();},[]),k=useCallback(v=>{confirm("Are you sure you want to delete this attachment?")&&a?.(v);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:f,onDragLeave:b,onDragOver:w,onDrop:C,onClick:T,children:[jsx("input",{ref:p,type:"file",multiple:true,onChange:N,style:{display:"none"},accept:o?.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:n?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),m&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:m})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(v=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:ql(v.type)&&v.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:E=>y(v,E),title:"Click to view full size",children:[jsx("img",{src:v.thumbnailUrl||v.url,alt:v.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:Xh(v.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:v.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:v.name,children:v.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:Yh(v.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(v.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>k(v.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"})})})]},v.id))})]})}function Yl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:i=[],aiInsights:c=[],attachments:l=[],onAddComment:m,onDeleteComment:d,onUploadAttachments:p,onDeleteAttachment:g,onSuggestAssignee:y,onGenerateSubtasks:x,onEstimateEffort:h,currentUserId:f="user-1"}){let[b,w]=useState("details"),[C,N]=useState(false),[T,k]=useState({}),[v,E]=useState(""),[I,D]=useState(false),[X,O]=useState({});if(!t||!e)return null;let H=useCallback(()=>{N(false),k({}),w("details"),E(""),O({}),a();},[a]),F=useCallback(()=>{r&&Object.keys(T).length>0&&(r(e.id,T),k({}),N(false));},[e.id,T,r]),Y=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),H());},[e.id,o,H]),Z=useCallback(()=>{m&&v.trim()&&(m(e.id,v.trim()),E(""));},[e.id,v,m]),Se=useCallback(async()=>{if(y){D(true);try{let z=await y(e);O(re=>({...re,assignees:z}));}catch(z){console.error("Failed to suggest assignee:",z);}finally{D(false);}}},[e,y]),R=useCallback(async()=>{if(x){D(true);try{let z=await x(e);O(re=>({...re,subtasks:z}));}catch(z){console.error("Failed to generate subtasks:",z);}finally{D(false);}}},[e,x]),_=useCallback(async()=>{if(h){D(true);try{let z=await h(e);O(re=>({...re,effort:z}));}catch(z){console.error("Failed to estimate effort:",z);}finally{D(false);}}},[e,h]),he={...e,...T},Je=s.filter(z=>he.assignedUserIds?.includes(z.id));return jsx(Xt,{children:jsx("div",{className:"card-detail-overlay",onClick:H,children:jsxs("div",{className:"card-detail-modal",onClick:z=>z.stopPropagation(),children:[jsxs("div",{className:"card-detail-header",children:[jsxs("div",{className:"card-detail-header-left",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:he.priority==="URGENT"?"#EF4444":he.priority==="HIGH"?"#F59E0B":he.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),C?jsx("input",{type:"text",value:T.title??he.title,onChange:z=>k({...T,title:z.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:he.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[C?jsxs(Fragment,{children:[jsx("button",{onClick:F,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{N(false),k({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>N(true),className:"card-detail-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxs("button",{onClick:Y,className:"card-detail-btn card-detail-btn-danger",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsx("button",{onClick:H,className:"card-detail-btn-close",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxs("div",{className:"card-detail-tabs",children:[jsxs("button",{onClick:()=>w("details"),className:`card-detail-tab ${b==="details"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxs("button",{onClick:()=>w("comments"),className:`card-detail-tab ${b==="comments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxs("button",{onClick:()=>w("activity"),className:`card-detail-tab ${b==="activity"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",i.length>0&&jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxs("button",{onClick:()=>w("attachments"),className:`card-detail-tab ${b==="attachments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxs("button",{onClick:()=>w("ai"),className:`card-detail-tab ${b==="ai"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxs("div",{className:"card-detail-content",children:[b==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),C?jsx("textarea",{value:T.description??he.description??"",onChange:z=>k({...T,description:z.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:he.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),C?jsx("select",{multiple:true,value:T.assignedUserIds??he.assignedUserIds??[],onChange:z=>{let re=Array.from(z.target.selectedOptions,J=>J.value);k({...T,assignedUserIds:re});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(z=>jsx("option",{value:z.id,children:z.name},z.id))}):jsx("div",{className:"card-detail-users",children:Je.length>0?Je.map(z=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:z.color},children:z.initials}),jsx("span",{children:z.name})]},z.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),C?jsxs("select",{value:T.priority??he.priority??"",onChange:z=>k({...T,priority:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsx("option",{value:"",children:"None"}),jsx("option",{value:"LOW",children:"LOW"}),jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsx("option",{value:"HIGH",children:"HIGH"}),jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxs("div",{className:"card-detail-priority",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:he.priority==="URGENT"?"#EF4444":he.priority==="HIGH"?"#F59E0B":he.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:he.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:he.labels&&he.labels.length>0?he.labels.map(z=>jsx("span",{className:"card-detail-label-tag",children:z},z)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),C?jsx("input",{type:"date",value:T.startDate?new Date(T.startDate).toISOString().split("T")[0]:he.startDate?new Date(he.startDate).toISOString().split("T")[0]:"",onChange:z=>k({...T,startDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:he.startDate?new Date(he.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),C?jsx("input",{type:"date",value:T.endDate?new Date(T.endDate).toISOString().split("T")[0]:he.endDate?new Date(he.endDate).toISOString().split("T")[0]:"",onChange:z=>k({...T,endDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:he.endDate?new Date(he.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),C?jsx("input",{type:"number",min:"0",step:"0.5",value:T.estimatedTime??he.estimatedTime??"",onChange:z=>k({...T,estimatedTime:z.target.value?parseFloat(z.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:he.estimatedTime||"Not estimated"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsx("div",{className:"card-detail-dependencies",children:he.dependencies&&he.dependencies.length>0?he.dependencies.map(z=>{let re=typeof z=="string"?z:z.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",re.slice(-4)]},re)}):jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Created"}),jsx("span",{className:"card-detail-text",children:he.createdAt?new Date(he.createdAt).toLocaleString():"Unknown"})]})]}),b==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:v,onChange:z=>E(z.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:Z,disabled:!v.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(z=>{let re=s.find(J=>J.id===z.authorId);return jsxs("div",{className:"card-detail-comment",children:[jsxs("div",{className:"card-detail-comment-header",children:[jsxs("div",{className:"card-detail-comment-author",children:[re&&jsx("div",{className:"card-detail-user-avatar",style:{background:re.color},children:re.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:re?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(z.createdAt).toLocaleString()})]})]}),d&&jsx("button",{onClick:()=>d(z.id),className:"card-detail-comment-delete",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsx("p",{className:"card-detail-comment-content",children:z.content})]},z.id)}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("p",{children:"No comments yet"}),jsx("span",{children:"Be the first to comment"})]})})]}),b==="activity"&&jsx("div",{className:"card-detail-activity",children:i.length>0?jsx("div",{className:"card-detail-activity-list",children:i.map(z=>{let re=s.find(J=>J.id===z.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[z.type.includes("CREATED")&&"\u2795",z.type.includes("UPDATED")&&"\u270F\uFE0F",z.type.includes("MOVED")&&"\u27A1\uFE0F",z.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",z.type.includes("COMMENT")&&"\u{1F4AC}",z.type.includes("ASSIGNED")&&"\u{1F464}",z.type.includes("PRIORITY")&&"\u{1F3AF}",z.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",z.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:re?.name||"Unknown"})," ",z.type.replace(/_/g," ").toLowerCase(),z.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:z.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(z.timestamp).toLocaleString()})]})]},z.id)})}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})}),b==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(so,{cardId:e.id,attachments:l,onUpload:p?z=>p(e.id,z):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),b==="ai"&&jsxs("div",{className:"card-detail-ai",children:[jsxs("div",{className:"card-detail-ai-actions",children:[jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxs("button",{onClick:Se,disabled:I||!y,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxs("button",{onClick:R,disabled:I||!x,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxs("button",{onClick:_,disabled:I||!h,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),X.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),X.assignees.map((z,re)=>{let J=s.find(Pe=>Pe.id===z.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[J&&jsx("div",{className:"card-detail-user-avatar",style:{background:J.color},children:J.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:J?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:z.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(z.confidence*100).toFixed(0),"%"]})]})]},re)})]}),X.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),X.subtasks.map((z,re)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:z.title}),z.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:z.description}),z.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",z.estimatedTime,"h"]})]},re))]}),X.effort&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Effort Estimate"}),jsxs("div",{className:"card-detail-ai-effort",children:[jsxs("div",{className:"card-detail-ai-effort-hours",children:[X.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(X.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),c.map(z=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${z.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:z.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:z.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:z.description}),z.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",z.suggestedAction]})]},z.id))]}),!X.assignees&&!X.subtasks&&!X.effort&&c.length===0&&jsxs("div",{className:"card-detail-empty-state",children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("p",{children:"AI Suggestions"}),jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function is({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[i,c]=useState({top:0,left:0}),l=useRef(null),m=useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),p=window.innerHeight,g=window.innerWidth,y=4,x=d.left;x+o>g-10&&(x=g-o-10),x<10&&(x=10);let h=p-d.bottom,f=d.top,b;return h>=s+y?b=d.bottom+y:f>=s+y?b=d.top-s-y:h>=f?b=d.bottom+y:b=Math.max(10,d.top-s-y),{top:b,left:x}},[e,o,s]);return useEffect(()=>{t&&c(m());},[t,m]),useEffect(()=>{if(!t)return;let d=g=>{let y=g.target;l.current&&!l.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},p=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(p),document.removeEventListener("mousedown",d);}},[t,a,e]),useEffect(()=>{if(!t)return;let d=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsx(Xt,{children:jsx("div",{ref:l,className:`smart-popover ${n}`,style:{position:"fixed",top:`${i.top}px`,left:`${i.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var 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:"#2E94FF",accentHover:"#5AADFF",accentLight:"rgba(46, 148, 255, 0.12)",taskBarPrimary:"#2E94FF",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:"#2E94FF",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#2E94FF",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(46, 148, 255, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2E94FF",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2E94FF",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#2E94FF",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:"#2E94FF",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2E94FF",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(37, 99, 235, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};var oy=["LOW","MEDIUM","HIGH","URGENT"],ny=["todo","in-progress","review","done"];function Ql({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:i=[],onAddComment:c,onDeleteComment:l,currentUser:m,onAIGenerateDescription:d,onAICreateSubtasks:p,onAIFindSimilar:g,availableColumns:y=[],availableLabels:x=[],availableTags:h=[],onCreateTag:f,onUploadCoverImage:b,unsplashAccessKey:w,theme:C,onSubtasksChange:N,attachments:T=[],onUploadAttachments:k,onDeleteAttachment:v}){let E=bn(),I=C||E?.themeName||"dark",[D,X]=useState(e),[O,H]=useState(false),[F,Y]=useState(()=>[...e?.subtasks||[]].sort((j,K)=>(j.position??0)-(K.position??0))),[Z,Se]=useState(false),[R,_]=useState(""),[he,Je]=useState(""),[z,re]=useState("all"),[J,Pe]=useState(false),[ve,We]=useState(false),[Re,st]=useState(false),[ee,it]=useState(false),[le,ot]=useState(false),[yt,Pt]=useState(false),ke=useRef(null),xt=useRef(null),ct=useRef(null),rt=useRef(null),$=useRef(null),de=useRef(null),S=useRef(null),q=useRef(null),ce=useRef(null),Ce=useRef(null),W=useRef(null),te=useRef(null);useEffect(()=>{if(e&&!D){X({...e});let L=[...e.subtasks||[]].sort((j,K)=>(j.position??0)-(K.position??0));Y(L);}else if(e&&D&&e.id!==D.id){X({...e});let L=[...e.subtasks||[]].sort((j,K)=>(j.position??0)-(K.position??0));Y(L);}},[e,D]),useEffect(()=>{let L=j=>{let K=j.target;rt.current&&!rt.current.contains(K)&&Pe(false),$.current&&!$.current.contains(K)&&We(false),de.current&&!de.current.contains(K)&&st(false),S.current&&!S.current.contains(K)&&it(false);};if(J||ve||Re||ee)return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[J,ve,Re,ee]),useEffect(()=>{if(!t)return;let L=j=>{let K=j.target,me=K.tagName==="INPUT"||K.tagName==="TEXTAREA"||K.isContentEditable;if(j.key==="Escape"){j.preventDefault(),J||ve||Re||ee||le||yt?(Pe(false),We(false),st(false),it(false),ot(false),Pt(false)):me||a();return}if(me&&j.key!=="Escape")return;let Me=j.metaKey||j.ctrlKey;switch(j.key.toLowerCase()){case "s":j.preventDefault(),Pe(true);break;case "a":j.preventDefault(),st(true);break;case "p":j.preventDefault(),We(true);break;case "l":j.preventDefault(),it(true);break;case "d":Me||(j.preventDefault(),ot(true),setTimeout(()=>q.current?.focus(),0));break;case "e":Me||(j.preventDefault(),Pt(true));break;case "i":j.preventDefault(),H(true),setTimeout(()=>xt.current?.focus(),0);break;case "t":j.preventDefault(),Se(true);break;case "c":j.preventDefault(),ct.current?.focus();break}};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[t,a,J,ve,Re,ee,le,yt]);let Ge=useCallback(L=>{let j=L.currentTarget.textContent?.trim()||"";if(D&&j!==D.title){let K={...D,title:j};X(K),r?.(D.id,{title:j});}},[D,r]),Te=useCallback(L=>{L.key==="Enter"&&(L.preventDefault(),L.currentTarget.blur()),L.key==="Escape"&&(L.preventDefault(),L.currentTarget.textContent=D?.title||"",L.currentTarget.blur());},[D]),Ue=useCallback(()=>{D&&e&&D.description!==e.description&&r?.(D.id,{description:D.description}),H(false);},[D,e,r]),Ne=useCallback(L=>{if(D){let j={...D,columnId:L};X(j),r?.(D.id,{columnId:L}),Pe(false);}},[D,r]),Ve=useCallback(L=>{if(D){let j={...D,priority:L};X(j),r?.(D.id,{priority:L}),We(false);}},[D,r]),Tt=useCallback(L=>{if(D){let j=D.assignedUserIds||[],K=j.includes(L)?j.filter(Me=>Me!==L):[...j,L],me={...D,assignedUserIds:K};X(me),r?.(D.id,{assignedUserIds:K});}},[D,r]),gt=useCallback(L=>{if(D){let j=D.labels||[],K=j.includes(L)?j.filter(Me=>Me!==L):[...j,L],me={...D,labels:K};X(me),r?.(D.id,{labels:K});}},[D,r]),nt=useCallback(L=>{if(D){let j={...D,tags:L};X(j),r?.(D.id,{tags:L});}},[D,r]),et=useCallback(L=>{if(D){let j=L.target.value,K={...D,endDate:j};X(K),r?.(D.id,{endDate:j}),ot(false);}},[D,r]),qt=useCallback(L=>{if(D){let j={...D,estimatedTime:parseFloat(L)||0};X(j),r?.(D.id,{estimatedTime:parseFloat(L)||0});}},[D,r]),At=useCallback(()=>{if(R.trim()&&D){let L={id:`subtask-${Date.now()}`,title:R.trim(),completed:false,position:F.length,createdAt:new Date},j=[...F,L];Y(j),_(""),Se(false),N?.(D.id,j);}},[R,F,D,N]),vt=useCallback(L=>{let j=F.map(K=>K.id===L?{...K,completed:!K.completed,updatedAt:new Date}:K);Y(j),D&&N?.(D.id,j);},[F,D,N]),Dt=useCallback(L=>{let j=F.filter(K=>K.id!==L);Y(j),D&&N?.(D.id,j);},[F,D,N]),ft=useCallback(()=>{he.trim()&&D&&c&&(c(D.id,he.trim()),Je(""));},[he,D,c]),Wt=useCallback(L=>{(L.metaKey||L.ctrlKey)&&L.key==="Enter"&&(L.preventDefault(),ft());},[ft]),Oe=L=>jsx(ty,{remarkPlugins:[ay],rehypePlugins:[ry],components:{a:({node:j,...K})=>jsx("a",{...K,target:"_blank",rel:"noopener noreferrer"})},children:L}),Le=i.filter(L=>z==="comments"?L.type.includes("COMMENT"):z==="history"?!L.type.includes("COMMENT"):true);if(!t||!e)return null;let ut=D||e,ne=s.filter(L=>ut.assignedUserIds?.includes(L.id)),fe=F.filter(L=>L.completed).length;return jsx(Xt,{children:jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxs("div",{className:"modal-v2-container",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":I,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:ke,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Ge,onKeyDown:Te,children:ut.title}),jsxs("p",{className:"modal-v2-ai-prompt",children:[jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxs("section",{className:"modal-v2-metadata",children:[jsxs("div",{className:"modal-v2-field-wrapper",ref:rt,children:[jsxs("button",{ref:ce,className:"modal-v2-field",onClick:()=>Pe(!J),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]}),jsx("span",{children:"Status"}),jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsx("div",{className:"modal-v2-field-value",children:ut.columnId||"No status"})]}),jsx(is,{triggerRef:ce,isOpen:J,onClose:()=>Pe(false),width:250,estimatedHeight:200,children:(y.length>0?y:ny.map(L=>({id:L,title:L}))).map(L=>jsx("button",{className:`modal-v2-popover-item ${ut.columnId===L.id?"active":""}`,onClick:()=>Ne(L.id),children:L.title},L.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:de,children:[jsxs("button",{ref:Ce,className:"modal-v2-field",onClick:()=>st(!Re),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsx("span",{children:"Assignees"}),jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsx("div",{className:"modal-v2-field-value",children:ne.length>0?jsx("div",{className:"modal-v2-avatars",children:ne.map(L=>jsx("div",{className:"modal-v2-avatar",style:{background:L.color},title:L.name,children:L.initials},L.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(is,{triggerRef:Ce,isOpen:Re,onClose:()=>st(false),width:280,estimatedHeight:300,children:s.map(L=>jsxs("button",{className:`modal-v2-popover-item ${ut.assignedUserIds?.includes(L.id)?"active":""}`,onClick:()=>Tt(L.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:L.color},children:L.initials}),L.name,ut.assignedUserIds?.includes(L.id)&&jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},L.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:$,children:[jsxs("button",{ref:W,className:"modal-v2-field",onClick:()=>We(!ve),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Priority"}),jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsx("div",{className:"modal-v2-field-value",children:ut.priority||"None"})]}),jsxs(is,{triggerRef:W,isOpen:ve,onClose:()=>We(false),width:180,estimatedHeight:220,children:[oy.map(L=>jsx("button",{className:`modal-v2-popover-item priority-${L.toLowerCase()} ${ut.priority===L?"active":""}`,onClick:()=>Ve(L),children:L},L)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ve(""),children:"None"})]})]}),h.length>0||f?jsx("div",{className:"modal-v2-field-wrapper",children:jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Etiquetas"})]}),jsx("div",{className:"modal-v2-field-value",children:jsx(Do,{selectedTags:ut.tags||[],availableTags:h,onChange:nt,onCreateTag:f,theme:pt[I]||pt.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:S,children:[jsxs("button",{ref:te,className:"modal-v2-field",onClick:()=>it(!ee),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Labels"}),jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsx("div",{className:"modal-v2-field-value",children:ut.labels&&ut.labels.length>0?jsx("span",{children:ut.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(is,{triggerRef:te,isOpen:ee,onClose:()=>it(false),width:220,estimatedHeight:200,children:(x.length>0?x:["Bug","Feature","Enhancement","Documentation"]).map(L=>jsxs("button",{className:`modal-v2-popover-item ${ut.labels?.includes(L)?"active":""}`,onClick:()=>gt(L),children:[L,ut.labels?.includes(L)&&jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},L))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{ot(!le),setTimeout(()=>q.current?.showPicker?.(),0);},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsx("span",{children:"Due Date"}),jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsx("div",{className:"modal-v2-field-value",children:ut.endDate?new Date(ut.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:q,type:"date",value:typeof ut.endDate=="string"?ut.endDate.split("T")[0]:ut.endDate?(()=>{let L=new Date(ut.endDate),j=L.getUTCFullYear(),K=String(L.getUTCMonth()+1).padStart(2,"0"),me=String(L.getUTCDate()).padStart(2,"0");return `${j}-${K}-${me}`})():"",onChange:et,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>Pt(!yt),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsx("span",{children:"Estimated Time"}),jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsx("div",{className:"modal-v2-field-value",children:ut.estimatedTime?`${ut.estimatedTime}h`:"Not set"})]}),yt&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ut.estimatedTime||"",onChange:L=>qt(L.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Pt(false)})})]})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsx("h2",{children:"Description"})]}),O?jsx("textarea",{className:"modal-v2-textarea",value:ut.description||"",onChange:L=>{if(D){let j={...D,description:L.target.value};X(j);}},onBlur:Ue,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>H(true),children:ut.description?jsx("div",{className:"modal-v2-markdown",children:Oe(ut.description)}):jsxs("p",{className:"modal-v2-placeholder",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M9 11l3 3L22 4"}),jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsx("h2",{children:"Subtasks"}),F.length>0&&jsxs("span",{className:"modal-v2-count",children:[fe,"/",F.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>Se(true),children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxs("div",{className:"modal-v2-subtasks",children:[F.map(L=>jsxs("div",{className:`modal-v2-subtask ${L.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>vt(L.id),children:L.completed?jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsx("span",{className:"modal-v2-subtask-title",children:L.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Dt(L.id),children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},L.id)),Z&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:R,onChange:L=>_(L.target.value),onKeyDown:L=>{L.key==="Enter"&&At(),L.key==="Escape"&&(Se(false),_(""));},onBlur:At,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(k||T.length>0)&&jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsx("h2",{children:"Attachments"}),T.length>0&&jsx("span",{className:"modal-v2-count",children:T.length})]}),jsx(so,{cardId:ut.id,attachments:T,onUpload:k?L=>k(ut.id,L):void 0,onDelete:v,maxSizeMB:10,maxFiles:20})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("h2",{children:"Activity"}),jsxs("div",{className:"modal-v2-filters",children:[jsx("button",{className:`modal-v2-filter ${z==="all"?"active":""}`,onClick:()=>re("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${z==="comments"?"active":""}`,onClick:()=>re("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${z==="history"?"active":""}`,onClick:()=>re("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[m&&jsx("div",{className:"modal-v2-avatar",style:{background:m.color},children:m.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:ct,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:he,onChange:L=>Je(L.target.value),onKeyDown:Wt,rows:1}),jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxs("div",{className:"modal-v2-toolbar-left",children:[jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})})}),jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"4"}),jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsx("button",{className:"modal-v2-send-button",onClick:ft,disabled:!he.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[Le.map(L=>{let j=s.find(me=>me.id===L.userId);if(L.type.includes("COMMENT")){let me=n.find(Me=>Me.id===L.metadata?.commentId);return me?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[j&&jsx("div",{className:"modal-v2-avatar",style:{background:j.color},children:j.initials}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-activity-header",children:[jsx("span",{className:"modal-v2-activity-user",children:j?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(L.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:me.content})]})]},L.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[L.type.includes("CREATED")&&"\u2795",L.type.includes("UPDATED")&&"\u270F\uFE0F",L.type.includes("MOVED")&&"\u27A1\uFE0F",L.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",L.type.includes("ASSIGNED")&&"\u{1F464}",L.type.includes("PRIORITY")&&"\u{1F3AF}",L.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-history-text",children:[jsx("span",{className:"modal-v2-activity-user",children:j?.name||"Unknown"})," ",L.type.replace(/_/g," ").toLowerCase(),L.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:L.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(L.timestamp).toLocaleString()})]})]},L.id)}),Le.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function gy({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 ed({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((i,c)=>i+c.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(gy,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#2E94FF",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#2E94FF",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,i)=>n+i.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,i)=>n+i.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:e.reduce((n,i)=>n+(i.planned||0),0)})]})]})]})}function Cy({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 td({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,i=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,l=n<=i;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(o?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Cy,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",fill:l?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:l?"#10B981":"#EF4444"},children:n})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Ay={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},Fp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Ly({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,i=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:i,y:c,fill:"white",textAnchor:i>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Pp({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsx("strong",{children:a.value})]}),jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxs("strong",{children:[o,"%"]})]})]})}function ad({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((c,l)=>c+l.value,0),n=e.map(c=>({...c,totalValue:s,color:c.color||Ay[c.name]||Fp[e.indexOf(c)%Fp.length]})),i=n.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:n,cx:"50%",cy:"50%",labelLine:false,label:o?Ly:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,l)=>jsx(Cell,{fill:i[l]},`cell-${l}`))}),jsx(Tooltip,{content:jsx(Pp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,l)=>{let m=l.payload,d=s>0?(m.value/s*100).toFixed(0):"0";return `${c} (${m.value} - ${d}%)`}})]}):jsxs(BarChart$1,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Pp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((c,l)=>jsx(Cell,{fill:i[l]},`cell-${l}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,l)=>l.value>c.value?l:c).name})]})]})]})}var ui=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,i]=useState(false),[c,l]=useState(false),[m,d]=useState(false),[p,g]=useState(false);if(e.length===0)return null;let y=e.map(C=>C.id),x=C=>{r.onBulkUpdate?.(y,{priority:C}),i(false);},h=C=>{r.onBulkMove?.(y,C),l(false),a();},f=C=>{r.onBulkUpdate?.(y,{assignedUserIds:C}),d(false);},b=C=>{let N=new Set;e.forEach(k=>{k.labels?.forEach(v=>N.add(v));});let T=Array.from(new Set([...N,...C]));r.onBulkUpdate?.(y,{labels:T}),g(false);},w=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),a());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!n),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(C=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(C),children:[jsx("span",{className:u("asakaa-priority-dot",C==="LOW"&&"bg-asakaa-priority-low",C==="MEDIUM"&&"bg-asakaa-priority-medium",C==="HIGH"&&"bg-asakaa-priority-high",C==="URGENT"&&"bg-asakaa-priority-urgent")}),C]},C))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!c),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(C=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(C.id),children:C.title},C.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!m),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(C=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([C.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:C.color},children:C.initials}),C.name]},C.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!p),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(C=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([C]),children:C},C))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:w,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"})})]})]})})});ui.displayName="BulkOperationsToolbar";function $y(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,i,c,l;switch(t){case "assignee":let m=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);m.length>0?m.forEach(g=>{let y=a?.find(x=>x.id===g);n=`assignee-${g}`,i=y?.name||`User ${g}`,c=y?.color,l=y?.avatar,r.has(n)||r.set(n,{id:n,title:i,groupValue:g,cardIds:[],color:c,icon:l}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",i="Unassigned",c="#6b7280",l="\u{1F464}",r.has(n)||r.set(n,{id:n,title:i,groupValue:null,cardIds:[],color:c,icon:l}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let p={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];i=p.title,c=p.color,r.has(n)||r.set(n,{id:n,title:i,groupValue:s,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,i=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:i,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",i="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:i,groupValue:null,cardIds:[],color:c}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function rd({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),i=useMemo(()=>$y(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=useCallback(l=>{n(m=>{let d=new Set(m);return d.has(l)?d.delete(l):d.add(l),d});},[]);return t.groupBy==="none"||i.length===0?jsx(Mo,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:u("asakaa-swimlane-view",o),children:[i.map(l=>{let m=s.has(l.id),d=e.cards.filter(g=>l.cardIds.includes(g.id)),p={...e,cards:d};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&c(l.id),style:{borderLeft:l.color?`4px solid ${l.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[l.icon&&jsx("span",{className:"text-2xl leading-none",children:l.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:l.color},children:l.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",l.cardIds.length," ",l.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(Mo,{board:p,callbacks:r,availableUsers:a})})]},l.id)}),i.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 od=[{value:"none",label:"No Grouping",icon:"\u{1F4CB}",description:"Standard Kanban board view"},{value:"assignee",label:"By Assignee",icon:"\u{1F465}",description:"Group cards by assigned user"},{value:"priority",label:"By Priority",icon:"\u{1F3AF}",description:"Group cards by priority level"},{value:"label",label:"By Label",icon:"\u{1F3F7}\uFE0F",description:"Group cards by label/tag"}];function nd({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),i=od.find(l=>l.value===e)||od[0];useEffect(()=>{function l(m){s.current&&!s.current.contains(m.target)&&n.current&&!n.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let c=l=>{t(l),o(false);};return jsxs("div",{className:u("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:i.icon}),jsx("span",{children:i.label}),jsx("svg",{className:u("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:od.map(l=>jsxs("button",{onClick:()=>c(l.value),className:u("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:l.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:l.label}),e===l.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:l.description})]})]},l.value))})]})]})}var ls=[{keys:"ArrowUp",action:"navigate_up",description:"Navigate to card above"},{keys:"ArrowDown",action:"navigate_down",description:"Navigate to card below"},{keys:"ArrowLeft",action:"navigate_left",description:"Navigate to previous column"},{keys:"ArrowRight",action:"navigate_right",description:"Navigate to next column"},{keys:"Enter",action:"open_card",description:"Open selected card"},{keys:"Escape",action:"close_modal",description:"Close modal or dialog"},{keys:"Delete",action:"delete_card",description:"Delete selected card",modifiers:{shift:true}},{keys:"n",action:"new_card",description:"Create new card",modifiers:{ctrl:true}},{keys:"k",action:"search",description:"Open search/command palette",modifiers:{ctrl:true}},{keys:"s",action:"save",description:"Save changes",modifiers:{ctrl:true}},{keys:"z",action:"undo",description:"Undo last action",modifiers:{ctrl:true}},{keys:"y",action:"redo",description:"Redo last undone action",modifiers:{ctrl:true}},{keys:"a",action:"select_all",description:"Select all cards",modifiers:{ctrl:true}},{keys:"Escape",action:"deselect_all",description:"Deselect all cards"},{keys:"?",action:"show_shortcuts",description:"Show keyboard shortcuts help",modifiers:{shift:true}}];function Uy(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,i=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&i&&c}function Rp(e={}){let{shortcuts:t=ls,enabled:a=true,preventDefault:r=true}=e,o=useRef(t),s=useRef(a);useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=useCallback(c=>{o.current=[...o.current,c];},[]),i=useCallback(c=>{o.current=o.current.filter(l=>l.action!==c);},[]);return useEffect(()=>{function c(l){if(!s.current)return;let m=l.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let d of o.current)if(Uy(l,d)){r&&l.preventDefault();let p=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:i,isEnabled:a}}function Gy(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Vy(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 jy(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Vy(e),r=t?Gy(t):"";return a?`${a} + ${r}`:r}function _y(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 sd({shortcuts:e=ls,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function i(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),!o||!t)return null;let n=_y(e);return jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([i,c])=>c.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),i]}),jsx("div",{className:"space-y-3",children:c.map(l=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:l.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:jy(l)})]},l.action))})]},i))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var id=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
85
|
+
`,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=y=>{y.stopPropagation();let x=r<a.length-1?r+1:0;i(),o(x);},n.appendChild(d),n.appendChild(p),n.appendChild(g);}n.appendChild(l),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function Yh(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 Xh(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 Yl(e){return e.startsWith("image/")}function io({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=useState(false),[c,i]=useState(false),[m,d]=useState(null),p=useRef(null),g=useRef(e);g.current=e;let y=useCallback((v,E)=>{E.preventDefault(),E.stopPropagation();let I=g.current.filter(O=>Yl(O.type)),S=I.findIndex(O=>O.id===v.id),X=O=>{let $=g.current.filter(Y=>Yl(Y.type)),F=$[O];F&&wp(F.url,F.name,$,O,X);};wp(v.url,v.name,I,S,X);},[]),x=useCallback(v=>{let E=[],I=[];return e.length+v.length>s?(I.push(`Maximum ${s} files allowed`),{valid:E,errors:I}):(v.forEach(S=>{if(S.size/1048576>r){I.push(`${S.name} is too large (max ${r}MB)`);return}if(o&&!o.some(O=>S.type.match(O))){I.push(`${S.name} has invalid file type`);return}E.push(S);}),{valid:E,errors:I})},[e.length,s,r,o]),h=useCallback(async v=>{let{valid:E,errors:I}=x(v);if(I.length>0){d(I.join(", ")),setTimeout(()=>d(null),5e3);return}if(E.length!==0){i(true),d(null);try{await t?.(E);}catch(S){d(S instanceof Error?S.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[x,t]),f=useCallback(v=>{v.preventDefault(),v.stopPropagation(),l(true);},[]),b=useCallback(v=>{v.preventDefault(),v.stopPropagation(),l(false);},[]),w=useCallback(v=>{v.preventDefault(),v.stopPropagation();},[]),C=useCallback(v=>{v.preventDefault(),v.stopPropagation(),l(false);let E=Array.from(v.dataTransfer.files);h(E);},[h]),N=useCallback(v=>{let E=v.target.files?Array.from(v.target.files):[];h(E),p.current&&(p.current.value="");},[h]),T=useCallback(()=>{p.current?.click();},[]),k=useCallback(v=>{confirm("Are you sure you want to delete this attachment?")&&a?.(v);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:f,onDragLeave:b,onDragOver:w,onDrop:C,onClick:T,children:[jsx("input",{ref:p,type:"file",multiple:true,onChange:N,style:{display:"none"},accept:o?.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:n?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),m&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:m})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(v=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Yl(v.type)&&v.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:E=>y(v,E),title:"Click to view full size",children:[jsx("img",{src:v.thumbnailUrl||v.url,alt:v.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:Xh(v.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:v.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:v.name,children:v.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:Yh(v.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(v.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>k(v.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"})})})]},v.id))})]})}function Xl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:c=[],attachments:i=[],onAddComment:m,onDeleteComment:d,onUploadAttachments:p,onDeleteAttachment:g,onSuggestAssignee:y,onGenerateSubtasks:x,onEstimateEffort:h,currentUserId:f="user-1"}){let[b,w]=useState("details"),[C,N]=useState(false),[T,k]=useState({}),[v,E]=useState(""),[I,S]=useState(false),[X,O]=useState({});if(!t||!e)return null;let $=useCallback(()=>{N(false),k({}),w("details"),E(""),O({}),a();},[a]),F=useCallback(()=>{r&&Object.keys(T).length>0&&(r(e.id,T),k({}),N(false));},[e.id,T,r]),Y=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),$());},[e.id,o,$]),Z=useCallback(()=>{m&&v.trim()&&(m(e.id,v.trim()),E(""));},[e.id,v,m]),Ee=useCallback(async()=>{if(y){S(true);try{let z=await y(e);O(re=>({...re,assignees:z}));}catch(z){console.error("Failed to suggest assignee:",z);}finally{S(false);}}},[e,y]),R=useCallback(async()=>{if(x){S(true);try{let z=await x(e);O(re=>({...re,subtasks:z}));}catch(z){console.error("Failed to generate subtasks:",z);}finally{S(false);}}},[e,x]),_=useCallback(async()=>{if(h){S(true);try{let z=await h(e);O(re=>({...re,effort:z}));}catch(z){console.error("Failed to estimate effort:",z);}finally{S(false);}}},[e,h]),ye={...e,...T},Je=s.filter(z=>ye.assignedUserIds?.includes(z.id));return jsx(Qt,{children:jsx("div",{className:"card-detail-overlay",onClick:$,children:jsxs("div",{className:"card-detail-modal",onClick:z=>z.stopPropagation(),children:[jsxs("div",{className:"card-detail-header",children:[jsxs("div",{className:"card-detail-header-left",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:ye.priority==="URGENT"?"#EF4444":ye.priority==="HIGH"?"#F59E0B":ye.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),C?jsx("input",{type:"text",value:T.title??ye.title,onChange:z=>k({...T,title:z.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:ye.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[C?jsxs(Fragment,{children:[jsx("button",{onClick:F,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{N(false),k({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>N(true),className:"card-detail-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxs("button",{onClick:Y,className:"card-detail-btn card-detail-btn-danger",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsx("button",{onClick:$,className:"card-detail-btn-close",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxs("div",{className:"card-detail-tabs",children:[jsxs("button",{onClick:()=>w("details"),className:`card-detail-tab ${b==="details"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxs("button",{onClick:()=>w("comments"),className:`card-detail-tab ${b==="comments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxs("button",{onClick:()=>w("activity"),className:`card-detail-tab ${b==="activity"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxs("button",{onClick:()=>w("attachments"),className:`card-detail-tab ${b==="attachments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxs("button",{onClick:()=>w("ai"),className:`card-detail-tab ${b==="ai"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxs("div",{className:"card-detail-content",children:[b==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),C?jsx("textarea",{value:T.description??ye.description??"",onChange:z=>k({...T,description:z.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:ye.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),C?jsx("select",{multiple:true,value:T.assignedUserIds??ye.assignedUserIds??[],onChange:z=>{let re=Array.from(z.target.selectedOptions,J=>J.value);k({...T,assignedUserIds:re});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(z=>jsx("option",{value:z.id,children:z.name},z.id))}):jsx("div",{className:"card-detail-users",children:Je.length>0?Je.map(z=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:z.color},children:z.initials}),jsx("span",{children:z.name})]},z.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),C?jsxs("select",{value:T.priority??ye.priority??"",onChange:z=>k({...T,priority:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsx("option",{value:"",children:"None"}),jsx("option",{value:"LOW",children:"LOW"}),jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsx("option",{value:"HIGH",children:"HIGH"}),jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxs("div",{className:"card-detail-priority",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:ye.priority==="URGENT"?"#EF4444":ye.priority==="HIGH"?"#F59E0B":ye.priority==="MEDIUM"?"#2E94FF":"#6B7280"}}),jsx("span",{children:ye.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:ye.labels&&ye.labels.length>0?ye.labels.map(z=>jsx("span",{className:"card-detail-label-tag",children:z},z)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),C?jsx("input",{type:"date",value:T.startDate?new Date(T.startDate).toISOString().split("T")[0]:ye.startDate?new Date(ye.startDate).toISOString().split("T")[0]:"",onChange:z=>k({...T,startDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:ye.startDate?new Date(ye.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),C?jsx("input",{type:"date",value:T.endDate?new Date(T.endDate).toISOString().split("T")[0]:ye.endDate?new Date(ye.endDate).toISOString().split("T")[0]:"",onChange:z=>k({...T,endDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:ye.endDate?new Date(ye.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),C?jsx("input",{type:"number",min:"0",step:"0.5",value:T.estimatedTime??ye.estimatedTime??"",onChange:z=>k({...T,estimatedTime:z.target.value?parseFloat(z.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:ye.estimatedTime||"Not estimated"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsx("div",{className:"card-detail-dependencies",children:ye.dependencies&&ye.dependencies.length>0?ye.dependencies.map(z=>{let re=typeof z=="string"?z:z.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",re.slice(-4)]},re)}):jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Created"}),jsx("span",{className:"card-detail-text",children:ye.createdAt?new Date(ye.createdAt).toLocaleString():"Unknown"})]})]}),b==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:v,onChange:z=>E(z.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:Z,disabled:!v.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(z=>{let re=s.find(J=>J.id===z.authorId);return jsxs("div",{className:"card-detail-comment",children:[jsxs("div",{className:"card-detail-comment-header",children:[jsxs("div",{className:"card-detail-comment-author",children:[re&&jsx("div",{className:"card-detail-user-avatar",style:{background:re.color},children:re.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:re?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(z.createdAt).toLocaleString()})]})]}),d&&jsx("button",{onClick:()=>d(z.id),className:"card-detail-comment-delete",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsx("p",{className:"card-detail-comment-content",children:z.content})]},z.id)}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("p",{children:"No comments yet"}),jsx("span",{children:"Be the first to comment"})]})})]}),b==="activity"&&jsx("div",{className:"card-detail-activity",children:l.length>0?jsx("div",{className:"card-detail-activity-list",children:l.map(z=>{let re=s.find(J=>J.id===z.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[z.type.includes("CREATED")&&"\u2795",z.type.includes("UPDATED")&&"\u270F\uFE0F",z.type.includes("MOVED")&&"\u27A1\uFE0F",z.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",z.type.includes("COMMENT")&&"\u{1F4AC}",z.type.includes("ASSIGNED")&&"\u{1F464}",z.type.includes("PRIORITY")&&"\u{1F3AF}",z.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",z.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:re?.name||"Unknown"})," ",z.type.replace(/_/g," ").toLowerCase(),z.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:z.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(z.timestamp).toLocaleString()})]})]},z.id)})}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})}),b==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(io,{cardId:e.id,attachments:i,onUpload:p?z=>p(e.id,z):void 0,onDelete:g,currentUserId:f,maxSizeMB:10,maxFiles:20})}),b==="ai"&&jsxs("div",{className:"card-detail-ai",children:[jsxs("div",{className:"card-detail-ai-actions",children:[jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxs("button",{onClick:Ee,disabled:I||!y,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxs("button",{onClick:R,disabled:I||!x,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxs("button",{onClick:_,disabled:I||!h,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),X.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),X.assignees.map((z,re)=>{let J=s.find(Ae=>Ae.id===z.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[J&&jsx("div",{className:"card-detail-user-avatar",style:{background:J.color},children:J.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:J?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:z.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(z.confidence*100).toFixed(0),"%"]})]})]},re)})]}),X.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),X.subtasks.map((z,re)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:z.title}),z.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:z.description}),z.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",z.estimatedTime,"h"]})]},re))]}),X.effort&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Effort Estimate"}),jsxs("div",{className:"card-detail-ai-effort",children:[jsxs("div",{className:"card-detail-ai-effort-hours",children:[X.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(X.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),c.map(z=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${z.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:z.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:z.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:z.description}),z.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",z.suggestedAction]})]},z.id))]}),!X.assignees&&!X.subtasks&&!X.effort&&c.length===0&&jsxs("div",{className:"card-detail-empty-state",children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("p",{children:"AI Suggestions"}),jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function ds({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,c]=useState({top:0,left:0}),i=useRef(null),m=useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),p=window.innerHeight,g=window.innerWidth,y=4,x=d.left;x+o>g-10&&(x=g-o-10),x<10&&(x=10);let h=p-d.bottom,f=d.top,b;return h>=s+y?b=d.bottom+y:f>=s+y?b=d.top-s-y:h>=f?b=d.bottom+y:b=Math.max(10,d.top-s-y),{top:b,left:x}},[e,o,s]);return useEffect(()=>{t&&c(m());},[t,m]),useEffect(()=>{if(!t)return;let d=g=>{let y=g.target;i.current&&!i.current.contains(y)&&e.current&&!e.current.contains(y)&&a();},p=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(p),document.removeEventListener("mousedown",d);}},[t,a,e]),useEffect(()=>{if(!t)return;let d=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsx(Qt,{children:jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var ht={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:"#2E94FF",accentHover:"#5AADFF",accentLight:"rgba(46, 148, 255, 0.12)",taskBarPrimary:"#2E94FF",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:"#2E94FF",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#2E94FF",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(46, 148, 255, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2E94FF",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2E94FF",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#2E94FF",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:"#2E94FF",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2E94FF",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(37, 99, 235, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};var oy=["LOW","MEDIUM","HIGH","URGENT"],ny=["todo","in-progress","review","done"];function Zl({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:c,onDeleteComment:i,currentUser:m,onAIGenerateDescription:d,onAICreateSubtasks:p,onAIFindSimilar:g,availableColumns:y=[],availableLabels:x=[],availableTags:h=[],onCreateTag:f,onUploadCoverImage:b,unsplashAccessKey:w,theme:C,onSubtasksChange:N,attachments:T=[],onUploadAttachments:k,onDeleteAttachment:v}){let E=hn(),I=C||E?.themeName||"dark",[S,X]=useState(e),[O,$]=useState(false),[F,Y]=useState(()=>[...e?.subtasks||[]].sort((j,q)=>(j.position??0)-(q.position??0))),[Z,Ee]=useState(false),[R,_]=useState(""),[ye,Je]=useState(""),[z,re]=useState("all"),[J,Ae]=useState(false),[ve,ze]=useState(false),[Be,st]=useState(false),[ee,it]=useState(false),[de,lt]=useState(false),[rt,At]=useState(false),we=useRef(null),vt=useRef(null),gt=useRef(null),tt=useRef(null),H=useRef(null),le=useRef(null),D=useRef(null),K=useRef(null),pe=useRef(null),Te=useRef(null),G=useRef(null),te=useRef(null);useEffect(()=>{if(e&&!S){X({...e});let L=[...e.subtasks||[]].sort((j,q)=>(j.position??0)-(q.position??0));Y(L);}else if(e&&S&&e.id!==S.id){X({...e});let L=[...e.subtasks||[]].sort((j,q)=>(j.position??0)-(q.position??0));Y(L);}},[e,S]),useEffect(()=>{let L=j=>{let q=j.target;tt.current&&!tt.current.contains(q)&&Ae(false),H.current&&!H.current.contains(q)&&ze(false),le.current&&!le.current.contains(q)&&st(false),D.current&&!D.current.contains(q)&&it(false);};if(J||ve||Be||ee)return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[J,ve,Be,ee]),useEffect(()=>{if(!t)return;let L=j=>{let q=j.target,me=q.tagName==="INPUT"||q.tagName==="TEXTAREA"||q.isContentEditable;if(j.key==="Escape"){j.preventDefault(),J||ve||Be||ee||de||rt?(Ae(false),ze(false),st(false),it(false),lt(false),At(false)):me||a();return}if(me&&j.key!=="Escape")return;let Ne=j.metaKey||j.ctrlKey;switch(j.key.toLowerCase()){case "s":j.preventDefault(),Ae(true);break;case "a":j.preventDefault(),st(true);break;case "p":j.preventDefault(),ze(true);break;case "l":j.preventDefault(),it(true);break;case "d":Ne||(j.preventDefault(),lt(true),setTimeout(()=>K.current?.focus(),0));break;case "e":Ne||(j.preventDefault(),At(true));break;case "i":j.preventDefault(),$(true),setTimeout(()=>vt.current?.focus(),0);break;case "t":j.preventDefault(),Ee(true);break;case "c":j.preventDefault(),gt.current?.focus();break}};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[t,a,J,ve,Be,ee,de,rt]);let Re=useCallback(L=>{let j=L.currentTarget.textContent?.trim()||"";if(S&&j!==S.title){let q={...S,title:j};X(q),r?.(S.id,{title:j});}},[S,r]),De=useCallback(L=>{L.key==="Enter"&&(L.preventDefault(),L.currentTarget.blur()),L.key==="Escape"&&(L.preventDefault(),L.currentTarget.textContent=S?.title||"",L.currentTarget.blur());},[S]),Ue=useCallback(()=>{S&&e&&S.description!==e.description&&r?.(S.id,{description:S.description}),$(false);},[S,e,r]),Fe=useCallback(L=>{if(S){let j={...S,columnId:L};X(j),r?.(S.id,{columnId:L}),Ae(false);}},[S,r]),_e=useCallback(L=>{if(S){let j={...S,priority:L};X(j),r?.(S.id,{priority:L}),ze(false);}},[S,r]),ft=useCallback(L=>{if(S){let j=S.assignedUserIds||[],q=j.includes(L)?j.filter(Ne=>Ne!==L):[...j,L],me={...S,assignedUserIds:q};X(me),r?.(S.id,{assignedUserIds:q});}},[S,r]),dt=useCallback(L=>{if(S){let j=S.labels||[],q=j.includes(L)?j.filter(Ne=>Ne!==L):[...j,L],me={...S,labels:q};X(me),r?.(S.id,{labels:q});}},[S,r]),ut=useCallback(L=>{if(S){let j={...S,tags:L};X(j),r?.(S.id,{tags:L});}},[S,r]),at=useCallback(L=>{if(S){let j=L.target.value,q={...S,endDate:j};X(q),r?.(S.id,{endDate:j}),lt(false);}},[S,r]),Vt=useCallback(L=>{if(S){let j={...S,estimatedTime:parseFloat(L)||0};X(j),r?.(S.id,{estimatedTime:parseFloat(L)||0});}},[S,r]),Mt=useCallback(()=>{if(R.trim()&&S){let L={id:`subtask-${Date.now()}`,title:R.trim(),completed:false,position:F.length,createdAt:new Date},j=[...F,L];Y(j),_(""),Ee(false),N?.(S.id,j);}},[R,F,S,N]),Dt=useCallback(L=>{let j=F.map(q=>q.id===L?{...q,completed:!q.completed,updatedAt:new Date}:q);Y(j),S&&N?.(S.id,j);},[F,S,N]),wt=useCallback(L=>{let j=F.filter(q=>q.id!==L);Y(j),S&&N?.(S.id,j);},[F,S,N]),bt=useCallback(()=>{ye.trim()&&S&&c&&(c(S.id,ye.trim()),Je(""));},[ye,S,c]),Ut=useCallback(L=>{(L.metaKey||L.ctrlKey)&&L.key==="Enter"&&(L.preventDefault(),bt());},[bt]),Ge=L=>jsx(ty,{remarkPlugins:[ay],rehypePlugins:[ry],components:{a:({node:j,...q})=>jsx("a",{...q,target:"_blank",rel:"noopener noreferrer"})},children:L}),Le=l.filter(L=>z==="comments"?L.type.includes("COMMENT"):z==="history"?!L.type.includes("COMMENT"):true);if(!t||!e)return null;let nt=S||e,oe=s.filter(L=>nt.assignedUserIds?.includes(L.id)),fe=F.filter(L=>L.completed).length;return jsx(Qt,{children:jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxs("div",{className:"modal-v2-container",onClick:L=>L.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":I,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:we,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Re,onKeyDown:De,children:nt.title}),jsxs("p",{className:"modal-v2-ai-prompt",children:[jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxs("section",{className:"modal-v2-metadata",children:[jsxs("div",{className:"modal-v2-field-wrapper",ref:tt,children:[jsxs("button",{ref:pe,className:"modal-v2-field",onClick:()=>Ae(!J),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]}),jsx("span",{children:"Status"}),jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsx("div",{className:"modal-v2-field-value",children:nt.columnId||"No status"})]}),jsx(ds,{triggerRef:pe,isOpen:J,onClose:()=>Ae(false),width:250,estimatedHeight:200,children:(y.length>0?y:ny.map(L=>({id:L,title:L}))).map(L=>jsx("button",{className:`modal-v2-popover-item ${nt.columnId===L.id?"active":""}`,onClick:()=>Fe(L.id),children:L.title},L.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:le,children:[jsxs("button",{ref:Te,className:"modal-v2-field",onClick:()=>st(!Be),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsx("span",{children:"Assignees"}),jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsx("div",{className:"modal-v2-field-value",children:oe.length>0?jsx("div",{className:"modal-v2-avatars",children:oe.map(L=>jsx("div",{className:"modal-v2-avatar",style:{background:L.color},title:L.name,children:L.initials},L.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(ds,{triggerRef:Te,isOpen:Be,onClose:()=>st(false),width:280,estimatedHeight:300,children:s.map(L=>jsxs("button",{className:`modal-v2-popover-item ${nt.assignedUserIds?.includes(L.id)?"active":""}`,onClick:()=>ft(L.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:L.color},children:L.initials}),L.name,nt.assignedUserIds?.includes(L.id)&&jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},L.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:H,children:[jsxs("button",{ref:G,className:"modal-v2-field",onClick:()=>ze(!ve),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Priority"}),jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsx("div",{className:"modal-v2-field-value",children:nt.priority||"None"})]}),jsxs(ds,{triggerRef:G,isOpen:ve,onClose:()=>ze(false),width:180,estimatedHeight:220,children:[oy.map(L=>jsx("button",{className:`modal-v2-popover-item priority-${L.toLowerCase()} ${nt.priority===L?"active":""}`,onClick:()=>_e(L),children:L},L)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>_e(""),children:"None"})]})]}),h.length>0||f?jsx("div",{className:"modal-v2-field-wrapper",children:jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Etiquetas"})]}),jsx("div",{className:"modal-v2-field-value",children:jsx(So,{selectedTags:nt.tags||[],availableTags:h,onChange:ut,onCreateTag:f,theme:ht[I]||ht.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:D,children:[jsxs("button",{ref:te,className:"modal-v2-field",onClick:()=>it(!ee),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Labels"}),jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsx("div",{className:"modal-v2-field-value",children:nt.labels&&nt.labels.length>0?jsx("span",{children:nt.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(ds,{triggerRef:te,isOpen:ee,onClose:()=>it(false),width:220,estimatedHeight:200,children:(x.length>0?x:["Bug","Feature","Enhancement","Documentation"]).map(L=>jsxs("button",{className:`modal-v2-popover-item ${nt.labels?.includes(L)?"active":""}`,onClick:()=>dt(L),children:[L,nt.labels?.includes(L)&&jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},L))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{lt(!de),setTimeout(()=>K.current?.showPicker?.(),0);},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsx("span",{children:"Due Date"}),jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsx("div",{className:"modal-v2-field-value",children:nt.endDate?new Date(nt.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:K,type:"date",value:typeof nt.endDate=="string"?nt.endDate.split("T")[0]:nt.endDate?(()=>{let L=new Date(nt.endDate),j=L.getUTCFullYear(),q=String(L.getUTCMonth()+1).padStart(2,"0"),me=String(L.getUTCDate()).padStart(2,"0");return `${j}-${q}-${me}`})():"",onChange:at,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>At(!rt),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsx("span",{children:"Estimated Time"}),jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsx("div",{className:"modal-v2-field-value",children:nt.estimatedTime?`${nt.estimatedTime}h`:"Not set"})]}),rt&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:nt.estimatedTime||"",onChange:L=>Vt(L.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>At(false)})})]})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsx("h2",{children:"Description"})]}),O?jsx("textarea",{className:"modal-v2-textarea",value:nt.description||"",onChange:L=>{if(S){let j={...S,description:L.target.value};X(j);}},onBlur:Ue,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>$(true),children:nt.description?jsx("div",{className:"modal-v2-markdown",children:Ge(nt.description)}):jsxs("p",{className:"modal-v2-placeholder",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M9 11l3 3L22 4"}),jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsx("h2",{children:"Subtasks"}),F.length>0&&jsxs("span",{className:"modal-v2-count",children:[fe,"/",F.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>Ee(true),children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxs("div",{className:"modal-v2-subtasks",children:[F.map(L=>jsxs("div",{className:`modal-v2-subtask ${L.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Dt(L.id),children:L.completed?jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsx("span",{className:"modal-v2-subtask-title",children:L.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>wt(L.id),children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},L.id)),Z&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:R,onChange:L=>_(L.target.value),onKeyDown:L=>{L.key==="Enter"&&Mt(),L.key==="Escape"&&(Ee(false),_(""));},onBlur:Mt,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(k||T.length>0)&&jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsx("h2",{children:"Attachments"}),T.length>0&&jsx("span",{className:"modal-v2-count",children:T.length})]}),jsx(io,{cardId:nt.id,attachments:T,onUpload:k?L=>k(nt.id,L):void 0,onDelete:v,maxSizeMB:10,maxFiles:20})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("h2",{children:"Activity"}),jsxs("div",{className:"modal-v2-filters",children:[jsx("button",{className:`modal-v2-filter ${z==="all"?"active":""}`,onClick:()=>re("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${z==="comments"?"active":""}`,onClick:()=>re("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${z==="history"?"active":""}`,onClick:()=>re("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[m&&jsx("div",{className:"modal-v2-avatar",style:{background:m.color},children:m.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:gt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:ye,onChange:L=>Je(L.target.value),onKeyDown:Ut,rows:1}),jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxs("div",{className:"modal-v2-toolbar-left",children:[jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})})}),jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"4"}),jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsx("button",{className:"modal-v2-send-button",onClick:bt,disabled:!ye.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[Le.map(L=>{let j=s.find(me=>me.id===L.userId);if(L.type.includes("COMMENT")){let me=n.find(Ne=>Ne.id===L.metadata?.commentId);return me?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[j&&jsx("div",{className:"modal-v2-avatar",style:{background:j.color},children:j.initials}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-activity-header",children:[jsx("span",{className:"modal-v2-activity-user",children:j?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(L.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:me.content})]})]},L.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[L.type.includes("CREATED")&&"\u2795",L.type.includes("UPDATED")&&"\u270F\uFE0F",L.type.includes("MOVED")&&"\u27A1\uFE0F",L.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",L.type.includes("ASSIGNED")&&"\u{1F464}",L.type.includes("PRIORITY")&&"\u{1F3AF}",L.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-history-text",children:[jsx("span",{className:"modal-v2-activity-user",children:j?.name||"Unknown"})," ",L.type.replace(/_/g," ").toLowerCase(),L.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:L.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(L.timestamp).toLocaleString()})]})]},L.id)}),Le.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function gy({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 td({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((l,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(gy,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#2E94FF",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#2E94FF",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((n,l)=>n+l.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((n,l)=>n+l.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#2E94FF"},children:e.reduce((n,l)=>n+(l.planned||0),0)})]})]})]})}function Cy({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 ad({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,c=s>0?(s-n)/s*100:0,i=n<=l;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(o?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Cy,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color: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:n})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Ay={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#2E94FF",LOW:"#10B981"},Fp=["#2E94FF","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Ly({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),c=t+n*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 Pp({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsx("strong",{children:a.value})]}),jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxs("strong",{children:[o,"%"]})]})]})}function rd({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((c,i)=>c+i.value,0),n=e.map(c=>({...c,totalValue:s,color:c.color||Ay[c.name]||Fp[e.indexOf(c)%Fp.length]})),l=n.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:n,cx:"50%",cy:"50%",labelLine:false,label:o?Ly:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(Pp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,i)=>{let m=i.payload,d=s>0?(m.value/s*100).toFixed(0):"0";return `${c} (${m.value} - ${d}%)`}})]}):jsxs(BarChart$1,{data:n,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Pp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((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:"#2E94FF"},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 mi=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=useState(false),[c,i]=useState(false),[m,d]=useState(false),[p,g]=useState(false);if(e.length===0)return null;let y=e.map(C=>C.id),x=C=>{r.onBulkUpdate?.(y,{priority:C}),l(false);},h=C=>{r.onBulkMove?.(y,C),i(false),a();},f=C=>{r.onBulkUpdate?.(y,{assignedUserIds:C}),d(false);},b=C=>{let N=new Set;e.forEach(k=>{k.labels?.forEach(v=>N.add(v));});let T=Array.from(new Set([...N,...C]));r.onBulkUpdate?.(y,{labels:T}),g(false);},w=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(y),a());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!n),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(C=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(C),children:[jsx("span",{className:u("asakaa-priority-dot",C==="LOW"&&"bg-asakaa-priority-low",C==="MEDIUM"&&"bg-asakaa-priority-medium",C==="HIGH"&&"bg-asakaa-priority-high",C==="URGENT"&&"bg-asakaa-priority-urgent")}),C]},C))})]}),o.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:o.map(C=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h(C.id),children:C.title},C.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!m),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(C=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f([C.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:C.color},children:C.initials}),C.name]},C.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!p),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(C=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([C]),children:C},C))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:w,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"})})]})]})})});mi.displayName="BulkOperationsToolbar";function $y(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,c,i;switch(t){case "assignee":let m=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);m.length>0?m.forEach(g=>{let y=a?.find(x=>x.id===g);n=`assignee-${g}`,l=y?.name||`User ${g}`,c=y?.color,i=y?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",c="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:c,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let p={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];l=p.title,c=p.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(g=>{n=`label-${g}`,l=g,c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:g,cardIds:[],color:c}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:c}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function od({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),l=useMemo(()=>$y(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),c=useCallback(i=>{n(m=>{let d=new Set(m);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsx(Fo,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:u("asakaa-swimlane-view",o),children:[l.map(i=>{let m=s.has(i.id),d=e.cards.filter(g=>i.cardIds.includes(g.id)),p={...e,cards:d};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&c(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(Fo,{board:p,callbacks:r,availableUsers:a})})]},i.id)}),l.length===0&&jsxs("div",{className:"text-center py-12 text-white/50",children:[jsx("p",{className:"text-lg",children:"No cards to display"}),jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var nd=[{value:"none",label:"No Grouping",icon:"\u{1F4CB}",description:"Standard Kanban board view"},{value:"assignee",label:"By Assignee",icon:"\u{1F465}",description:"Group cards by assigned user"},{value:"priority",label:"By Priority",icon:"\u{1F3AF}",description:"Group cards by priority level"},{value:"label",label:"By Label",icon:"\u{1F3F7}\uFE0F",description:"Group cards by label/tag"}];function sd({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),l=nd.find(i=>i.value===e)||nd[0];useEffect(()=>{function i(m){s.current&&!s.current.contains(m.target)&&n.current&&!n.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let c=i=>{t(i),o(false);};return jsxs("div",{className:u("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:l.icon}),jsx("span",{children:l.label}),jsx("svg",{className:u("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:nd.map(i=>jsxs("button",{onClick:()=>c(i.value),className:u("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var cs=[{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 Uy(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,l=o.alt?e.altKey:!e.altKey,c=o.meta?e.metaKey:true;return s&&n&&l&&c}function Rp(e={}){let{shortcuts:t=cs,enabled:a=true,preventDefault:r=true}=e,o=useRef(t),s=useRef(a);useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=useCallback(c=>{o.current=[...o.current,c];},[]),l=useCallback(c=>{o.current=o.current.filter(i=>i.action!==c);},[]);return useEffect(()=>{function c(i){if(!s.current)return;let m=i.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Uy(i,d)){r&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function Gy(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Vy(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 jy(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Vy(e),r=t?Gy(t):"";return a?`${a} + ${r}`:r}function _y(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 id({shortcuts:e=cs,isOpen:t,onClose:a,className:r}){let[o,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]),!o||!t)return null;let n=_y(e);return jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(n).map(([l,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-blue-500 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:jy(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 ld=[{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 ld({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function l(m){s.current&&!s.current.contains(m.target)&&n.current&&!n.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let i=l=>{t(l),o(false);},c=e.reduce((l,m)=>{let d=m.category||"Other";return l[d]||(l[d]=[]),l[d].push(m),l},{});return jsxs("div",{className:u("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:u("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([l,m])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:l})}),jsx("div",{children:m.map(d=>jsxs("button",{onClick:()=>i(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},l)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function cd({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,i]=useState("export"),[c,l]=useState("json"),[m,d]=useState(null),p=useRef(null);if(!t)return null;let g=async()=>{let x=o?.current||void 0,h=await iu(e,c,x);lu(h,c);},y=async x=>{let h=x.target.files?.[0];if(h){try{let f=await uu(h),b=h.name.endsWith(".json")?"json":"csv",w=cu(f,b);d(w),w.success&&r&&r(w,f);}catch(f){d({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxs("div",{className:u("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>i("export"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>i("import"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[n==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxs("button",{onClick:()=>l(x),className:u("p-4 rounded-lg border-2 transition-all text-center",c===x?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:g,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:p,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxs("button",{onClick:()=>p.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),m&&jsxs("div",{className:u("p-4 rounded-lg",m.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:u("font-semibold mb-2",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:m.errors.map((x,h)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},h))})]})]})]})]})]})}var Jy=["URGENT","HIGH","MEDIUM","LOW"],Qy=[{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"}],Zy=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ud({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:i,availableUsers:c=[],availableLabels:l=[],availableColumns:m=[],showQuickFilters:d=true,compact:p=false,groupBy:g="none",onGroupByChange:y}){let[x,h]=useState(true),f=useCallback(T=>{a({search:T.target.value});},[a]),b=useCallback(T=>{a({dateFilter:T.target.value});},[a]),w=useCallback(T=>{r({by:T.target.value});},[r]),C=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${p?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>h(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),N&&jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!x&&jsxs("div",{className:"filter-bar__content",children:[d&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),i&&jsx("button",{onClick:i,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:f,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:b,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:T=>{let k=T.target.value;a({priorities:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Jy.map(T=>jsx("option",{value:T,children:T},T))]})}),c.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:T=>{let k=T.target.value;a({assignees:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),c.map(T=>jsx("option",{value:T.id,children:T.name},T.id))]})}),l.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:T=>{let k=T.target.value;a({labels:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),l.map(T=>jsx("option",{value:T,children:T},T))]})}),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:w,className:"filter-bar__select filter-bar__select--sm",children:Qy.map(T=>jsx("option",{value:T.value,children:T.label},T.value))}),t.by!=="none"&&jsx("button",{onClick:C,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:g,onChange:T=>y(T.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Zy.map(T=>jsx("option",{value:T.value,children:T.label},T.value))})}),N&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function pd({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:i,onExportGanttCSV:c}){let[l,m]=useState(false),d=useRef(null);useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&m(false);};return l&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[l]);let p=g=>{g(),m(false);};return jsxs("div",{className:u("relative",r),ref:d,children:[jsxs("button",{onClick:()=>m(!l),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":l,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),l&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>p(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>p(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>p(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>p(async()=>await i?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>p(()=>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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>p(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxs("button",{onClick:()=>p(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var md={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:"#2E94FF",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"}},gd={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:"#2E94FF",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"}},fd={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"}},Zo={dark:md,light:gd,neutral:fd},mi="dark";var gi=createContext(void 0),dx="asakaa-theme";function Hp({children:e,defaultTheme:t=mi,storageKey:a=dx}){let[r,o]=useState(()=>{if(typeof window<"u"){let i=localStorage.getItem(a);if(i&&(i==="dark"||i==="light"||i==="neutral"))return i}return t}),s=useCallback(i=>{o(i),typeof window<"u"&&localStorage.setItem(a,i);},[a]);useEffect(()=>{if(typeof window>"u")return;let i=document.documentElement,c=Zo[r];Object.entries(c.colors).forEach(([m,d])=>{d&&i.style.setProperty(`--theme-${cx(m)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([m,d])=>{let p=c.colors[m];p&&i.style.setProperty(d,p);}),i.setAttribute("data-theme",r),i.classList.remove("theme-dark","theme-light","theme-neutral"),i.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:Zo};return jsx(gi.Provider,{value:n,children:e})}function Dn(){let e=useContext(gi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function cx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function bd({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Dn();return e?jsxs("div",{className:u("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(Zo).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:u("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:n.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function zp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return pt[e]||pt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;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 fi={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"}},Up={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},hd={en:fi,es:Up};function Wp(e){return hd[e]||hd.en}function yd(e,t){let a=Wp(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 En=createContext(fi);function Rr(){return useContext(En)}function us(e,t,a="left",r=208){let[o,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),i=n.bottom+4,c;a==="right"?c=n.right-r:c=n.left;let l=8;c+r>window.innerWidth-l&&(c=window.innerWidth-l-r),c<l&&(c=l),s({top:i,left:c});},[t,a,e,r]),o}function Jp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[i,c]=useState(false),[l,m]=useState(null),d=useRef(null),p=useRef(null),g=Rr(),y=us(d,i,"right",176);if(useEffect(()=>{if(!i)return;let b=w=>{let C=w.target;d.current&&!d.current.contains(C)&&p.current&&!p.current.contains(C)&&c(false);};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[i]),!(t||a||r||o||s||n))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:o},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(b=>b.handler),f=async(b,w)=>{if(w){m(b);try{await w();}catch(C){console.error(`Export ${b} failed:`,C);}finally{m(null),c(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:d,onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:i?e.accent:e.bgSecondary,border:`1px solid ${i?e.accent:e.borderLight}`,color:i?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:g.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:i?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:i&&jsx(motion.div,{ref:p,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-44 rounded-xl overflow-hidden",style:{top:y.top,left:y.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((b,w)=>jsxs(motion.button,{onClick:()=>f(b.id,b.handler),disabled:l!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:w<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:w*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===b.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"})}):b.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:b.label}),jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})}),document.body)]})}function Vp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,i]=useState(false),[c,l]=useState(null),[m,d]=useState(false),p=useRef(null),g=useRef(null),y=Rr(),x=us(p,n,"right",224),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=y.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!n)return;let N=T=>{let k=T.target;p.current&&!p.current.contains(k)&&g.current&&!g.current.contains(k)&&i(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[n]);let b=[{id:"png",label:y.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:y.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:y.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:y.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(N=>N.handler),w=async(N,T)=>{if(T){l(N);try{await T();}catch(k){console.error(`Export ${N} failed:`,k);}finally{l(null),i(false);}}},C=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:p,onClick:()=>i(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:y.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:n&&jsxs(motion.div,{ref:g,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:x.top,left:x.left,zIndex:99999,backgroundColor: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:[b.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:f?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:b.map((N,T)=>jsxs(motion.button,{onClick:()=>w(N.id,N.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:T*.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===N.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):N.icon}),jsx("span",{className:"flex-1 text-left",children:N.label})]},N.id))})]}),b.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:f?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:C,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:b.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:m?"rgba(34,197,94,0.15)":e.accentLight,color:m?"#22C55E":e.accent},children:m?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:m?y.toolbar.copied:y.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Lx({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxs(motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsx(motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Ix({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxs(motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-[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:o.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function jp({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=useState(false),n=useRef(null),i=useRef(null),c=Rr(),l=us(n,o,"left");useEffect(()=>{if(!o)return;let p=g=>{let y=g.target;n.current&&!n.current.contains(y)&&i.current&&!i.current.contains(y)&&s(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]);let m=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(p,g)=>({value:g+1,label:`L${g+1}`}))],d=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:n,onClick:()=>s(!o),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:o?e.accentLight:e.bgSecondary,border:`1px solid ${o?e.accent:e.borderLight}`,color:o?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${d}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:d})]}),createPortal(jsx(AnimatePresence,{children:o&&jsx(motion.div,{ref:i,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:l.top,left:l.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:m.map((p,g)=>{let y=t===p.value;return jsxs(motion.button,{onClick:()=>{a(p.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:y?e.accentLight:"transparent",borderBottom:g<m.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:y?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsx("span",{className:"text-[11px]",style:{color:y?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:y?600:500},children:p.label}),y&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(p.value))})})})}),document.body)]})}function _p({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),i=useRef(null),c=useRef(null),l=Rr(),m=us(i,s,"left");useEffect(()=>{if(!s)return;let y=setTimeout(()=>{let x=f=>{let b=f.target;i.current&&!i.current.contains(b)&&c.current&&!c.current.contains(b)&&n(false);},h=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(y),c._cleanup&&c._cleanup();}},[s]);let d=[{value:"all",label:l.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{value:"completed",label:l.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:l.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-blue-500"},{value:"incomplete",label:l.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],p=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:i,onClick:y=>{y.stopPropagation(),n(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:p?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${p?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:p?"#2E94FF":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:l.toolbar.filter||"Filters"}),p&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),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:m.top,left:m.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:l.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:d.map(y=>{let x=t===y.value&&!r,h=()=>y.value==="all"?x?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):y.icon;return jsxs(motion.button,{onClick:()=>{a(y.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:x?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${x?y.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:y.label}),x&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},y.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),o&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#2E94FF":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:l.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function Bx({value:e,onChange:t,theme:a}){let r=Rr(),o=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:o?"#000000":a.bgSecondary,border:`1px solid ${o?"rgba(255,255,255,0.1)":a.border}`},children:s.map(n=>{let i=e===n.value;return jsx(motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:i?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:i?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function Rx({theme:e,forecast:t}){let a=Rr(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=s!=null,i=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},l=t?.confidencePercent,m=l!=null?l>=75?"#22C55E":l>=40?"#F59E0B":"#EF4444":e.textTertiary,d=t?.costAtCompletion,p=t?.currency||"$",g=d!=null?d>=1e6?`${p}${(d/1e6).toFixed(2)}M`:d>=1e3?`${p}${(d/1e3).toFixed(1)}K`:`${p}${d.toFixed(0)}`:"\u2014",y=t?.budgetVariancePercent,x=y!=null&&y!==0,h=y!=null?y>0?`+${y.toFixed(0)}% ${a.toolbar.budgetOver}`:`${y.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=y!=null&&y>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:y!=null&&y<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,": ",o]}),n&&i&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace"},children:i})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:m,fontFamily:"'JetBrains Mono', monospace"},children:l!=null?`${l.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),x&&h&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:h})]})]})]})}function Ox({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:i,onShowDependenciesChange:c,rowDensity:l,onRowDensityChange:m,hasDependencies:d=true}){let[p,g]=useState(false),y=useRef(null),x=useRef(null),h=Rr(),f=us(y,p,"right",208),b=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!p)return;let T=k=>{let v=k.target;y.current&&!y.current.contains(v)&&x.current&&!x.current.contains(v)&&g(false);};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[p]);let w=h.toolbar.visibility==="Visibilidad",C=[{key:"criticalPath",label:w?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a,disabled:!d,tooltip:d?void 0:w?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:w?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:o},{key:"weekends",label:w?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:n},{key:"dependencies",label:w?"Dependencias":"Dependencies",icon:GitBranch,active:i,onChange:c}],N=[{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:y,onClick:()=>g(!p),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:p?e.accent:e.textTertiary,backgroundColor:p?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:h.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:p&&jsxs(motion.div,{ref:x,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:b?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${b?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:b?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:C.map((T,k)=>{let v=T.icon,E=T.disabled,I=T.tooltip;return jsxs(motion.button,{onClick:()=>!E&&T.onChange?.(!T.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:E?b?"rgba(255,255,255,0.3)":"#9CA3AF":b?"rgba(255,255,255,0.85)":"#111827",cursor:E?"not-allowed":"pointer"},whileHover:E?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},title:I,children:[jsx(v,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:E?b?"rgba(255,255,255,0.2)":"#D1D5DB":T.active?e.accent||"#2E94FF":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:T.label}),T.active&&!E&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},T.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:b?"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:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),N.map((T,k)=>{let v=l===T.value;return jsxs(motion.button,{onClick:()=>m(T.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:b?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(C.length+k)*.03},children:[jsx("span",{style:{color:v?e.accent||"#2E94FF":b?"rgba(255,255,255,0.85)":e.textPrimary},children:T.label}),v&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},T.value)})]})]})}),document.body)]})}function bi({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:i,onRowDensityChange:c,showThemeSelector:l=false,showCreateTaskButton:m=false,createTaskLabel:d,onCreateTask:p,taskFilter:g="all",onTaskFilterChange:y,hideCompleted:x=false,onHideCompletedChange:h,toolbarRightContent:f,wbsLevel:b,onWbsLevelChange:w,maxWbsDepth:C=4,viewMode:N="execution",onViewModeChange:T,projectForecast:k,onExportPNG:v,onExportPDF:E,onExportExcel:I,onExportCSV:D,onExportJSON:X,onExportMSProject:O,showCriticalPath:H=true,onShowCriticalPathChange:F,showDependencies:Y=true,onShowDependenciesChange:Z,highlightWeekends:Se=true,onHighlightWeekendsChange:R,showBaseline:_=false,onShowBaselineChange:he,onCopySnapshotLink:Je,hasDependencies:z=true}){let re=Rr(),J=v||E||I||D||X||O,Pe=!!e.glassToolbar,[ve,We]=useState(false),Re=useRef(null);useEffect(()=>{ve&&Re.current&&Re.current.focus();},[ve]);let st=[{value:"day",label:re.toolbar.day},{value:"week",label:re.toolbar.week},{value:"month",label:re.toolbar.month}],ee=[{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"})}],it=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Pe){let le=it?"rgba(255,255,255,0.08)":e.borderLight;return jsxs("div",{className:"flex flex-col",children:[jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsxs(motion.div,{className:"flex items-center rounded-full overflow-hidden",style:{backgroundColor:it?"#1A1A1A":e.bgSecondary,border:`1px solid ${it?"rgba(255,255,255,0.08)":e.border}`},animate:{width:ve?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsx(motion.button,{onClick:()=>We(!ve),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsx(Search,{className:"w-4 h-4"})}),ve&&jsx("input",{ref:Re,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>We(false),onKeyDown:ot=>{ot.key==="Escape"&&We(false);}})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:le}}),T&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:it?"#000000":e.bgSecondary,border:`1px solid ${it?"rgba(255,255,255,0.08)":e.border}`},children:[jsx(motion.button,{onClick:()=>T("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="execution"?it?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:N==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="execution"?{color:e.textSecondary}:{},children:re.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>T("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="oracle"?it?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:N==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="oracle"?{color:e.textSecondary}:{},children:re.toolbar.viewOracle})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Bx,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:le}}),w&&jsx(jp,{theme:e,value:b??"all",onChange:w,maxDepth:C}),y&&jsx(_p,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:le}}),f]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:le}}),jsx(Ox,{theme:e,showCriticalPath:H,onShowCriticalPathChange:F,showBaseline:_,onShowBaselineChange:he,highlightWeekends:Se,onHighlightWeekendsChange:R,showDependencies:Y,onShowDependenciesChange:Z,rowDensity:i,onRowDensityChange:c,hasDependencies:z}),jsx(Vp,{theme:e,onExportPNG:v,onExportPDF:E,onExportExcel:I,onExportMSProject:O,onCopySnapshotLink:Je}),m&&p&&jsxs(motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${it?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${it?"rgba(46,148,255,0.4)":"rgba(37,99,235,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||re.toolbar.createTask})]})]})]}),k&&jsx(Rx,{theme:e,forecast:k})]})}return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx(Ix,{options:st,value:t,onChange:le=>a(le),theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsx(motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),w&&jsx(jp,{theme:e,value:b??"all",onChange:w,maxDepth:C}),y&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(_p,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxs(Fragment,{children:[f,jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),m&&p&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||re.toolbar.createTask})]}),(J||l)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(Vp,{theme:e,onExportPNG:v,onExportPDF:E,onExportExcel:I,onExportMSProject:O,onCopySnapshotLink:Je}),l&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),l&&jsx(Lx,{options:ee,value:s,onChange:le=>n(le),theme:e})]})]})}function hi({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),i=useRef(null),c=useRef(null);useEffect(()=>{if(!r)return;let m=d=>{i.current&&!i.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let l=e.filter(m=>m.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let m=c.current.getBoundingClientRect();n({x:m.left,y:m.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(Xt,{children:jsx(motion.div,{ref:i,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"}),l.map(m=>jsxs("button",{onClick:()=>{t(m.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:m.label}),m.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},m.id))]})})})})]})}function Fn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[i,c]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let m=200,d=r.length*36+8,p=8,g=window.innerWidth,y=window.innerHeight,x=t,h=a;t+m+p>g&&(x=t-m,x<p&&(x=p)),a+d+p>y&&(h=y-d-p,h<p&&(h=p)),c({x,y:h});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let m=p=>{n.current&&!n.current.contains(p.target)&&o();},d=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let l=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${i.x}px`,top:`${i.y}px`,backgroundColor:l(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(m=>jsxs("div",{children:[m.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{m.disabled||(m.onClick(),o());},disabled:m.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:m.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:d=>{m.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsx("span",{style:{color:s.textSecondary},children:m.icon}),jsx("span",{className:"flex-1",children:m.label}),m.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},m.id))})})})}var ca={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 om({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:i,onTaskOutdent:c,onTaskRename:l,onTaskToggleExpand:m,onOpenTaskModal:d,enableKeyboard:p=true}){let g=useRef(false),y=useCallback(w=>{g.current=w;},[]),x=useCallback(w=>{let C=[],N=T=>{for(let k of T)C.push(k),k.subtasks&&k.subtasks.length>0&&k.isExpanded&&N(k.subtasks);};return N(w),C},[]),h=useCallback(()=>{let w=x(e);for(let C of w)if(t.has(C.id))return C;return null},[e,t,x]),f=useCallback((w,C)=>{let N=x(e);if(N.length===0)return;let T=h();if(!T){a(N[0].id,false);return}let k=N.findIndex(I=>I.id===T.id);if(k===-1)return;let v=w==="up"?k-1:k+1;if(v<0||v>=N.length)return;let E=N[v];a(E.id,C);},[e,h,x,a]),b=useCallback(w=>{if(!p)return;let C=w.target;if(C.tagName==="INPUT"||C.tagName==="TEXTAREA"||C.isContentEditable||g.current){w.key==="Escape"&&(C.blur(),g.current=false);return}let k=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,v=Array.from(t),E=h();if(w.key==="ArrowUp"){w.preventDefault(),f("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),f("down",w.shiftKey);return}if(E&&(w.key==="ArrowRight"||w.key==="ArrowLeft")){E.subtasks&&E.subtasks.length>0&&(w.preventDefault(),(w.key==="ArrowRight"&&!E.isExpanded||w.key==="ArrowLeft"&&E.isExpanded)&&m(E.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){v.length>0&&(w.preventDefault(),n(v,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){v.length>0&&(w.preventDefault(),i(v));return}if(w.key==="Tab"&&w.shiftKey){v.length>0&&(w.preventDefault(),c(v));return}if(w.key==="Enter"&&!w.shiftKey&&!k){E&&(w.preventDefault(),r(E.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!k){E&&(w.preventDefault(),r(E.id,"above"));return}if(w.key==="Enter"&&k){E&&(w.preventDefault(),d(E.id));return}if(w.key==="F2"){E&&(w.preventDefault(),l(E.id));return}if(w.key==="Delete"||w.key==="Backspace"&&k){v.length>0&&(w.preventDefault(),o(v));return}if(w.key==="d"&&k&&!w.shiftKey){v.length>0&&(w.preventDefault(),s(v));return}},[p,t,h,f,r,o,s,n,i,c,l,m,d]);return useEffect(()=>{if(p)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[p,b]),{setIsEditing:y}}function sm(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(d=>{t(new Set([d])),r(d);},[]),s=useCallback(d=>{t(p=>{let g=new Set(p);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),n=useCallback((d,p)=>{if(!a){o(d);return}let g=p.indexOf(a),y=p.indexOf(d);if(g===-1||y===-1){o(d);return}let x=Math.min(g,y),h=Math.max(g,y),f=p.slice(x,h+1);t(new Set(f)),r(d);},[a,o]),i=useCallback((d,p,g,y)=>{y?n(d,p):g?s(d):o(d);},[o,s,n]),c=useCallback((d,p)=>{p?t(g=>{let y=new Set(g);return y.add(d),y}):o(d);},[o]),l=useCallback(()=>{t(new Set),r(null);},[]),m=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:i,handleKeyboardSelection:c,clearSelection:l,isTaskSelected:m}}function Cd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?Cd(t.subtasks):t.subtasks}))}function Pn(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((i,c)=>(i.position??0)-(c.position??0));for(let i=0;i<n.length;i++){let c={...n[i],parentId:o,level:s,position:n[i].position??i};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function An(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=An(a.subtasks,t);if(r)return r}}return null}function kd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=kd(a.subtasks,t);if(r)return r}return null}function Td(e,t){if(t.length===0)return e;let a=Pn(e),r=t[0],o=a.findIndex(p=>p.id===r);if(o<=0)return e;let s=a[o-1],n=(p,g)=>{let y=[];return {tasks:p.filter(h=>{if(g.has(h.id))return y.push(h),false;if(h.subtasks){let f=n(h.subtasks,g);h.subtasks=f.tasks,y.push(...f.removed);}return true}),removed:y}},i=(p,g,y)=>p.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...y],isExpanded:true}:x.subtasks?{...x,subtasks:i(x.subtasks,g,y)}:x),c=new Set(t),{tasks:l,removed:m}=n(e,c),d=i(l,s.id,m);return Cd(d)}function Nd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=kd(a,r);if(!o)continue;let s=kd(a,o.id),n=(l,m,d)=>{for(let p=0;p<l.length;p++){let g=l[p];if(g.id===m&&g.subtasks){let y=g.subtasks.findIndex(x=>x.id===d);if(y!==-1){let[x]=g.subtasks.splice(y,1);return x}}if(g.subtasks){let y=n(g.subtasks,m,d);if(y)return y}}return null},i=(l,m,d)=>{let p=l.findIndex(g=>g.id===m);if(p!==-1)return l.splice(p+1,0,d),l;for(let g of l)g.subtasks&&i(g.subtasks,m,d);return l},c=n(a,o.id,r);c&&(s&&s.subtasks?i(s.subtasks,o.id,c):i(a,o.id,c));}return Cd(a)}function Dd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,i,c)=>{let l=n.findIndex(d=>d.id===i);if(l===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,i,c))return true;return false}let m=c==="up"?l-1:l+1;return m<0||m>=n.length?false:([n[l],n[m]]=[n[m],n[l]],n[l]={...n[l],position:l},n[m]={...n[m],position:m},true)};return s(r,o,a),r}function Sd(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function ms(e,t){let a=[...e],r=[];for(let o of t){let s=(c,l)=>c.map((m,d)=>({...m,id:`${m.id}-copy-${Date.now()}-${d}`,parentId:l,subtasks:m.subtasks?s(m.subtasks,`${m.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let l=c.findIndex(g=>g.id===o);if(l===-1){for(let g of c)if(g.subtasks){let y=n(g.subtasks);if(y)return y}return null}let m=c[l],d=`${m.id}-copy-${Date.now()}`,p={...m,id:d,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks,d):void 0};return c.splice(l+1,0,p),p},i=n(a);i&&r.push(i);}return {tasks:a,duplicatedTasks:r}}function im(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#2E94FF"},i=c=>{let l=c.findIndex(d=>d.id===t);if(l===-1){for(let d of c)if(d.subtasks&&i(d.subtasks))return true;return false}let m=a==="above"?l:l+1;return c.splice(m,0,n),true};return i(r),{tasks:r,newTask:n}}function Ed(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Ed(r.subtasks,t,a)}:r)}function Md(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Md(a.subtasks,t)}:a)}function Fd(e,t){let a=p=>{for(let g of p){if(g.id===t)return g;if(g.subtasks){let y=a(g.subtasks);if(y)return y}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,i=r?.endDate||s,c=p=>{for(let g of p){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let y=c(g.subtasks);if(y>=0)return y}}return 0},l=c(e),m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(i),color:r?.color||"#2E94FF",position:l,parentId:t},d=p=>p.map(g=>{if(g.id===t){let y=g.subtasks||[];return {...g,subtasks:[...y,m],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:m}}function lm(e,t,a,r){if(t===a)return e;let o=An(e,t);if(!o)return e;if(a){let i=(c,l)=>{if(!c.subtasks)return false;for(let m of c.subtasks)if(m.id===l||i(m,l))return true;return false};if(i(o,a))return e}let s=i=>{let c=i.filter(m=>m.id!==t),l=c.length<i.length;return c.map((m,d)=>{let p=l?{...m,position:d}:m;return p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p})},n=s(e);if(a===null){let i=r!==void 0?r:n.length;n.splice(i,0,{...o,parentId:void 0}),n=n.map((c,l)=>({...c,position:l}));}else {let i=c=>c.map(l=>{if(l.id===a){let m=l.subtasks||[],d=r!==void 0?r:m.length,p=[...m];p.splice(d,0,{...o,parentId:a});let g=p.map((y,x)=>({...y,position:x}));return {...l,subtasks:g,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:i(l.subtasks)}:l});n=i(n);}return n}function Or(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=Or(t.subtasks),r=a.reduce((i,c)=>(c.startDate&&i.starts.push(new Date(c.startDate).getTime()),c.endDate&&i.ends.push(new Date(c.endDate).getTime()),i.progresses.push(c.progress??0),i),{starts:[],ends:[],progresses:[]}),o=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,n=r.progresses.length>0?Math.round(r.progresses.reduce((i,c)=>i+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function xi({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:i,onTaskToggle:c,scrollTop:l,columns:m,onToggleColumn:d,onColumnResize:p,onTaskUpdate:g,onTaskIndent:y,onTaskOutdent:x,onTaskMove:h,onMultiTaskDelete:f,onTaskDuplicate:b,onTaskCreate:w,onTaskRename:C,onCreateSubtask:N,onOpenTaskModal:T,onDeleteRequest:k,onTaskReparent:v,scrollContainerRef:E,showCriticalPath:I=false}){let D=useContext(En),[X,O]=useState(null),[H,F]=useState(null),[Y,Z]=useState(""),Se=useRef(null),[R,_]=useState(null),[he,Je]=useState(0),[z,re]=useState(0),[J,Pe]=useState({isOpen:false,x:0,y:0,type:"header"}),[ve,We]=useState(null),[Re,st]=useState(null),[ee,it]=useState(null),le=useRef(0),ot=5,yt=useRef(false),[Pt,ke]=useState(null),[xt,ct]=useState(false),rt=useRef(null),[$,de]=useState(null),[S,q]=useState(false),ce=useRef(null);useEffect(()=>{function ne(fe){ce.current&&!ce.current.contains(fe.target)&&q(false);}if(S)return document.addEventListener("mousedown",ne),()=>document.removeEventListener("mousedown",ne)},[S]),useEffect(()=>{H&&Se.current&&(Se.current.focus(),Se.current.select());},[H]),useEffect(()=>{if(!R)return;let ne=L=>{let j=L.clientX-he,K=z+j;p?.(R,K);},fe=()=>{_(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ne),document.addEventListener("mouseup",fe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[R,he,z,p]);let{selectedTaskIds:Ce,handleTaskClick:W,isTaskSelected:te}=sm(),{setIsEditing:Ge}=om({tasks:e,selectedTaskIds:Ce,onTaskSelect:(ne,fe)=>{let j=Pn(e).map(K=>K.id);W(ne,j,fe||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:x||(()=>{}),onTaskRename:ne=>{let fe=Pn(e).find(L=>L.id===ne);fe&>(fe);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:ne=>{let fe=Pn(e).find(L=>L.id===ne);fe&&T&&T(fe);},enableKeyboard:true}),Te=(ne,fe=0,L="")=>{let j=[],K=[...ne].sort((me,Me)=>(me.position??0)-(Me.position??0));for(let me=0;me<K.length;me++){let Me=K[me],qe=me+1,_e=L?`${L}.${qe}`:`${qe}.0`;if(Me.wbsCode=_e,j.push({task:Me,level:fe}),Me.subtasks&&Me.subtasks.length>0&&Me.isExpanded){let Ie=L?`${L}.${qe}`:`${qe}`;j.push(...Te(Me.subtasks,fe+1,Ie));}}return j},Ue=Te(e),Ne=48,Ve=Math.max(Ue.length*a,600-Ne),Tt=ne=>!ne.startDate||!ne.endDate?"-":`${Math.ceil((ne.endDate.getTime()-ne.startDate.getTime())/(1e3*60*60*24))}d`,gt=ne=>{F(ne.id),Z(ne.name),Ge(true);},nt=ne=>{Y.trim()&&Y!==e.find(fe=>fe.id===ne)?.name&&C?.(ne,Y.trim()),F(null),Z(""),Ge(false);},et=()=>{F(null),Z(""),Ge(false);},qt=(ne,fe)=>{fe.stopPropagation(),N?.(ne.id);},At=(ne,fe)=>{fe.preventDefault(),le.current=fe.clientY,We(ne),yt.current=false,ct(false),ke({x:fe.clientX,y:fe.clientY});},vt=ne=>{if(!ve||(Math.abs(ne.clientY-le.current)>ot&&!yt.current&&(yt.current=true,ct(true)),ke({x:ne.clientX,y:ne.clientY}),!yt.current))return;if(E?.current){let me=E.current,Me=me.getBoundingClientRect(),qe=60,_e=12;rt.current&&(cancelAnimationFrame(rt.current),rt.current=null);let Ie=ne.clientY-Me.top,bt=Me.bottom-ne.clientY;if(Ie<qe&&me.scrollTop>0){let Nt=Math.round(_e*(1-Ie/qe)),Ut=()=>{me.scrollTop-=Nt,yt.current&&me.scrollTop>0&&(rt.current=requestAnimationFrame(Ut));};rt.current=requestAnimationFrame(Ut);}else if(bt<qe&&me.scrollTop<me.scrollHeight-me.clientHeight){let Nt=Math.round(_e*(1-bt/qe)),Ut=()=>{me.scrollTop+=Nt,yt.current&&me.scrollTop<me.scrollHeight-me.clientHeight&&(rt.current=requestAnimationFrame(Ut));};rt.current=requestAnimationFrame(Ut);}}let L=document.querySelectorAll("[data-task-row]"),j=null,K=null;L.forEach(me=>{let Me=me.getBoundingClientRect(),qe=me.getAttribute("data-task-row");if(qe&&qe!==ve&&ne.clientY>=Me.top&&ne.clientY<=Me.bottom){j=qe;let _e=ne.clientY-Me.top,Ie=Me.height;_e<Ie*.25?K="above":_e>Ie*.75?K="below":K="child";}}),st(j),it(K);},Dt=()=>{if(yt.current&&ve&&Re&&ee){if(ee==="child")v?.(ve,Re);else if(ee==="above"||ee==="below"){let ne=(K,me,Me=null)=>{for(let qe of K){if(qe.id===me)return Me;if(qe.subtasks){let _e=ne(qe.subtasks,me,qe.id);if(_e!==void 0)return _e}}},fe=ne(e,ve,null),L=ne(e,Re,null),j=(K,me,Me,qe)=>{let _e=K.findIndex(Nt=>Nt.id===me),Ie=qe?K.findIndex(Nt=>Nt.id===Me):-1,bt=ee==="below"?_e+1:_e;return qe&&Ie!==-1&&Ie<_e&&(bt-=1),Math.max(0,bt)};if(L===null){let me=j(e,Re,ve,fe===null);v?.(ve,null,me);}else {let K=An(e,L);if(K?.subtasks){let me=fe===L,Me=j(K.subtasks,Re,ve,me);v?.(ve,L,Me);}}}}rt.current&&(cancelAnimationFrame(rt.current),rt.current=null),We(null),st(null),it(null),ke(null),yt.current=false,ct(false);};useEffect(()=>{if(ve)return document.addEventListener("mousemove",vt),document.addEventListener("mouseup",Dt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",vt),document.removeEventListener("mouseup",Dt),document.body.style.cursor="",document.body.style.userSelect="";}},[ve,Re,ee]);let ft=(ne,fe,L)=>{let j=fe.subtasks&&fe.subtasks.length>0;switch(ne.id){case "name":let K=H===fe.id,me=X===fe.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${L*20}px`},children:[v&&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:me?1:.3},onMouseDown:U=>At(fe.id,U),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),fe.subtasks&&fe.subtasks.length>0?jsx("button",{onClick:U=>{U.stopPropagation(),c?.(fe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:fe.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"}),K?jsx("input",{ref:Se,type:"text",value:Y,onChange:U=>Z(U.target.value),onKeyDown:U=>{U.key==="Enter"?nt(fe.id):U.key==="Escape"&&et();},onBlur:()=>nt(fe.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:U=>U.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:fe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:fe.parentId?"13px":"14px",fontWeight:fe.isMilestone?600:fe.parentId?400:600,letterSpacing:fe.parentId?"0":"-0.01em"},title:fe.name,children:[fe.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:fe.wbsCode}),fe.isHighlighted&&fe.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:fe.name}),fe.subtasks&&fe.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(fe.progress||0),"%"]}),I&&fe.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),I&&fe.cpmData&&jsxs("span",{style:{color:fe.cpmData.totalFloat<=0?"#EF4444":fe.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(fe.cpmData.totalFloat),"d"]})]}),me&&!K&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:U=>U.stopPropagation(),children:[jsx("button",{onClick:U=>qt(fe,U),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:U=>{U.stopPropagation(),gt(fe);},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 qe=ne.id==="startDate"?"startDate":"endDate",_e=fe[qe],Ie=$?.taskId===fe.id&&$?.field===qe,bt=U=>U?(typeof U=="string"?new Date(U):U).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:U=>U.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:U=>{if(!j)if(Ie)de(null);else {let oe=U.currentTarget.getBoundingClientRect();de({taskId:fe.id,field:qe,month:_e?typeof _e=="string"?new Date(_e):_e:new Date,position:{top:oe.bottom+4,left:oe.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:bt(_e)}),j&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Ie&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>de(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:$?.position.top,left:$?.position.left},onClick:U=>U.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let U=new Date,oe=new Date(U);oe.setDate(U.getDate()+1);let $e=new Date(U);$e.setDate(U.getDate()+7);let A=new Date(U);return A.setDate(U.getDate()+14),[{label:"Hoy",date:U},{label:"Ma\xF1ana",date:oe},{label:"Pr\xF3xima semana",date:$e},{label:"2 semanas",date:A}].map((je,tt)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:oa=>oa.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:oa=>oa.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(fe.id,{[qe]:je.date}),de(null);},children:je.label},tt))})(),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:U=>U.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:U=>U.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(fe.id,{[qe]:void 0}),de(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:()=>de(U=>U?{...U,month:new Date(U.month.getFullYear(),U.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:$?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>de(U=>U?{...U,month:new Date(U.month.getFullYear(),U.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((U,oe)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:U},oe))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let U=$?.month||new Date,oe=U.getFullYear(),$e=U.getMonth(),A=new Date(oe,$e,1).getDay(),ge=new Date(oe,$e+1,0).getDate(),je=new Date,tt=[];for(let Gt=A-1;Gt>=0;Gt--)tt.push({day:new Date(oe,$e,-Gt).getDate(),date:new Date(oe,$e-1,new Date(oe,$e,-Gt).getDate()),isCurrentMonth:false});for(let Gt=1;Gt<=ge;Gt++)tt.push({day:Gt,date:new Date(oe,$e,Gt),isCurrentMonth:true});let oa=42-tt.length;for(let Gt=1;Gt<=oa;Gt++)tt.push({day:Gt,date:new Date(oe,$e+1,Gt),isCurrentMonth:false});return tt.map((Gt,Na)=>{let Ma=Gt.date.toDateString()===je.toDateString(),ha=(_e?typeof _e=="string"?new Date(_e):_e:null)?.toDateString()===Gt.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:Gt.isCurrentMonth?ha?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:ha?"#2E94FF":"transparent",boxShadow:Ma&&!ha?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(fe.id,{[qe]:Gt.date}),de(null);},children:Gt.day},Na)})})()})]})]})]}),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:Tt(fe)})});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 Nt=r.filter(U=>fe.assignees?.some(oe=>oe.name===U.name||oe.initials===U.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(Ko,{assignedUsers:Nt,availableUsers:r,onChange:U=>{let oe=U.map($e=>({id:$e.id,name:$e.name,initials:$e.initials,color:$e.color}));g?.(fe.id,{assignees:oe.length>0?oe:void 0});}})});case "status":if(j){let U=fe.progress===100?"\u2713":fe.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:U})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(Fu,{status:fe.status||"todo",onChange:U=>{g?.(fe.id,{status:U,progress:U==="completed"?100:fe.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:`${fe.progress}%`,backgroundColor:fe.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:[fe.progress,"%"]})]});case "priority":let Ut={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ta={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ta=Ut[fe.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(jo,{priority:ta,onChange:U=>{U&&g?.(fe.id,{priority:Ta[U]||"medium"});}})});default:return null}},Wt=ne=>[{id:"hide",label:"Hide Column",icon:ca.Hide,onClick:()=>d(ne),disabled:ne==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ca.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ca.SortDesc,onClick:()=>{}}],Oe=ne=>ne.subtasks&&ne.subtasks.length>0?[{id:"addSubtask",label:D?.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{N?.(ne.id);}},{id:"duplicate",label:D?.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{b?.([ne.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:D?.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{k?k(ne.id,ne.name):f?.([ne.id]);}}]:[{id:"edit",label:D?.contextMenu?.editTask||"Edit Task",icon:ca.Pencil,onClick:()=>{n?.(ne);}},{id:"addSubtask",label:D?.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{N?.(ne.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:D?.contextMenu?.markIncomplete||"Mark Incomplete",icon:ca.MarkIncomplete,onClick:()=>{g?.(ne.id,{status:"todo",progress:0});},disabled:ne.status==="todo"},{id:"setInProgress",label:D?.contextMenu?.setInProgress||"Set In Progress",icon:ca.SetInProgress,onClick:()=>{g?.(ne.id,{status:"in-progress"});},disabled:ne.status==="in-progress"},{id:"markComplete",label:D?.contextMenu?.markComplete||"Mark Complete",icon:ca.MarkComplete,onClick:()=>{g?.(ne.id,{status:"completed",progress:100});},disabled:ne.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:D?.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{b?.([ne.id]);}},{id:"split",label:D?.contextMenu?.splitTask||"Split Task",icon:ca.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:D?.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{k?k(ne.id,ne.name):f?.([ne.id]);}}],Le=m.filter(ne=>ne.visible),ut=Le.reduce((ne,fe)=>ne+fe.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:ut},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Ne}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:Le.map((ne,fe)=>{let L=fe===Le.length-1,j=ne.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:`${ne.width}px`,minWidth:`${ne.minWidth??(j?200:60)}px`,maxWidth:`${ne.maxWidth??2e3}px`,flexShrink:j&&Le.length===1?1:0,flexGrow:j&&Le.length===1?1:0,borderRight:L?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:K=>{K.preventDefault(),Pe({isOpen:true,x:K.clientX,y:K.clientY,type:"header",columnId:ne.id});},onMouseEnter:K=>{K.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:K=>{K.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:ne.label,children:ne.label}),ne.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:R===ne.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:K=>{K.preventDefault(),K.stopPropagation(),_(ne.id),Je(K.clientX),re(ne.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:R===ne.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},ne.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(hi,{columns:m,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>q(!S),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"})}),S&&jsxs("div",{ref:ce,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:ne=>ne.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:()=>q(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:Ve},children:Ue.map(({task:ne,level:fe},L)=>{let j=te(ne.id),K=Re===ne.id,me=K&&ee==="above",Me=K&&ee==="below",qe=K&&ee==="child",_e={};return qe&&(_e.backgroundColor=`${t.accent}15`,_e.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":ne.id,className:`flex items-center cursor-pointer group ${ve===ne.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:j?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:j?t.accentLight:qe?`${t.accent}15`:L%2===0?t.bgPrimary:t.bgGrid,opacity:I?ne.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",..._e},onMouseEnter:()=>O(ne.id),onMouseLeave:()=>O(null),onClick:Ie=>{let Nt=Pn(e).map(ta=>ta.id),Ta=navigator.platform.toUpperCase().indexOf("MAC")>=0?Ie.metaKey:Ie.ctrlKey;W(ne.id,Nt,Ta,Ie.shiftKey),s?.(ne);},onDoubleClick:Ie=>{Ie.stopPropagation(),n?.(ne);},onContextMenu:Ie=>{Ie.preventDefault(),Pe({isOpen:true,x:Ie.clientX,y:Ie.clientY,type:"task",task:ne}),i?.(ne,Ie);},whileHover:{backgroundColor:j?t.accentLight:t.hoverBg},children:[me&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Me&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Le.map((Ie,bt)=>{let Nt=bt===Le.length-1,Ut=Ie.id==="name";return jsx("div",{className:`px-4 flex items-center ${Ut?"justify-start":"justify-center"}`,style:{width:`${Ie.width}px`,minWidth:`${Ie.minWidth??(Ut?200:60)}px`,maxWidth:`${Ie.maxWidth??2e3}px`,flexShrink:Ut&&Le.length===1?1:0,flexGrow:Ut&&Le.length===1?1:0,borderRight:Nt?"none":`1px solid ${X===ne.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ft(Ie,ne,Ut?fe:0)},`${ne.id}-${Ie.id}`)})]},ne.id)})}),jsx(Fn,{isOpen:J.isOpen,x:J.x,y:J.y,items:J.type==="header"&&J.columnId?Wt(J.columnId):J.type==="task"&&J.task?Oe(J.task):[],onClose:()=>Pe({...J,isOpen:false}),theme:t}),xt&&Pt&&ve&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Pt.x+12,top:Pt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ne=Ue.find(fe=>fe.task.id===ve)?.task;return ne?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:ne.name})}):null})()}),document.body)]})}function mm(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,i]=useState(e),[c,l]=useState(t),[m,d]=useState(null),[p,g]=useState(null),[y,x]=useState(null),[h,f]=useState(null),[b,w]=useState(0),[C,N]=useState(0),[T,k]=useState(null),[v,E]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:i,ghostWidth:c,setGhostWidth:l,connectionLine:m,setConnectionLine:d,hoveredTaskId:p,setHoveredTaskId:g,activeZone:y,setActiveZone:x,draggedSegmentIndex:h,setDraggedSegmentIndex:f,draggedSegmentStartX:b,setDraggedSegmentStartX:w,segmentDragOffsetX:C,setSegmentDragOffsetX:N,hoveredSegmentIndex:T,setHoveredSegmentIndex:k,isHovered:v,setIsHovered:E,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(H,F)=>{r("none"),d(null),g(null),i(H),l(F),N(0),f(null),w(0);}}}function ki({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:i,onClick:c,onDoubleClick:l,onContextMenu:m,onDateChange:d,onDependencyCreate:p,allTaskPositions:g=[],onDragMove:y,onHoverChange:x,showBaseline:h,showTaskBarLabels:f=true,showCriticalPath:b=true,readOnly:w=false}){let C=mm(t,r),N=useRef(null),T=useRef(false),k=useRef(null),v=useRef(null),{dragMode:E,setDragMode:I,dragOffset:D,setDragOffset:X,ghostX:O,setGhostX:H,ghostWidth:F,setGhostWidth:Y,connectionLine:Z,setConnectionLine:Se,hoveredTaskId:R,setHoveredTaskId:_,activeZone:he,setActiveZone:Je,draggedSegmentIndex:z,setDraggedSegmentIndex:re,draggedSegmentStartX:J,setDraggedSegmentStartX:Pe,segmentDragOffsetX:ve,setSegmentDragOffsetX:We,hoveredSegmentIndex:Re,setHoveredSegmentIndex:st,isHovered:ee,setIsHovered:it,isDragging:le,isResizing:ot,isConnecting:yt,resetDragState:Pt}=C,ke=18,xt=!!o.executionBarBg,ct=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",rt=xt?3:6,$=e.subtasks&&e.subtasks.length>0,de=e.endDate&&(()=>{let L=new Date;L.setHours(0,0,0,0);let j=new Date(e.endDate);return j.setHours(0,0,0,0),j<L})()&&e.progress<100,S=b&&e.isCriticalPath,q=o.name==="neutral"||o.today==="#1C1917",ce=e.status==="completed"||e.progress===100,Ce={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},te=b&&e.isCriticalPath||de?"#EF4444":e.color?e.color:e.priority&&Ce[e.priority]?Ce[e.priority]:o.taskBarPrimary,Ge=w?"default":le?yt?"crosshair":ot?"ew-resize":"grabbing":"grab",Te=w?"default":"ew-resize",Ne=(L=>L>=80?20:L>=60?15:L>=50?12:10)(r),Ve=r<50,Tt=r<40;useEffect(()=>{x&&(!ee||le||e.segments)&&x(null);},[ee,le,e.segments,x]);let gt=L=>L.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),nt=()=>{let L=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${L} day${L!==1?"s":""}`},et=L=>Math.round(L/s)*s,qt=L=>{let j=Math.round(L/s),K=new Date(n);return K.setDate(K.getDate()+j),K},At=(L,j)=>{for(let K of g){if(K.id===e.id)continue;let me=5;if(L>=K.x-me&&L<=K.x+K.width+me&&j>=K.y-me&&j<=K.y+K.height+me)return K.id}return null},vt=useCallback((L,j,K)=>{if(w)return;L.preventDefault(),L.stopPropagation();let me=N.current?.ownerSVGElement;if(!me)return;let Me=me.createSVGPoint();Me.x=L.clientX,Me.y=L.clientY;let qe=Me.matrixTransform(me.getScreenCTM()?.inverse()),_e=K!==void 0?K:t,Ie=j;if(!Ie){let bt=qe.x-_e;L.shiftKey?(Ie="connect",Se({x:t+r,y:a+ke/2})):L.ctrlKey||L.metaKey?Ie="move":L.altKey?Ie=bt<r/2?"resize-start":"resize-end":Tt?bt<r/2?Ie="move":Ie="resize-end":Ve?bt<=Ne/2?Ie="resize-start":bt>=r-Ne/2?Ie="resize-end":Ie="move":bt<=Ne?Ie="resize-start":bt>=r-Ne?Ie="resize-end":Ie="move";}T.current=false,I(Ie),it(false),Je(null),Ie==="move"?X(qe.x-_e):Ie==="connect"?Se({x:t+r,y:a+ke/2}):X(0),H(_e),Y(r);},[t,r,a,ke,w]),Dt=useCallback(L=>{let j=N.current?.ownerSVGElement;if(!j)return;let K=j.closest(".gantt-timeline-scroll");if(!K)return;let me=K.getBoundingClientRect(),Me=60,qe=15,_e=0;if(L.clientX<me.left+Me){let Ie=me.left+Me-L.clientX;_e=-Math.min(qe,Ie/2);}else if(L.clientX>me.right-Me){let Ie=L.clientX-(me.right-Me);_e=Math.min(qe,Ie/2);}return _e!==0&&(K.scrollLeft+=_e),_e!==0},[]),ft=useCallback(L=>{if(E==="none")return;T.current=true,v.current=L;let j=N.current?.ownerSVGElement;if(!j)return;if(E==="move"||E==="resize-start"||E==="resize-end"){let Me=Dt(L);Me&&!k.current?k.current=window.setInterval(()=>{v.current&&(Dt(v.current),ft(v.current));},16):!Me&&k.current&&(window.clearInterval(k.current),k.current=null);}let K=j.createSVGPoint();K.x=L.clientX,K.y=L.clientY;let me=K.matrixTransform(j.getScreenCTM()?.inverse());if(E==="connect"){Se({x:me.x,y:me.y});let Me=At(me.x,me.y);_(Me);}else if(E==="move"){let Me=me.x-D,qe=et(Me);H(qe),Y(r);let _e=Math.round((qe-t)/s);if(y?.(e.id,_e,true),e.segments&&e.segments.length>0&&z!==null){let Ie=qe-J;We(Ie);}}else if(E==="resize-start"){let Me=me.x,qe=et(Me),_e=t+r-qe;_e>=s&&(H(qe),Y(_e));}else if(E==="resize-end"){let Me=me.x,_e=et(Me)-t;_e>=s&&Y(_e);}},[E,t,r,s,D,e,et,z,J,At,_,Se,H,Y,We,y,Dt]),Wt=useCallback(()=>{if(k.current&&(window.clearInterval(k.current),k.current=null),v.current=null,E!=="none"){if(E==="connect")R&&p&&p(e,R),Se(null),_(null);else {let L=e.endDate.getTime()-e.startDate.getTime(),j,K,me=true;if(E==="move"){if(j=qt(O),K=new Date(j.getTime()+L),e.segments&&e.segments.length>0&&z!==null){let Me=Math.round(ve/s),qe=e.segments.map((Nt,Ut)=>{if(Ut===z){let Ta=new Date(Nt.startDate),ta=new Date(Nt.endDate);return Ta.setDate(Ta.getDate()+Me),ta.setDate(ta.getDate()+Me),{startDate:Ta,endDate:ta}}return Nt}),_e=qe.flatMap(Nt=>[Nt.startDate,Nt.endDate]),Ie=new Date(Math.min(..._e.map(Nt=>Nt.getTime()))),bt=new Date(Math.max(..._e.map(Nt=>Nt.getTime())));d?.({...e,segments:qe},Ie,bt),Pt(t,r);return}}else E==="resize-start"?(j=qt(O),K=e.endDate,j>K&&(console.warn("Invalid date range: start date must be before or equal to end date"),me=false)):E==="resize-end"?(j=e.startDate,K=qt(O+F),K.setDate(K.getDate()-1),K<j&&(console.warn("Invalid date range: end date must be after or equal to start date"),me=false)):me=false;me&&j&&K&&(K.getTime()<j.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,j,K));}y?.(e.id,0,false),Pt(t,r);}},[E,O,F,e,d,R,p,t,r,s,qt,ve,z,Pt,y]);useEffect(()=>{if(E==="none")return;let L=K=>{ft(K);},j=()=>{Wt();};return window.addEventListener("mousemove",L),window.addEventListener("mouseup",j),()=>{window.removeEventListener("mousemove",L),window.removeEventListener("mouseup",j),k.current&&(window.clearInterval(k.current),k.current=null);}},[E,ft,Wt]);let Oe=le&&!yt?O:t,Le=le&&!yt?F:r,ut=i.taskClass(e),ne=24,fe=b?e.isCriticalPath?1:.25:1;return jsxs("g",{ref:N,"data-task-bar":"true",style:{opacity:fe,transition:"opacity 300ms ease"},onClick:()=>{!le&&!T.current&&c?.(e),T.current=false;},onDoubleClick:L=>{!le&&!T.current&&(L.stopPropagation(),l?.(e));},onContextMenu:L=>{L.preventDefault(),m?.(e,L);},onMouseEnter:()=>!le&&it(true),onMouseMove:L=>{x&&ee&&!le&&!e.segments&&x({task:e,x:t,y:a,width:r,height:ke,showBelow:false,mouseX:L.clientX,mouseY:L.clientY});},onMouseLeave:()=>{le||(it(false),Je(null));},children:[jsx("rect",{x:t,y:a,width:r+ne,height:ke,fill:"transparent",style:{pointerEvents:"all"}}),ee&&!le&&!Ve&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Ne,height:ke,fill:he==="resize-start"?o.accent:"transparent",opacity:he==="resize-start"?.15:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>Je("resize-start"),onMouseDown:L=>vt(L,"resize-start")}),jsx("rect",{x:t+Ne,y:a,width:r-Ne*2,height:ke,fill:he==="move"?o.accent:"transparent",opacity:he==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Je("move"),onMouseDown:L=>vt(L,"move")}),jsx("rect",{x:t+r-Ne,y:a,width:Ne,height:ke,fill:he==="resize-end"?o.accent:"transparent",opacity:he==="resize-end"?.15:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>Je("resize-end"),onMouseDown:L=>vt(L,"resize-end")})]}),ee&&!le&&Tt&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:ke,fill:he==="move"?o.accent:"transparent",opacity:he==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Je("move"),onMouseDown:L=>vt(L,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:ke,fill:he==="resize-end"?o.accent:"transparent",opacity:he==="resize-end"?.2:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>Je("resize-end"),onMouseDown:L=>vt(L,"resize-end")}),ee&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ke-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),le&&!yt&&!e.segments&&jsx(motion.rect,{x:O,y:a,width:F,height:ke,rx:rt,fill:o.accent,opacity:.15,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),h&&e.baselineStartDate&&e.baselineEndDate&&!le&&(()=>{let L=e.baselineStartDate.getTime(),j=e.baselineEndDate.getTime(),K=n.getTime(),me=864e5,Me=(L-K)/me,qe=(j-L)/me,_e=Me*s,Ie=Math.max(qe*s,s),bt=Oe+Le,Nt=_e+Ie,Ut=e.endDate?.getTime()??0,Ta=Math.ceil((Ut-j)/me),ta=Ta>0,U=Ta<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:_e,y:a,width:Ie,height:ke,rx:rt,fill:"none",stroke:ct?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),ta&&bt>Nt&&jsx("rect",{x:Nt,y:a,width:bt-Nt,height:ke,rx:0,fill:"#EF4444",opacity:.2}),ta&&jsxs("text",{x:Math.max(bt,Nt)+6,y:a+ke/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Ta,"d"]}),U&&jsxs("text",{x:bt+6,y:a+ke/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Ta,"d"]})]})})(),!e.segments&&xt&&$&&(()=>{let j=a+(ke-8)/2,K=4,me=e.progress||0,Me=new Date;Me.setHours(0,0,0,0);let qe=e.startDate&&Me>=e.startDate,_e=e.endDate&&(()=>{let ta=new Date(e.endDate);return ta.setHours(0,0,0,0),Me>ta})(),Ie=e.startDate&&Me<e.startDate,bt=1;if(qe&&e.startDate&&e.endDate&&!Ie){let ta=new Date(e.startDate);ta.setHours(0,0,0,0);let U=new Date(e.endDate);U.setHours(0,0,0,0);let oe=Math.max(1,(U.getTime()-ta.getTime())/(1e3*60*60*24)),A=Math.min((Me.getTime()-ta.getTime())/(1e3*60*60*24),oe)/oe*100;bt=A>0?me/A:1;}let Nt;me>=100?Nt="#00E5CC":Ie?Nt="#4B5563":_e&&me<100?Nt="#EF4444":bt>=.95?Nt="#22C55E":bt>=.8?Nt="#F59E0B":Nt="#EF4444";let Ut=Math.max(me/100*Le,me>0?K*2:0),Ta=Le>100&&me>0;return jsxs("g",{"data-task-class":ut,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:Oe,y:j,width:Le,height:8,rx:K,fill:"rgba(255,255,255,0.10)"}),me>0&&jsx("rect",{x:Oe,y:j,width:Ut,height:8,rx:K,fill:Nt}),Ta&&jsxs("text",{x:Oe+Ut+6,y:j+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(me),"%"]})]})})(),!e.segments&&xt&&!$&&jsx(motion.rect,{x:Oe,y:a,width:Le,height:ke,rx:rt,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":ut,initial:{opacity:0,scale:.95},animate:{opacity:le&&!yt?.15:e.parentId?.6:1,scale:ee&&!le?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:L=>vt(L),style:{cursor:Ge,pointerEvents:"all"}}),!e.segments&&!xt&&jsx(motion.rect,{x:Oe,y:a,width:Le,height:ke,rx:rt,fill:te,"data-task-class":ut,initial:{opacity:0,scale:.95},animate:{opacity:le&&!yt?.15:e.parentId?.6:ee?.9:.8,scale:ee&&!le?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:$?void 0:L=>vt(L),style:{cursor:$?"default":Ge,pointerEvents:"all"}}),xt&&(de||S)&&!e.segments&&jsx("rect",{x:Oe,y:a,width:Le,height:ke,rx:rt,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&e.progress>0&&!$&&jsx("rect",{x:Oe,y:a,width:Math.max(Le*(e.progress/100),rt*2),height:ke,rx:rt,fill:te,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!$&&e.progress<100&&(()=>{let L=e.progress>0?Le*(e.progress/100):0,j=Oe+L,K=Le-L,me=e.progress===0?rt:0,Me=e.progress===0?Oe:j,qe=e.progress===0?Le:K;return jsxs(Fragment,{children:[jsx("rect",{x:Me,y:a,width:qe,height:ke,rx:me,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:Me,y:a,width:qe,height:ke,rx:me,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),xt&&!e.segments&&e.progress>0&&e.progress<100&&!$&&!le&&(()=>{let L=Oe+Le*(e.progress/100),j=8,K=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:L,cy:a+ke/2,r:j,fill:K?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:L,y:a+ke/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:K?.initials||K?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((L,j)=>{let K=(L.startDate.getTime()-n.getTime())/864e5*s,Me=(L.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-K+s,qe=le&&E==="move"&&z===j,_e=Re===j,Ie=qe?K+ve:K;return jsxs("g",{onMouseEnter:()=>!le&&st(j),onMouseLeave:()=>!le&&st(null),children:[jsx(motion.rect,{x:Ie,y:a,width:Me,height:ke,rx:rt,fill:te,initial:{opacity:0,scale:.95},animate:{opacity:qe||e.parentId?.6:_e?.9:.8,scale:_e&&!le?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:bt=>{bt.stopPropagation(),re(j),Pe(K),vt(bt,void 0,K);},style:{cursor:Ge,pointerEvents:"all"}}),jsx("rect",{x:Ie,y:a,width:Me*(e.progress/100),height:ke,rx:rt,fill:te,opacity:1,style:{pointerEvents:"none"}})]},`segment-${j}`)}),q&&(de||S)&&!e.segments&&jsxs(Fragment,{children:[S&&!de&&jsx("rect",{x:Oe,y:a,width:Le,height:ke,rx:rt,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),de&&jsx("rect",{x:Oe,y:a,width:Le,height:ke,rx:rt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&Le>60&&!e.segments&&!(xt&&$)&&(()=>{let L=i.taskLabel(e),j=typeof L=="string"?L:e.name,K=j.length>Math.floor(Le/8)?`${j.substring(0,Math.floor(Le/8))}...`:j;return jsx("text",{x:Oe+8,y:a+ke/2,dominantBaseline:"middle",fill:ce?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ce?"line-through":"none"},children:K})})(),!le&&!e.segments&&!$&&e.progress>0&&e.progress<100&&(xt?jsxs("text",{x:Oe+Le+6,y:a+ke/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Le>100?jsxs("text",{x:Oe+Le-12,y:a+ke/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&Le>80&&!le&&!e.segments&&!(xt&&$)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Oe+Le-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Oe+Le-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ee||ot)&&!yt&&!e.segments&&!$&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Oe-2,y:a,width:16,height:ke,fill:"transparent",style:{cursor:Te},onMouseEnter:()=>Je("resize-start"),onMouseLeave:()=>Je(null),onMouseDown:L=>{L.stopPropagation(),vt(L,"resize-start");}}),jsx(motion.rect,{x:Oe+4,y:a+8,width:3,height:ke-16,rx:1.5,fill:he==="resize-start"||E==="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:Oe+Le-14,y:a,width:16,height:ke,fill:"transparent",style:{cursor:Te},onMouseEnter:()=>Je("resize-end"),onMouseLeave:()=>Je(null),onMouseDown:L=>{L.stopPropagation(),vt(L,"resize-end");}}),jsx(motion.rect,{x:Oe+Le-7,y:a+8,width:3,height:ke-16,rx:1.5,fill:he==="resize-end"||E==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:ee&&!le&&!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+ke/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Je("connect"),onMouseLeave:()=>Je(null),onMouseDown:L=>{L.stopPropagation(),vt(L,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+ke/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:he==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),yt&&Z&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+ke/2,x2:Z.x,y2:Z.y,stroke:R?o.statusCompleted:o.accent,strokeWidth:R?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:R?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:Z.x,cy:Z.y,r:R?8:6,fill:R?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),R&&jsx(motion.text,{x:Z.x+15,y:Z.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Z.x+10},animate:{opacity:1,x:Z.x+15},transition:{duration:.2},children:"Connect"})]}),(ee||le)&&!yt&&!e.segments&&jsx(motion.rect,{x:Oe-1,y:a-1,width:Le+2,height:ke+2,rx:rt+1,fill:"none",stroke:le?o.accent:xt?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:xt?1:2,opacity:le||xt?.6:.4,initial:{opacity:0},animate:{opacity:le||xt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ot&&jsxs(Fragment,{children:[jsx("line",{x1:O,y1:0,x2:O,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:O+F,y1:0,x2:O+F,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:ee&&!le&&!e.segments&&!x&&(()=>{let K=a<100,me=K?a+ke+13:a-82-13,Me=K?`M ${Oe+Le/2-6} ${a+ke+3} L ${Oe+Le/2} ${a+ke+13} L ${Oe+Le/2+6} ${a+ke+3}`:`M ${Oe+Le/2-6} ${a-13} L ${Oe+Le/2} ${a-3} L ${Oe+Le/2+6} ${a-13}`,qe=me+22,_e=me+40,Ie=me+55,bt=me+70,Nt=K?me+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:K?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:K?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:Me,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Oe+Le/2-120,y:me,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:Oe+Le/2,y:qe,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:Oe+Le/2-110,y:_e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Oe+Le/2-70,y:_e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:gt(e.startDate)}),jsx("text",{x:Oe+Le/2-110,y:Ie,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Oe+Le/2-70,y:Ie,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:gt(e.endDate)}),jsx("text",{x:Oe+Le/2+10,y:_e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Oe+Le/2+65,y:_e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:nt()}),jsx("text",{x:Oe+Le/2+10,y:Ie,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Oe+Le/2+65,y:Ie,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:Oe+Le/2-110,y:bt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Oe+Le/2-50,y:bt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Ut=>Ut.name).join(", ").substring(0,30),e.assignees.map(Ut=>Ut.name).join(", ").length>30?"...":""]})]}),!K&&jsx("text",{x:Oe+Le/2,y:Nt,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Tt?"Left: move \u2022 Right: resize":Ve?"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 Pd=260,Ln=8,bm=16,Tv=-12;function hm({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=useState(null);if(useLayoutEffect(()=>{if(!e){o(null);return}let{task:b,mouseX:w,mouseY:C}=e,T=b.effortMinutes!=null||b.timeLoggedMinutes!=null||b.soldEffortMinutes!=null?155:105,k=w+bm,v=C+Tv-T;k+Pd>window.innerWidth-Ln&&(k=w-Pd-bm),k<Ln&&(k=Ln);let E=v<Ln;E&&(v=C+20),v+T>window.innerHeight-Ln&&(v=window.innerHeight-Ln-T),o({left:k,top:v,showBelow:E});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,i={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"},c=b=>b.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),l=()=>{if(!s.startDate||!s.endDate)return "N/A";let b=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${b} d\xEDa${b!==1?"s":""}`:`${b} day${b!==1?"s":""}`},m=b=>{if(b==null||b===0)return "N/A";let w=Math.floor(b/60),C=b%60;return w===0?`${C}m`:C===0?`${w}h`:`${w}h ${C}m`},d=t.textTertiary||"#9CA3AF",p=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",y=t.accent||"#3B82F6",x=t.bgSecondary||"#1F2937",h=t.border||"#374151",f=jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:Pd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:x,border:`1px solid ${h}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(Ci,{label:i.start,value:s.startDate?c(s.startDate):"N/A",labelColor:d,valueColor:p}),jsx(Ci,{label:i.duration,value:l(),labelColor:d,valueColor:p}),jsx(Ci,{label:i.end,value:s.endDate?c(s.endDate):"N/A",labelColor:d,valueColor:p}),jsx(Ci,{label:i.progress,value:`${s.progress}%`,labelColor:d,valueColor:p})]}),s.assignees&&s.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:d},children:[i.assignees,": "]}),jsx("span",{style:{color:p,fontWeight:500},children:s.assignees.map(b=>b.name).join(", ")})]}),n&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[s.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[i.estimated,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:m(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[i.logged,":"]})," ",jsx("span",{style:{color:y,fontWeight:600},children:m(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[i.quoted,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:m(s.soldEffortMinutes)})]})]})]}),jsx("style",{children:`
|
|
125
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function dd({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function i(m){s.current&&!s.current.contains(m.target)&&n.current&&!n.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},c=e.reduce((i,m)=>{let d=m.category||"Other";return i[d]||(i[d]=[]),i[d].push(m),i},{});return jsxs("div",{className:u("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:u("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,m])=>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:m.map(d=>jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function ud({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=useState("export"),[c,i]=useState("json"),[m,d]=useState(null),p=useRef(null);if(!t)return null;let g=async()=>{let x=o?.current||void 0,h=await iu(e,c,x);lu(h,c);},y=async x=>{let h=x.target.files?.[0];if(h){try{let f=await uu(h),b=h.name.endsWith(".json")?"json":"csv",w=cu(f,b);d(w),w.success&&r&&r(w,f);}catch(f){d({success:false,errors:[`Failed to read file: ${f instanceof Error?f.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxs("div",{className:u("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:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>l("import"),className:u("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[n==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxs("button",{onClick:()=>i(x),className:u("p-4 rounded-lg border-2 transition-all text-center",c===x?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:g,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:p,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxs("button",{onClick:()=>p.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),m&&jsxs("div",{className:u("p-4 rounded-lg",m.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:u("font-semibold mb-2",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:m.errors.map((x,h)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},h))})]})]})]})]})]})}var Jy=["URGENT","HIGH","MEDIUM","LOW"],Qy=[{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"}],Zy=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function pd({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:m=[],showQuickFilters:d=true,compact:p=false,groupBy:g="none",onGroupByChange:y}){let[x,h]=useState(true),f=useCallback(T=>{a({search:T.target.value});},[a]),b=useCallback(T=>{a({dateFilter:T.target.value});},[a]),w=useCallback(T=>{r({by:T.target.value});},[r]),C=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${p?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>h(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),N&&jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!x&&jsxs("div",{className:"filter-bar__content",children:[d&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:f,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:b,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:T=>{let k=T.target.value;a({priorities:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Jy.map(T=>jsx("option",{value:T,children:T},T))]})}),c.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:T=>{let k=T.target.value;a({assignees:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),c.map(T=>jsx("option",{value:T.id,children:T.name},T.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:T=>{let k=T.target.value;a({labels:k==="all"?[]:[k]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(T=>jsx("option",{value:T,children:T},T))]})}),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:w,className:"filter-bar__select filter-bar__select--sm",children:Qy.map(T=>jsx("option",{value:T.value,children:T.label},T.value))}),t.by!=="none"&&jsx("button",{onClick:C,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:g,onChange:T=>y(T.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Zy.map(T=>jsx("option",{value:T.value,children:T.label},T.value))})}),N&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function md({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,m]=useState(false),d=useRef(null);useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&m(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let p=g=>{g(),m(false);};return jsxs("div",{className:u("relative",r),ref:d,children:[jsxs("button",{onClick:()=>m(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>p(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>p(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>p(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>p(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>p(()=>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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>p(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxs("button",{onClick:()=>p(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var gd={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:"#2E94FF",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"}},fd={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:"#2E94FF",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},bd={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},en={dark:gd,light:fd,neutral:bd},fi="dark";var bi=createContext(void 0),dx="asakaa-theme";function Hp({children:e,defaultTheme:t=fi,storageKey:a=dx}){let[r,o]=useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=en[r];Object.entries(c.colors).forEach(([m,d])=>{d&&l.style.setProperty(`--theme-${cx(m)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([m,d])=>{let p=c.colors[m];p&&l.style.setProperty(d,p);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:en};return jsx(bi.Provider,{value:n,children:e})}function Sn(){let e=useContext(bi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function cx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function hd({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Sn();return e?jsxs("div",{className:u("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(en).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:u("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:n.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function zp(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ht[e]||ht.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",ht[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",ht[e].bgSecondary),bgGrid:r("--theme-bg-card",ht[e].bgGrid),bgWeekend:r("--theme-bg-hover",ht[e].bgWeekend),border:r("--theme-border-primary",ht[e].border),borderLight:r("--theme-border-subtle",ht[e].borderLight),textPrimary:r("--theme-text-primary",ht[e].textPrimary),textSecondary:r("--theme-text-secondary",ht[e].textSecondary),textTertiary:r("--theme-text-tertiary",ht[e].textTertiary),accent:r("--theme-accent-primary",ht[e].accent),accentHover:r("--theme-accent-hover",ht[e].accentHover),accentLight:r("--theme-accent-primary",ht[e].accentLight),taskBarPrimary:r("--theme-accent-primary",ht[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",ht[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",ht[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",ht[e].dependency),dependencyHover:r("--theme-border-secondary",ht[e].dependencyHover),criticalPath:r("--theme-error",ht[e].criticalPath),criticalPathLight:r("--theme-error",ht[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",ht[e].today):e==="neutral"?r("--theme-text-primary",ht[e].today):r("--theme-error",ht[e].today),todayLight:e==="light"?r("--theme-accent-primary",ht[e].todayLight):e==="neutral"?r("--theme-text-primary",ht[e].todayLight):r("--theme-error",ht[e].todayLight),milestone:r("--theme-warning",ht[e].milestone),milestoneLight:r("--theme-warning",ht[e].milestoneLight),statusTodo:r("--theme-text-tertiary",ht[e].statusTodo),statusInProgress:r("--theme-accent-primary",ht[e].statusInProgress),statusCompleted:r("--theme-success",ht[e].statusCompleted),hoverBg:r("--theme-bg-hover",ht[e].hoverBg),focusRing:r("--theme-accent-primary",ht[e].focusRing),...ht[e].dotGrid&&{dotGrid:ht[e].dotGrid},...ht[e].glassHeader&&{glassHeader:ht[e].glassHeader},...ht[e].glassToolbar&&{glassToolbar:ht[e].glassToolbar},...ht[e].forecastHud&&{forecastHud:ht[e].forecastHud},...ht[e].neonRedGlow&&{neonRedGlow:ht[e].neonRedGlow},...ht[e].executionBarBg&&{executionBarBg:ht[e].executionBarBg}}}var hi={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"}},Up={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"}},yd={en:hi,es:Up};function Wp(e){return yd[e]||yd.en}function xd(e,t){let a=Wp(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 Mn=createContext(hi);function Rr(){return useContext(Mn)}function ms(e,t,a="left",r=208){let[o,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let n=e.current.getBoundingClientRect(),l=n.bottom+4,c;a==="right"?c=n.right-r:c=n.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]),o}function Jp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,c]=useState(false),[i,m]=useState(null),d=useRef(null),p=useRef(null),g=Rr(),y=ms(d,l,"right",176);if(useEffect(()=>{if(!l)return;let b=w=>{let C=w.target;d.current&&!d.current.contains(C)&&p.current&&!p.current.contains(C)&&c(false);};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[l]),!(t||a||r||o||s||n))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:o},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:n}].filter(b=>b.handler),f=async(b,w)=>{if(w){m(b);try{await w();}catch(C){console.error(`Export ${b} failed:`,C);}finally{m(null),c(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:d,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:g.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:l&&jsx(motion.div,{ref:p,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-44 rounded-xl overflow-hidden",style:{top:y.top,left:y.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((b,w)=>jsxs(motion.button,{onClick:()=>f(b.id,b.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:w<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:w*.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===b.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"})}):b.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:b.label}),jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:b.description})]})]},b.id))})})}),document.body)]})}function Vp({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:o,onCopySnapshotLink:s}){let[n,l]=useState(false),[c,i]=useState(null),[m,d]=useState(false),p=useRef(null),g=useRef(null),y=Rr(),x=ms(p,n,"right",224),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",f=y.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!n)return;let N=T=>{let k=T.target;p.current&&!p.current.contains(k)&&g.current&&!g.current.contains(k)&&l(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[n]);let b=[{id:"png",label:y.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:y.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:y.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:y.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:o}].filter(N=>N.handler),w=async(N,T)=>{if(T){i(N);try{await T();}catch(k){console.error(`Export ${N} failed:`,k);}finally{i(null),l(false);}}},C=()=>{s?.(),d(true),setTimeout(()=>d(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:p,onClick:()=>l(!n),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:n?e.accent:e.textTertiary,backgroundColor:n?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:y.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:n&&jsxs(motion.div,{ref:g,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:x.top,left:x.left,zIndex:99999,backgroundColor: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:[b.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:f?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:b.map((N,T)=>jsxs(motion.button,{onClick:()=>w(N.id,N.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:T*.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===N.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):N.icon}),jsx("span",{className:"flex-1 text-left",children:N.label})]},N.id))})]}),b.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:f?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:C,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:b.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:m?"rgba(34,197,94,0.15)":e.accentLight,color:m?"#22C55E":e.accent},children:m?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:m?y.toolbar.copied:y.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Lx({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxs(motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsx(motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Ix({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxs(motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-[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:o.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function jp({theme:e,value:t,onChange:a,maxDepth:r}){let[o,s]=useState(false),n=useRef(null),l=useRef(null),c=Rr(),i=ms(n,o,"left");useEffect(()=>{if(!o)return;let p=g=>{let y=g.target;n.current&&!n.current.contains(y)&&l.current&&!l.current.contains(y)&&s(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]);let m=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(p,g)=>({value:g+1,label:`L${g+1}`}))],d=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:n,onClick:()=>s(!o),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:o?e.accentLight:e.bgSecondary,border:`1px solid ${o?e.accent:e.borderLight}`,color:o?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${d}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:d})]}),createPortal(jsx(AnimatePresence,{children:o&&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:m.map((p,g)=>{let y=t===p.value;return jsxs(motion.button,{onClick:()=>{a(p.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:y?e.accentLight:"transparent",borderBottom:g<m.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:y?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsx("span",{className:"text-[11px]",style:{color:y?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:y?600:500},children:p.label}),y&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(p.value))})})})}),document.body)]})}function _p({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),l=useRef(null),c=useRef(null),i=Rr(),m=ms(l,s,"left");useEffect(()=>{if(!s)return;let y=setTimeout(()=>{let x=f=>{let b=f.target;l.current&&!l.current.contains(b)&&c.current&&!c.current.contains(b)&&n(false);},h=f=>{f.key==="Escape"&&n(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(y),c._cleanup&&c._cleanup();}},[s]);let d=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}),color:"text-[#2E94FF]"},{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-blue-500"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],p=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:l,onClick:y=>{y.stopPropagation(),n(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:p?g?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${p?g?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:p?"#2E94FF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children:i.toolbar.filter||"Filters"}),p&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#2E94FF"}})]}),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:m.top,left:m.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:d.map(y=>{let x=t===y.value&&!r,h=()=>y.value==="all"?x?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#2E94FF] bg-[#2E94FF]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):y.icon;return jsxs(motion.button,{onClick:()=>{a(y.value),o&&o(false),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:x?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${x?y.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:y.label}),x&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]},y.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),o&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#2E94FF":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#2E94FF"}})]})})]})}),document.body)]})}function Bx({value:e,onChange:t,theme:a}){let r=Rr(),o=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:o?"#000000":a.bgSecondary,border:`1px solid ${o?"rgba(255,255,255,0.1)":a.border}`},children:s.map(n=>{let l=e===n.value;return jsx(motion.button,{onClick:()=>t(n.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:l?o?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:l?o?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:o?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:n.label},n.value)})})}function Rx({theme:e,forecast:t}){let a=Rr(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",o=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,n=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,m=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,d=t?.costAtCompletion,p=t?.currency||"$",g=d!=null?d>=1e6?`${p}${(d/1e6).toFixed(2)}M`:d>=1e3?`${p}${(d/1e3).toFixed(1)}K`:`${p}${d.toFixed(0)}`:"\u2014",y=t?.budgetVariancePercent,x=y!=null&&y!==0,h=y!=null?y>0?`+${y.toFixed(0)}% ${a.toolbar.budgetOver}`:`${y.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,f=y!=null&&y>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:y!=null&&y<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,": ",o]}),n&&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"},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:m,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),x&&h&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:f.bg,color:f.text,fontFamily:"'JetBrains Mono', monospace"},children:h})]})]})]})}function Ox({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:o,highlightWeekends:s,onHighlightWeekendsChange:n,showDependencies:l,onShowDependenciesChange:c,rowDensity:i,onRowDensityChange:m,hasDependencies:d=true}){let[p,g]=useState(false),y=useRef(null),x=useRef(null),h=Rr(),f=ms(y,p,"right",208),b=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!p)return;let T=k=>{let v=k.target;y.current&&!y.current.contains(v)&&x.current&&!x.current.contains(v)&&g(false);};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[p]);let w=h.toolbar.visibility==="Visibilidad",C=[{key:"criticalPath",label:w?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a,disabled:!d,tooltip:d?void 0:w?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:w?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:o},{key:"weekends",label:w?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:n},{key:"dependencies",label:w?"Dependencias":"Dependencies",icon:GitBranch,active:l,onChange:c}],N=[{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:y,onClick:()=>g(!p),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:p?e.accent:e.textTertiary,backgroundColor:p?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:h.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:p&&jsxs(motion.div,{ref:x,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:b?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${b?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:b?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:C.map((T,k)=>{let v=T.icon,E=T.disabled,I=T.tooltip;return jsxs(motion.button,{onClick:()=>!E&&T.onChange?.(!T.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:E?b?"rgba(255,255,255,0.3)":"#9CA3AF":b?"rgba(255,255,255,0.85)":"#111827",cursor:E?"not-allowed":"pointer"},whileHover:E?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:k*.03},title:I,children:[jsx(v,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:E?b?"rgba(255,255,255,0.2)":"#D1D5DB":T.active?e.accent||"#2E94FF":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:T.label}),T.active&&!E&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},T.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:b?"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:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),N.map((T,k)=>{let v=i===T.value;return jsxs(motion.button,{onClick:()=>m(T.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:b?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(C.length+k)*.03},children:[jsx("span",{style:{color:v?e.accent||"#2E94FF":b?"rgba(255,255,255,0.85)":e.textPrimary},children:T.label}),v&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#2E94FF"}})]},T.value)})]})]})}),document.body)]})}function yi({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:c,showThemeSelector:i=false,showCreateTaskButton:m=false,createTaskLabel:d,onCreateTask:p,taskFilter:g="all",onTaskFilterChange:y,hideCompleted:x=false,onHideCompletedChange:h,toolbarRightContent:f,wbsLevel:b,onWbsLevelChange:w,maxWbsDepth:C=4,viewMode:N="execution",onViewModeChange:T,projectForecast:k,onExportPNG:v,onExportPDF:E,onExportExcel:I,onExportCSV:S,onExportJSON:X,onExportMSProject:O,showCriticalPath:$=true,onShowCriticalPathChange:F,showDependencies:Y=true,onShowDependenciesChange:Z,highlightWeekends:Ee=true,onHighlightWeekendsChange:R,showBaseline:_=false,onShowBaselineChange:ye,onCopySnapshotLink:Je,hasDependencies:z=true}){let re=Rr(),J=v||E||I||S||X||O,Ae=!!e.glassToolbar,[ve,ze]=useState(false),Be=useRef(null);useEffect(()=>{ve&&Be.current&&Be.current.focus();},[ve]);let st=[{value:"day",label:re.toolbar.day},{value:"week",label:re.toolbar.week},{value:"month",label:re.toolbar.month}],ee=[{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"})}],it=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Ae){let de=it?"rgba(255,255,255,0.08)":e.borderLight;return jsxs("div",{className:"flex flex-col",children:[jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsxs(motion.div,{className:"flex items-center rounded-full overflow-hidden",style:{backgroundColor:it?"#1A1A1A":e.bgSecondary,border:`1px solid ${it?"rgba(255,255,255,0.08)":e.border}`},animate:{width:ve?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsx(motion.button,{onClick:()=>ze(!ve),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsx(Search,{className:"w-4 h-4"})}),ve&&jsx("input",{ref:Be,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>ze(false),onKeyDown:lt=>{lt.key==="Escape"&&ze(false);}})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:de}}),T&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:it?"#000000":e.bgSecondary,border:`1px solid ${it?"rgba(255,255,255,0.08)":e.border}`},children:[jsx(motion.button,{onClick:()=>T("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="execution"?it?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:N==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="execution"?{color:e.textSecondary}:{},children:re.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>T("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="oracle"?it?"rgba(46,148,255,0.15)":"rgba(37,99,235,0.08)":"transparent",color:N==="oracle"?"#2E94FF":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="oracle"?{color:e.textSecondary}:{},children:re.toolbar.viewOracle})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Bx,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:de}}),w&&jsx(jp,{theme:e,value:b??"all",onChange:w,maxDepth:C}),y&&jsx(_p,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:de}}),f]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:de}}),jsx(Ox,{theme:e,showCriticalPath:$,onShowCriticalPathChange:F,showBaseline:_,onShowBaselineChange:ye,highlightWeekends:Ee,onHighlightWeekendsChange:R,showDependencies:Y,onShowDependenciesChange:Z,rowDensity:l,onRowDensityChange:c,hasDependencies:z}),jsx(Vp,{theme:e,onExportPNG:v,onExportPDF:E,onExportExcel:I,onExportMSProject:O,onCopySnapshotLink:Je}),m&&p&&jsxs(motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${it?"rgba(46,148,255,0.3)":"rgba(37,99,235,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${it?"rgba(46,148,255,0.4)":"rgba(37,99,235,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||re.toolbar.createTask})]})]})]}),k&&jsx(Rx,{theme:e,forecast:k})]})}return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx(Ix,{options:st,value:t,onChange:de=>a(de),theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsx(motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),w&&jsx(jp,{theme:e,value:b??"all",onChange:w,maxDepth:C}),y&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(_p,{theme:e,value:g,onChange:y,hideCompleted:x,onHideCompletedChange:h})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[f&&jsxs(Fragment,{children:[f,jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),m&&p&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||re.toolbar.createTask})]}),(J||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(Vp,{theme:e,onExportPNG:v,onExportPDF:E,onExportExcel:I,onExportMSProject:O,onCopySnapshotLink:Je}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsx(Lx,{options:ee,value:s,onChange:de=>n(de),theme:e})]})]})}function xi({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),l=useRef(null),c=useRef(null);useEffect(()=>{if(!r)return;let m=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let i=e.filter(m=>m.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:c,onClick:()=>{if(!r&&c.current){let m=c.current.getBoundingClientRect();n({x:m.left,y:m.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(Qt,{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(m=>jsxs("button",{onClick:()=>{t(m.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:m.label}),m.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},m.id))]})})})})]})}function Pn({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[l,c]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let m=200,d=r.length*36+8,p=8,g=window.innerWidth,y=window.innerHeight,x=t,h=a;t+m+p>g&&(x=t-m,x<p&&(x=p)),a+d+p>y&&(h=y-d-p,h<p&&(h=p)),c({x,y:h});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let m=p=>{n.current&&!n.current.contains(p.target)&&o();},d=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(m=>jsxs("div",{children:[m.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{m.disabled||(m.onClick(),o());},disabled:m.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:m.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:d=>{m.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsx("span",{style:{color:s.textSecondary},children:m.icon}),jsx("span",{className:"flex-1",children:m.label}),m.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},m.id))})})})}var ua={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),Duplicate:jsx(Copy,{className:"w-4 h-4"}),MarkIncomplete:jsx(Circle,{className:"w-4 h-4"}),SetInProgress:jsx(PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsx(CheckCircle2,{className:"w-4 h-4"})};function om({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:m,onOpenTaskModal:d,enableKeyboard:p=true}){let g=useRef(false),y=useCallback(w=>{g.current=w;},[]),x=useCallback(w=>{let C=[],N=T=>{for(let k of T)C.push(k),k.subtasks&&k.subtasks.length>0&&k.isExpanded&&N(k.subtasks);};return N(w),C},[]),h=useCallback(()=>{let w=x(e);for(let C of w)if(t.has(C.id))return C;return null},[e,t,x]),f=useCallback((w,C)=>{let N=x(e);if(N.length===0)return;let T=h();if(!T){a(N[0].id,false);return}let k=N.findIndex(I=>I.id===T.id);if(k===-1)return;let v=w==="up"?k-1:k+1;if(v<0||v>=N.length)return;let E=N[v];a(E.id,C);},[e,h,x,a]),b=useCallback(w=>{if(!p)return;let C=w.target;if(C.tagName==="INPUT"||C.tagName==="TEXTAREA"||C.isContentEditable||g.current){w.key==="Escape"&&(C.blur(),g.current=false);return}let k=navigator.platform.toUpperCase().indexOf("MAC")>=0?w.metaKey:w.ctrlKey,v=Array.from(t),E=h();if(w.key==="ArrowUp"){w.preventDefault(),f("up",w.shiftKey);return}if(w.key==="ArrowDown"){w.preventDefault(),f("down",w.shiftKey);return}if(E&&(w.key==="ArrowRight"||w.key==="ArrowLeft")){E.subtasks&&E.subtasks.length>0&&(w.preventDefault(),(w.key==="ArrowRight"&&!E.isExpanded||w.key==="ArrowLeft"&&E.isExpanded)&&m(E.id));return}if(w.altKey&&(w.key==="ArrowUp"||w.key==="ArrowDown")){v.length>0&&(w.preventDefault(),n(v,w.key==="ArrowUp"?"up":"down"));return}if(w.key==="Tab"&&!w.shiftKey){v.length>0&&(w.preventDefault(),l(v));return}if(w.key==="Tab"&&w.shiftKey){v.length>0&&(w.preventDefault(),c(v));return}if(w.key==="Enter"&&!w.shiftKey&&!k){E&&(w.preventDefault(),r(E.id,"below"));return}if(w.key==="Enter"&&w.shiftKey&&!k){E&&(w.preventDefault(),r(E.id,"above"));return}if(w.key==="Enter"&&k){E&&(w.preventDefault(),d(E.id));return}if(w.key==="F2"){E&&(w.preventDefault(),i(E.id));return}if(w.key==="Delete"||w.key==="Backspace"&&k){v.length>0&&(w.preventDefault(),o(v));return}if(w.key==="d"&&k&&!w.shiftKey){v.length>0&&(w.preventDefault(),s(v));return}},[p,t,h,f,r,o,s,n,l,c,i,m,d]);return useEffect(()=>{if(p)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[p,b]),{setIsEditing:y}}function sm(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(d=>{t(new Set([d])),r(d);},[]),s=useCallback(d=>{t(p=>{let g=new Set(p);return g.has(d)?g.delete(d):g.add(d),g}),r(d);},[]),n=useCallback((d,p)=>{if(!a){o(d);return}let g=p.indexOf(a),y=p.indexOf(d);if(g===-1||y===-1){o(d);return}let x=Math.min(g,y),h=Math.max(g,y),f=p.slice(x,h+1);t(new Set(f)),r(d);},[a,o]),l=useCallback((d,p,g,y)=>{y?n(d,p):g?s(d):o(d);},[o,s,n]),c=useCallback((d,p)=>{p?t(g=>{let y=new Set(g);return y.add(d),y}):o(d);},[o]),i=useCallback(()=>{t(new Set),r(null);},[]),m=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:m}}function Td(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?Td(t.subtasks):t.subtasks}))}function An(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((l,c)=>(l.position??0)-(c.position??0));for(let l=0;l<n.length;l++){let c={...n[l],parentId:o,level:s,position:n[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 Ln(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Ln(a.subtasks,t);if(r)return r}}return null}function Cd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Cd(a.subtasks,t);if(r)return r}return null}function Nd(e,t){if(t.length===0)return e;let a=An(e),r=t[0],o=a.findIndex(p=>p.id===r);if(o<=0)return e;let s=a[o-1],n=(p,g)=>{let y=[];return {tasks:p.filter(h=>{if(g.has(h.id))return y.push(h),false;if(h.subtasks){let f=n(h.subtasks,g);h.subtasks=f.tasks,y.push(...f.removed);}return true}),removed:y}},l=(p,g,y)=>p.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...y],isExpanded:true}:x.subtasks?{...x,subtasks:l(x.subtasks,g,y)}:x),c=new Set(t),{tasks:i,removed:m}=n(e,c),d=l(i,s.id,m);return Td(d)}function Dd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Cd(a,r);if(!o)continue;let s=Cd(a,o.id),n=(i,m,d)=>{for(let p=0;p<i.length;p++){let g=i[p];if(g.id===m&&g.subtasks){let y=g.subtasks.findIndex(x=>x.id===d);if(y!==-1){let[x]=g.subtasks.splice(y,1);return x}}if(g.subtasks){let y=n(g.subtasks,m,d);if(y)return y}}return null},l=(i,m,d)=>{let p=i.findIndex(g=>g.id===m);if(p!==-1)return i.splice(p+1,0,d),i;for(let g of i)g.subtasks&&l(g.subtasks,m,d);return i},c=n(a,o.id,r);c&&(s&&s.subtasks?l(s.subtasks,o.id,c):l(a,o.id,c));}return Td(a)}function Sd(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,c)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,c))return true;return false}let m=c==="up"?i-1:i+1;return m<0||m>=n.length?false:([n[i],n[m]]=[n[m],n[i]],n[i]={...n[i],position:i},n[m]={...n[m],position:m},true)};return s(r,o,a),r}function Ed(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function fs(e,t){let a=[...e],r=[];for(let o of t){let s=(c,i)=>c.map((m,d)=>({...m,id:`${m.id}-copy-${Date.now()}-${d}`,parentId:i,subtasks:m.subtasks?s(m.subtasks,`${m.id}-copy-${Date.now()}-${d}`):void 0})),n=c=>{let i=c.findIndex(g=>g.id===o);if(i===-1){for(let g of c)if(g.subtasks){let y=n(g.subtasks);if(y)return y}return null}let m=c[i],d=`${m.id}-copy-${Date.now()}`,p={...m,id:d,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks,d):void 0};return c.splice(i+1,0,p),p},l=n(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function im(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#2E94FF"},l=c=>{let i=c.findIndex(d=>d.id===t);if(i===-1){for(let d of c)if(d.subtasks&&l(d.subtasks))return true;return false}let m=a==="above"?i:i+1;return c.splice(m,0,n),true};return l(r),{tasks:r,newTask:n}}function Md(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Md(r.subtasks,t,a)}:r)}function Fd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Fd(a.subtasks,t)}:a)}function Pd(e,t){let a=p=>{for(let g of p){if(g.id===t)return g;if(g.subtasks){let y=a(g.subtasks);if(y)return y}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,l=r?.endDate||s,c=p=>{for(let g of p){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let y=c(g.subtasks);if(y>=0)return y}}return 0},i=c(e),m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#2E94FF",position:i,parentId:t},d=p=>p.map(g=>{if(g.id===t){let y=g.subtasks||[];return {...g,subtasks:[...y,m],isExpanded:true}}return g.subtasks?{...g,subtasks:d(g.subtasks)}:g});return {tasks:d(e),newTask:m}}function lm(e,t,a,r){if(t===a)return e;let o=Ln(e,t);if(!o)return e;if(a){let l=(c,i)=>{if(!c.subtasks)return false;for(let m of c.subtasks)if(m.id===i||l(m,i))return true;return false};if(l(o,a))return e}let s=l=>{let c=l.filter(m=>m.id!==t),i=c.length<l.length;return c.map((m,d)=>{let p=i?{...m,position:d}:m;return p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p})},n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0}),n=n.map((c,i)=>({...c,position:i}));}else {let l=c=>c.map(i=>{if(i.id===a){let m=i.subtasks||[],d=r!==void 0?r:m.length,p=[...m];p.splice(d,0,{...o,parentId:a});let g=p.map((y,x)=>({...y,position:x}));return {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function Or(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=Or(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:[]}),o=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,n=r.progresses.length>0?Math.round(r.progresses.reduce((l,c)=>l+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:o,endDate:s,progress:n}})}function wi({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:c,scrollTop:i,columns:m,onToggleColumn:d,onColumnResize:p,onTaskUpdate:g,onTaskIndent:y,onTaskOutdent:x,onTaskMove:h,onMultiTaskDelete:f,onTaskDuplicate:b,onTaskCreate:w,onTaskRename:C,onCreateSubtask:N,onOpenTaskModal:T,onDeleteRequest:k,onTaskReparent:v,scrollContainerRef:E,showCriticalPath:I=false}){let S=useContext(Mn),[X,O]=useState(null),[$,F]=useState(null),[Y,Z]=useState(""),Ee=useRef(null),[R,_]=useState(null),[ye,Je]=useState(0),[z,re]=useState(0),[J,Ae]=useState({isOpen:false,x:0,y:0,type:"header"}),[ve,ze]=useState(null),[Be,st]=useState(null),[ee,it]=useState(null),de=useRef(0),lt=5,rt=useRef(false),[At,we]=useState(null),[vt,gt]=useState(false),tt=useRef(null),[H,le]=useState(null),[D,K]=useState(false),pe=useRef(null);useEffect(()=>{function oe(fe){pe.current&&!pe.current.contains(fe.target)&&K(false);}if(D)return document.addEventListener("mousedown",oe),()=>document.removeEventListener("mousedown",oe)},[D]),useEffect(()=>{$&&Ee.current&&(Ee.current.focus(),Ee.current.select());},[$]),useEffect(()=>{if(!R)return;let oe=L=>{let j=L.clientX-ye,q=z+j;p?.(R,q);},fe=()=>{_(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",oe),document.addEventListener("mouseup",fe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",fe),document.body.style.cursor="",document.body.style.userSelect="";}},[R,ye,z,p]);let{selectedTaskIds:Te,handleTaskClick:G,isTaskSelected:te}=sm(),{setIsEditing:Re}=om({tasks:e,selectedTaskIds:Te,onTaskSelect:(oe,fe)=>{let j=An(e).map(q=>q.id);G(oe,j,fe||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:f||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:h||(()=>{}),onTaskIndent:y||(()=>{}),onTaskOutdent:x||(()=>{}),onTaskRename:oe=>{let fe=An(e).find(L=>L.id===oe);fe&&dt(fe);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:oe=>{let fe=An(e).find(L=>L.id===oe);fe&&T&&T(fe);},enableKeyboard:true}),De=(oe,fe=0,L="")=>{let j=[],q=[...oe].sort((me,Ne)=>(me.position??0)-(Ne.position??0));for(let me=0;me<q.length;me++){let Ne=q[me],Xe=me+1,je=L?`${L}.${Xe}`:`${Xe}.0`;if(Ne.wbsCode=je,j.push({task:Ne,level:fe}),Ne.subtasks&&Ne.subtasks.length>0&&Ne.isExpanded){let Oe=L?`${L}.${Xe}`:`${Xe}`;j.push(...De(Ne.subtasks,fe+1,Oe));}}return j},Ue=De(e),Fe=48,_e=Math.max(Ue.length*a,600-Fe),ft=oe=>!oe.startDate||!oe.endDate?"-":`${Math.ceil((oe.endDate.getTime()-oe.startDate.getTime())/(1e3*60*60*24))}d`,dt=oe=>{F(oe.id),Z(oe.name),Re(true);},ut=oe=>{Y.trim()&&Y!==e.find(fe=>fe.id===oe)?.name&&C?.(oe,Y.trim()),F(null),Z(""),Re(false);},at=()=>{F(null),Z(""),Re(false);},Vt=(oe,fe)=>{fe.stopPropagation(),N?.(oe.id);},Mt=(oe,fe)=>{fe.preventDefault(),de.current=fe.clientY,ze(oe),rt.current=false,gt(false),we({x:fe.clientX,y:fe.clientY});},Dt=oe=>{if(!ve||(Math.abs(oe.clientY-de.current)>lt&&!rt.current&&(rt.current=true,gt(true)),we({x:oe.clientX,y:oe.clientY}),!rt.current))return;if(E?.current){let me=E.current,Ne=me.getBoundingClientRect(),Xe=60,je=12;tt.current&&(cancelAnimationFrame(tt.current),tt.current=null);let Oe=oe.clientY-Ne.top,kt=Ne.bottom-oe.clientY;if(Oe<Xe&&me.scrollTop>0){let pt=Math.round(je*(1-Oe/Xe)),Wt=()=>{me.scrollTop-=pt,rt.current&&me.scrollTop>0&&(tt.current=requestAnimationFrame(Wt));};tt.current=requestAnimationFrame(Wt);}else if(kt<Xe&&me.scrollTop<me.scrollHeight-me.clientHeight){let pt=Math.round(je*(1-kt/Xe)),Wt=()=>{me.scrollTop+=pt,rt.current&&me.scrollTop<me.scrollHeight-me.clientHeight&&(tt.current=requestAnimationFrame(Wt));};tt.current=requestAnimationFrame(Wt);}}let L=document.querySelectorAll("[data-task-row]"),j=null,q=null;L.forEach(me=>{let Ne=me.getBoundingClientRect(),Xe=me.getAttribute("data-task-row");if(Xe&&Xe!==ve&&oe.clientY>=Ne.top&&oe.clientY<=Ne.bottom){j=Xe;let je=oe.clientY-Ne.top,Oe=Ne.height;je<Oe*.25?q="above":je>Oe*.75?q="below":q="child";}}),st(j),it(q);},wt=()=>{if(rt.current&&ve&&Be&&ee){if(ee==="child")v?.(ve,Be);else if(ee==="above"||ee==="below"){let oe=(q,me,Ne=null)=>{for(let Xe of q){if(Xe.id===me)return Ne;if(Xe.subtasks){let je=oe(Xe.subtasks,me,Xe.id);if(je!==void 0)return je}}},fe=oe(e,ve,null),L=oe(e,Be,null),j=(q,me,Ne,Xe)=>{let je=q.findIndex(pt=>pt.id===me),Oe=Xe?q.findIndex(pt=>pt.id===Ne):-1,kt=ee==="below"?je+1:je;return Xe&&Oe!==-1&&Oe<je&&(kt-=1),Math.max(0,kt)};if(L===null){let me=j(e,Be,ve,fe===null);v?.(ve,null,me);}else {let q=Ln(e,L);if(q?.subtasks){let me=fe===L,Ne=j(q.subtasks,Be,ve,me);v?.(ve,L,Ne);}}}}tt.current&&(cancelAnimationFrame(tt.current),tt.current=null),ze(null),st(null),it(null),we(null),rt.current=false,gt(false);};useEffect(()=>{if(ve)return document.addEventListener("mousemove",Dt),document.addEventListener("mouseup",wt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Dt),document.removeEventListener("mouseup",wt),document.body.style.cursor="",document.body.style.userSelect="";}},[ve,Be,ee]);let bt=(oe,fe,L)=>{let j=fe.subtasks&&fe.subtasks.length>0;switch(oe.id){case "name":let q=$===fe.id,me=X===fe.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${L*20}px`},children:[v&&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:me?1:.3},onMouseDown:U=>Mt(fe.id,U),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),fe.subtasks&&fe.subtasks.length>0?jsx("button",{onClick:U=>{U.stopPropagation(),c?.(fe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:fe.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"}),q?jsx("input",{ref:Ee,type:"text",value:Y,onChange:U=>Z(U.target.value),onKeyDown:U=>{U.key==="Enter"?ut(fe.id):U.key==="Escape"&&at();},onBlur:()=>ut(fe.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:U=>U.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:fe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:fe.parentId?"13px":"14px",fontWeight:fe.isMilestone?600:fe.parentId?400:600,letterSpacing:fe.parentId?"0":"-0.01em"},title:fe.name,children:[fe.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:fe.wbsCode}),fe.isHighlighted&&fe.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:fe.name}),fe.subtasks&&fe.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(fe.progress||0),"%"]}),I&&fe.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),I&&fe.cpmData&&jsxs("span",{style:{color:fe.cpmData.totalFloat<=0?"#EF4444":fe.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(fe.cpmData.totalFloat),"d"]})]}),me&&!q&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:U=>U.stopPropagation(),children:[jsx("button",{onClick:U=>Vt(fe,U),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:U=>{U.stopPropagation(),dt(fe);},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 Xe=oe.id==="startDate"?"startDate":"endDate",je=fe[Xe],Oe=H?.taskId===fe.id&&H?.field===Xe,kt=U=>U?(typeof U=="string"?new Date(U):U).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:U=>U.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:U=>{if(!j)if(Oe)le(null);else {let ne=U.currentTarget.getBoundingClientRect();le({taskId:fe.id,field:Xe,month:je?typeof je=="string"?new Date(je):je:new Date,position:{top:ne.bottom+4,left:ne.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:kt(je)}),j&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Oe&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>le(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:H?.position.top,left:H?.position.left},onClick:U=>U.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let U=new Date,ne=new Date(U);ne.setDate(U.getDate()+1);let $e=new Date(U);$e.setDate(U.getDate()+7);let A=new Date(U);return A.setDate(U.getDate()+14),[{label:"Hoy",date:U},{label:"Ma\xF1ana",date:ne},{label:"Pr\xF3xima semana",date:$e},{label:"2 semanas",date:A}].map((Ve,Ze)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:na=>na.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:na=>na.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(fe.id,{[Xe]:Ve.date}),le(null);},children:Ve.label},Ze))})(),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:U=>U.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:U=>U.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(fe.id,{[Xe]:void 0}),le(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:()=>le(U=>U?{...U,month:new Date(U.month.getFullYear(),U.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:H?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>le(U=>U?{...U,month:new Date(U.month.getFullYear(),U.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((U,ne)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:U},ne))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let U=H?.month||new Date,ne=U.getFullYear(),$e=U.getMonth(),A=new Date(ne,$e,1).getDay(),ge=new Date(ne,$e+1,0).getDate(),Ve=new Date,Ze=[];for(let jt=A-1;jt>=0;jt--)Ze.push({day:new Date(ne,$e,-jt).getDate(),date:new Date(ne,$e-1,new Date(ne,$e,-jt).getDate()),isCurrentMonth:false});for(let jt=1;jt<=ge;jt++)Ze.push({day:jt,date:new Date(ne,$e,jt),isCurrentMonth:true});let na=42-Ze.length;for(let jt=1;jt<=na;jt++)Ze.push({day:jt,date:new Date(ne,$e+1,jt),isCurrentMonth:false});return Ze.map((jt,La)=>{let qa=jt.date.toDateString()===Ve.toDateString(),ga=(je?typeof je=="string"?new Date(je):je:null)?.toDateString()===jt.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:jt.isCurrentMonth?ga?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:ga?"#2E94FF":"transparent",boxShadow:qa&&!ga?"inset 0 0 0 1px #2E94FF":"none"},onClick:()=>{g?.(fe.id,{[Xe]:jt.date}),le(null);},children:jt.day},La)})})()})]})]})]}),document.body)]});case "duration":return jsx("div",{className:"flex items-center justify-center w-full",children:jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:ft(fe)})});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 pt=r.filter(U=>fe.assignees?.some(ne=>ne.name===U.name||ne.initials===U.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(qo,{assignedUsers:pt,availableUsers:r,onChange:U=>{let ne=U.map($e=>({id:$e.id,name:$e.name,initials:$e.initials,color:$e.color}));g?.(fe.id,{assignees:ne.length>0?ne:void 0});}})});case "status":if(j){let U=fe.progress===100?"\u2713":fe.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:U})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(Fu,{status:fe.status||"todo",onChange:U=>{g?.(fe.id,{status:U,progress:U==="completed"?100:fe.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:`${fe.progress}%`,backgroundColor:fe.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:[fe.progress,"%"]})]});case "priority":let Wt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ta={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Xt=Wt[fe.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:U=>U.stopPropagation(),children:jsx(_o,{priority:Xt,onChange:U=>{U&&g?.(fe.id,{priority:Ta[U]||"medium"});}})});default:return null}},Ut=oe=>[{id:"hide",label:"Hide Column",icon:ua.Hide,onClick:()=>d(oe),disabled:oe==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ua.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ua.SortDesc,onClick:()=>{}}],Ge=oe=>oe.subtasks&&oe.subtasks.length>0?[{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:ua.Add,onClick:()=>{N?.(oe.id);}},{id:"duplicate",label:S?.contextMenu?.duplicateTask||"Duplicate Task",icon:ua.Duplicate,onClick:()=>{b?.([oe.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:ua.Delete,onClick:()=>{k?k(oe.id,oe.name):f?.([oe.id]);}}]:[{id:"edit",label:S?.contextMenu?.editTask||"Edit Task",icon:ua.Pencil,onClick:()=>{n?.(oe);}},{id:"addSubtask",label:S?.contextMenu?.addSubtask||"Add Subtask",icon:ua.Add,onClick:()=>{N?.(oe.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:S?.contextMenu?.markIncomplete||"Mark Incomplete",icon:ua.MarkIncomplete,onClick:()=>{g?.(oe.id,{status:"todo",progress:0});},disabled:oe.status==="todo"},{id:"setInProgress",label:S?.contextMenu?.setInProgress||"Set In Progress",icon:ua.SetInProgress,onClick:()=>{g?.(oe.id,{status:"in-progress"});},disabled:oe.status==="in-progress"},{id:"markComplete",label:S?.contextMenu?.markComplete||"Mark Complete",icon:ua.MarkComplete,onClick:()=>{g?.(oe.id,{status:"completed",progress:100});},disabled:oe.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:S?.contextMenu?.duplicateTask||"Duplicate Task",icon:ua.Duplicate,onClick:()=>{b?.([oe.id]);}},{id:"split",label:S?.contextMenu?.splitTask||"Split Task",icon:ua.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:S?.contextMenu?.deleteTask||"Delete Task",icon:ua.Delete,onClick:()=>{k?k(oe.id,oe.name):f?.([oe.id]);}}],Le=m.filter(oe=>oe.visible),nt=Le.reduce((oe,fe)=>oe+fe.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:nt},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Fe}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:Le.map((oe,fe)=>{let L=fe===Le.length-1,j=oe.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:`${oe.width}px`,minWidth:`${oe.minWidth??(j?200:60)}px`,maxWidth:`${oe.maxWidth??2e3}px`,flexShrink:j&&Le.length===1?1:0,flexGrow:j&&Le.length===1?1:0,borderRight:L?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:q=>{q.preventDefault(),Ae({isOpen:true,x:q.clientX,y:q.clientY,type:"header",columnId:oe.id});},onMouseEnter:q=>{q.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:q=>{q.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:oe.label,children:oe.label}),oe.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:R===oe.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:q=>{q.preventDefault(),q.stopPropagation(),_(oe.id),Je(q.clientX),re(oe.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:R===oe.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},oe.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(xi,{columns:m,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>K(!D),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"})}),D&&jsxs("div",{ref:pe,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:oe=>oe.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:()=>K(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:_e},children:Ue.map(({task:oe,level:fe},L)=>{let j=te(oe.id),q=Be===oe.id,me=q&&ee==="above",Ne=q&&ee==="below",Xe=q&&ee==="child",je={};return Xe&&(je.backgroundColor=`${t.accent}15`,je.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":oe.id,className:`flex items-center cursor-pointer group ${ve===oe.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:j?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:j?t.accentLight:Xe?`${t.accent}15`:L%2===0?t.bgPrimary:t.bgGrid,opacity:I?oe.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...je},onMouseEnter:()=>O(oe.id),onMouseLeave:()=>O(null),onClick:Oe=>{let pt=An(e).map(Xt=>Xt.id),Ta=navigator.platform.toUpperCase().indexOf("MAC")>=0?Oe.metaKey:Oe.ctrlKey;G(oe.id,pt,Ta,Oe.shiftKey),s?.(oe);},onDoubleClick:Oe=>{Oe.stopPropagation(),n?.(oe);},onContextMenu:Oe=>{Oe.preventDefault(),Ae({isOpen:true,x:Oe.clientX,y:Oe.clientY,type:"task",task:oe}),l?.(oe,Oe);},whileHover:{backgroundColor:j?t.accentLight:t.hoverBg},children:[me&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ne&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Le.map((Oe,kt)=>{let pt=kt===Le.length-1,Wt=Oe.id==="name";return jsx("div",{className:`px-4 flex items-center ${Wt?"justify-start":"justify-center"}`,style:{width:`${Oe.width}px`,minWidth:`${Oe.minWidth??(Wt?200:60)}px`,maxWidth:`${Oe.maxWidth??2e3}px`,flexShrink:Wt&&Le.length===1?1:0,flexGrow:Wt&&Le.length===1?1:0,borderRight:pt?"none":`1px solid ${X===oe.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:bt(Oe,oe,Wt?fe:0)},`${oe.id}-${Oe.id}`)})]},oe.id)})}),jsx(Pn,{isOpen:J.isOpen,x:J.x,y:J.y,items:J.type==="header"&&J.columnId?Ut(J.columnId):J.type==="task"&&J.task?Ge(J.task):[],onClose:()=>Ae({...J,isOpen:false}),theme:t}),vt&&At&&ve&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:At.x+12,top:At.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let oe=Ue.find(fe=>fe.task.id===ve)?.task;return oe?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:oe.name})}):null})()}),document.body)]})}function mm(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,l]=useState(e),[c,i]=useState(t),[m,d]=useState(null),[p,g]=useState(null),[y,x]=useState(null),[h,f]=useState(null),[b,w]=useState(0),[C,N]=useState(0),[T,k]=useState(null),[v,E]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:m,setConnectionLine:d,hoveredTaskId:p,setHoveredTaskId:g,activeZone:y,setActiveZone:x,draggedSegmentIndex:h,setDraggedSegmentIndex:f,draggedSegmentStartX:b,setDraggedSegmentStartX:w,segmentDragOffsetX:C,setSegmentDragOffsetX:N,hoveredSegmentIndex:T,setHoveredSegmentIndex:k,isHovered:v,setIsHovered:E,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:($,F)=>{r("none"),d(null),g(null),l($),i(F),N(0),f(null),w(0);}}}function Ti({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:c,onDoubleClick:i,onContextMenu:m,onDateChange:d,onDependencyCreate:p,allTaskPositions:g=[],onDragMove:y,onHoverChange:x,showBaseline:h,showTaskBarLabels:f=true,showCriticalPath:b=true,readOnly:w=false}){let C=mm(t,r),N=useRef(null),T=useRef(false),k=useRef(null),v=useRef(null),{dragMode:E,setDragMode:I,dragOffset:S,setDragOffset:X,ghostX:O,setGhostX:$,ghostWidth:F,setGhostWidth:Y,connectionLine:Z,setConnectionLine:Ee,hoveredTaskId:R,setHoveredTaskId:_,activeZone:ye,setActiveZone:Je,draggedSegmentIndex:z,setDraggedSegmentIndex:re,draggedSegmentStartX:J,setDraggedSegmentStartX:Ae,segmentDragOffsetX:ve,setSegmentDragOffsetX:ze,hoveredSegmentIndex:Be,setHoveredSegmentIndex:st,isHovered:ee,setIsHovered:it,isDragging:de,isResizing:lt,isConnecting:rt,resetDragState:At}=C,we=18,vt=!!o.executionBarBg,gt=o.textPrimary==="#FFFFFF"||o.bgPrimary==="#050505",tt=vt?3:6,H=e.subtasks&&e.subtasks.length>0,le=e.endDate&&(()=>{let L=new Date;L.setHours(0,0,0,0);let j=new Date(e.endDate);return j.setHours(0,0,0,0),j<L})()&&e.progress<100,D=b&&e.isCriticalPath,K=o.name==="neutral"||o.today==="#1C1917",pe=e.status==="completed"||e.progress===100,Te={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},te=b&&e.isCriticalPath||le?"#EF4444":e.color?e.color:e.priority&&Te[e.priority]?Te[e.priority]:o.taskBarPrimary,Re=w?"default":de?rt?"crosshair":lt?"ew-resize":"grabbing":"grab",De=w?"default":"ew-resize",Fe=(L=>L>=80?20:L>=60?15:L>=50?12:10)(r),_e=r<50,ft=r<40;useEffect(()=>{x&&(!ee||de||e.segments)&&x(null);},[ee,de,e.segments,x]);let dt=L=>L.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),ut=()=>{let L=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${L} day${L!==1?"s":""}`},at=L=>Math.round(L/s)*s,Vt=L=>{let j=Math.round(L/s),q=new Date(n);return q.setDate(q.getDate()+j),q},Mt=(L,j)=>{for(let q of g){if(q.id===e.id)continue;let me=5;if(L>=q.x-me&&L<=q.x+q.width+me&&j>=q.y-me&&j<=q.y+q.height+me)return q.id}return null},Dt=useCallback((L,j,q)=>{if(w)return;L.preventDefault(),L.stopPropagation();let me=N.current?.ownerSVGElement;if(!me)return;let Ne=me.createSVGPoint();Ne.x=L.clientX,Ne.y=L.clientY;let Xe=Ne.matrixTransform(me.getScreenCTM()?.inverse()),je=q!==void 0?q:t,Oe=j;if(!Oe){let kt=Xe.x-je;L.shiftKey?(Oe="connect",Ee({x:t+r,y:a+we/2})):L.ctrlKey||L.metaKey?Oe="move":L.altKey?Oe=kt<r/2?"resize-start":"resize-end":ft?kt<r/2?Oe="move":Oe="resize-end":_e?kt<=Fe/2?Oe="resize-start":kt>=r-Fe/2?Oe="resize-end":Oe="move":kt<=Fe?Oe="resize-start":kt>=r-Fe?Oe="resize-end":Oe="move";}T.current=false,I(Oe),it(false),Je(null),Oe==="move"?X(Xe.x-je):Oe==="connect"?Ee({x:t+r,y:a+we/2}):X(0),$(je),Y(r);},[t,r,a,we,w]),wt=useCallback(L=>{let j=N.current?.ownerSVGElement;if(!j)return;let q=j.closest(".gantt-timeline-scroll");if(!q)return;let me=q.getBoundingClientRect(),Ne=60,Xe=15,je=0;if(L.clientX<me.left+Ne){let Oe=me.left+Ne-L.clientX;je=-Math.min(Xe,Oe/2);}else if(L.clientX>me.right-Ne){let Oe=L.clientX-(me.right-Ne);je=Math.min(Xe,Oe/2);}return je!==0&&(q.scrollLeft+=je),je!==0},[]),bt=useCallback(L=>{if(E==="none")return;T.current=true,v.current=L;let j=N.current?.ownerSVGElement;if(!j)return;if(E==="move"||E==="resize-start"||E==="resize-end"){let Ne=wt(L);Ne&&!k.current?k.current=window.setInterval(()=>{v.current&&(wt(v.current),bt(v.current));},16):!Ne&&k.current&&(window.clearInterval(k.current),k.current=null);}let q=j.createSVGPoint();q.x=L.clientX,q.y=L.clientY;let me=q.matrixTransform(j.getScreenCTM()?.inverse());if(E==="connect"){Ee({x:me.x,y:me.y});let Ne=Mt(me.x,me.y);_(Ne);}else if(E==="move"){let Ne=me.x-S,Xe=at(Ne);$(Xe),Y(r);let je=Math.round((Xe-t)/s);if(y?.(e.id,je,true),e.segments&&e.segments.length>0&&z!==null){let Oe=Xe-J;ze(Oe);}}else if(E==="resize-start"){let Ne=me.x,Xe=at(Ne),je=t+r-Xe;je>=s&&($(Xe),Y(je));}else if(E==="resize-end"){let Ne=me.x,je=at(Ne)-t;je>=s&&Y(je);}},[E,t,r,s,S,e,at,z,J,Mt,_,Ee,$,Y,ze,y,wt]),Ut=useCallback(()=>{if(k.current&&(window.clearInterval(k.current),k.current=null),v.current=null,E!=="none"){if(E==="connect")R&&p&&p(e,R),Ee(null),_(null);else {let L=e.endDate.getTime()-e.startDate.getTime(),j,q,me=true;if(E==="move"){if(j=Vt(O),q=new Date(j.getTime()+L),e.segments&&e.segments.length>0&&z!==null){let Ne=Math.round(ve/s),Xe=e.segments.map((pt,Wt)=>{if(Wt===z){let Ta=new Date(pt.startDate),Xt=new Date(pt.endDate);return Ta.setDate(Ta.getDate()+Ne),Xt.setDate(Xt.getDate()+Ne),{startDate:Ta,endDate:Xt}}return pt}),je=Xe.flatMap(pt=>[pt.startDate,pt.endDate]),Oe=new Date(Math.min(...je.map(pt=>pt.getTime()))),kt=new Date(Math.max(...je.map(pt=>pt.getTime())));d?.({...e,segments:Xe},Oe,kt),At(t,r);return}}else E==="resize-start"?(j=Vt(O),q=e.endDate,j>q&&(console.warn("Invalid date range: start date must be before or equal to end date"),me=false)):E==="resize-end"?(j=e.startDate,q=Vt(O+F),q.setDate(q.getDate()-1),q<j&&(console.warn("Invalid date range: end date must be after or equal to start date"),me=false)):me=false;me&&j&&q&&(q.getTime()<j.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,j,q));}y?.(e.id,0,false),At(t,r);}},[E,O,F,e,d,R,p,t,r,s,Vt,ve,z,At,y]);useEffect(()=>{if(E==="none")return;let L=q=>{bt(q);},j=()=>{Ut();};return window.addEventListener("mousemove",L),window.addEventListener("mouseup",j),()=>{window.removeEventListener("mousemove",L),window.removeEventListener("mouseup",j),k.current&&(window.clearInterval(k.current),k.current=null);}},[E,bt,Ut]);let Ge=de&&!rt?O:t,Le=de&&!rt?F:r,nt=l.taskClass(e),oe=24,fe=b?e.isCriticalPath?1:.25:1;return jsxs("g",{ref:N,"data-task-bar":"true",style:{opacity:fe,transition:"opacity 300ms ease"},onClick:()=>{!de&&!T.current&&c?.(e),T.current=false;},onDoubleClick:L=>{!de&&!T.current&&(L.stopPropagation(),i?.(e));},onContextMenu:L=>{L.preventDefault(),m?.(e,L);},onMouseEnter:()=>!de&&it(true),onMouseMove:L=>{x&&ee&&!de&&!e.segments&&x({task:e,x:t,y:a,width:r,height:we,showBelow:false,mouseX:L.clientX,mouseY:L.clientY});},onMouseLeave:()=>{de||(it(false),Je(null));},children:[jsx("rect",{x:t,y:a,width:r+oe,height:we,fill:"transparent",style:{pointerEvents:"all"}}),ee&&!de&&!_e&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Fe,height:we,fill:ye==="resize-start"?o.accent:"transparent",opacity:ye==="resize-start"?.15:0,style:{cursor:De,pointerEvents:"all"},onMouseEnter:()=>Je("resize-start"),onMouseDown:L=>Dt(L,"resize-start")}),jsx("rect",{x:t+Fe,y:a,width:r-Fe*2,height:we,fill:ye==="move"?o.accent:"transparent",opacity:ye==="move"?.1:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Je("move"),onMouseDown:L=>Dt(L,"move")}),jsx("rect",{x:t+r-Fe,y:a,width:Fe,height:we,fill:ye==="resize-end"?o.accent:"transparent",opacity:ye==="resize-end"?.15:0,style:{cursor:De,pointerEvents:"all"},onMouseEnter:()=>Je("resize-end"),onMouseDown:L=>Dt(L,"resize-end")})]}),ee&&!de&&ft&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:we,fill:ye==="move"?o.accent:"transparent",opacity:ye==="move"?.2:0,style:{cursor:w?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>Je("move"),onMouseDown:L=>Dt(L,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:we,fill:ye==="resize-end"?o.accent:"transparent",opacity:ye==="resize-end"?.2:0,style:{cursor:De,pointerEvents:"all"},onMouseEnter:()=>Je("resize-end"),onMouseDown:L=>Dt(L,"resize-end")}),ee&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+we-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),de&&!rt&&!e.segments&&jsx(motion.rect,{x:O,y:a,width:F,height:we,rx:tt,fill:o.accent,opacity:.15,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),h&&e.baselineStartDate&&e.baselineEndDate&&!de&&(()=>{let L=e.baselineStartDate.getTime(),j=e.baselineEndDate.getTime(),q=n.getTime(),me=864e5,Ne=(L-q)/me,Xe=(j-L)/me,je=Ne*s,Oe=Math.max(Xe*s,s),kt=Ge+Le,pt=je+Oe,Wt=e.endDate?.getTime()??0,Ta=Math.ceil((Wt-j)/me),Xt=Ta>0,U=Ta<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:je,y:a,width:Oe,height:we,rx:tt,fill:"none",stroke:gt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),Xt&&kt>pt&&jsx("rect",{x:pt,y:a,width:kt-pt,height:we,rx:0,fill:"#EF4444",opacity:.2}),Xt&&jsxs("text",{x:Math.max(kt,pt)+6,y:a+we/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Ta,"d"]}),U&&jsxs("text",{x:kt+6,y:a+we/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Ta,"d"]})]})})(),!e.segments&&vt&&H&&(()=>{let j=a+(we-8)/2,q=4,me=e.progress||0,Ne=new Date;Ne.setHours(0,0,0,0);let Xe=e.startDate&&Ne>=e.startDate,je=e.endDate&&(()=>{let Xt=new Date(e.endDate);return Xt.setHours(0,0,0,0),Ne>Xt})(),Oe=e.startDate&&Ne<e.startDate,kt=1;if(Xe&&e.startDate&&e.endDate&&!Oe){let Xt=new Date(e.startDate);Xt.setHours(0,0,0,0);let U=new Date(e.endDate);U.setHours(0,0,0,0);let ne=Math.max(1,(U.getTime()-Xt.getTime())/(1e3*60*60*24)),A=Math.min((Ne.getTime()-Xt.getTime())/(1e3*60*60*24),ne)/ne*100;kt=A>0?me/A:1;}let pt;me>=100?pt="#00E5CC":Oe?pt="#4B5563":je&&me<100?pt="#EF4444":kt>=.95?pt="#22C55E":kt>=.8?pt="#F59E0B":pt="#EF4444";let Wt=Math.max(me/100*Le,me>0?q*2:0),Ta=Le>100&&me>0;return jsxs("g",{"data-task-class":nt,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:Ge,y:j,width:Le,height:8,rx:q,fill:"rgba(255,255,255,0.10)"}),me>0&&jsx("rect",{x:Ge,y:j,width:Wt,height:8,rx:q,fill:pt}),Ta&&jsxs("text",{x:Ge+Wt+6,y:j+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(me),"%"]})]})})(),!e.segments&&vt&&!H&&jsx(motion.rect,{x:Ge,y:a,width:Le,height:we,rx:tt,fill:o.executionBarBg||"rgba(255,255,255,0.06)",stroke:o.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":nt,initial:{opacity:0,scale:.95},animate:{opacity:de&&!rt?.15:e.parentId?.6:1,scale:ee&&!de?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:L=>Dt(L),style:{cursor:Re,pointerEvents:"all"}}),!e.segments&&!vt&&jsx(motion.rect,{x:Ge,y:a,width:Le,height:we,rx:tt,fill:te,"data-task-class":nt,initial:{opacity:0,scale:.95},animate:{opacity:de&&!rt?.15:e.parentId?.6:ee?.9:.8,scale:ee&&!de?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:H?void 0:L=>Dt(L),style:{cursor:H?"default":Re,pointerEvents:"all"}}),vt&&(le||D)&&!e.segments&&jsx("rect",{x:Ge,y:a,width:Le,height:we,rx:tt,fill:"none",stroke:o.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${o.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&e.progress>0&&!H&&jsx("rect",{x:Ge,y:a,width:Math.max(Le*(e.progress/100),tt*2),height:we,rx:tt,fill:te,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!H&&e.progress<100&&(()=>{let L=e.progress>0?Le*(e.progress/100):0,j=Ge+L,q=Le-L,me=e.progress===0?tt:0,Ne=e.progress===0?Ge:j,Xe=e.progress===0?Le:q;return jsxs(Fragment,{children:[jsx("rect",{x:Ne,y:a,width:Xe,height:we,rx:me,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:Ne,y:a,width:Xe,height:we,rx:me,fill:"none",stroke:"#2E94FF",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),vt&&!e.segments&&e.progress>0&&e.progress<100&&!H&&!de&&(()=>{let L=Ge+Le*(e.progress/100),j=8,q=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:L,cy:a+we/2,r:j,fill:q?.color||o.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:L,y:a+we/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:q?.initials||q?.name?.charAt(0)?.toUpperCase()||""})]})})(),e.segments&&e.segments.map((L,j)=>{let q=(L.startDate.getTime()-n.getTime())/864e5*s,Ne=(L.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-q+s,Xe=de&&E==="move"&&z===j,je=Be===j,Oe=Xe?q+ve:q;return jsxs("g",{onMouseEnter:()=>!de&&st(j),onMouseLeave:()=>!de&&st(null),children:[jsx(motion.rect,{x:Oe,y:a,width:Ne,height:we,rx:tt,fill:te,initial:{opacity:0,scale:.95},animate:{opacity:Xe||e.parentId?.6:je?.9:.8,scale:je&&!de?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:kt=>{kt.stopPropagation(),re(j),Ae(q),Dt(kt,void 0,q);},style:{cursor:Re,pointerEvents:"all"}}),jsx("rect",{x:Oe,y:a,width:Ne*(e.progress/100),height:we,rx:tt,fill:te,opacity:1,style:{pointerEvents:"none"}})]},`segment-${j}`)}),K&&(le||D)&&!e.segments&&jsxs(Fragment,{children:[D&&!le&&jsx("rect",{x:Ge,y:a,width:Le,height:we,rx:tt,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),le&&jsx("rect",{x:Ge,y:a,width:Le,height:we,rx:tt,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),f&&Le>60&&!e.segments&&!(vt&&H)&&(()=>{let L=l.taskLabel(e),j=typeof L=="string"?L:e.name,q=j.length>Math.floor(Le/8)?`${j.substring(0,Math.floor(Le/8))}...`:j;return jsx("text",{x:Ge+8,y:a+we/2,dominantBaseline:"middle",fill:pe?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:pe?"line-through":"none"},children:q})})(),!de&&!e.segments&&!H&&e.progress>0&&e.progress<100&&(vt?jsxs("text",{x:Ge+Le+6,y:a+we/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Le>100?jsxs("text",{x:Ge+Le-12,y:a+we/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&Le>80&&!de&&!e.segments&&!(vt&&H)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Ge+Le-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Ge+Le-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(ee||lt)&&!rt&&!e.segments&&!H&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Ge-2,y:a,width:16,height:we,fill:"transparent",style:{cursor:De},onMouseEnter:()=>Je("resize-start"),onMouseLeave:()=>Je(null),onMouseDown:L=>{L.stopPropagation(),Dt(L,"resize-start");}}),jsx(motion.rect,{x:Ge+4,y:a+8,width:3,height:we-16,rx:1.5,fill:ye==="resize-start"||E==="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:Ge+Le-14,y:a,width:16,height:we,fill:"transparent",style:{cursor:De},onMouseEnter:()=>Je("resize-end"),onMouseLeave:()=>Je(null),onMouseDown:L=>{L.stopPropagation(),Dt(L,"resize-end");}}),jsx(motion.rect,{x:Ge+Le-7,y:a+8,width:3,height:we-16,rx:1.5,fill:ye==="resize-end"||E==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:ee&&!de&&!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+we/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>Je("connect"),onMouseLeave:()=>Je(null),onMouseDown:L=>{L.stopPropagation(),Dt(L,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+we/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:ye==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),rt&&Z&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+we/2,x2:Z.x,y2:Z.y,stroke:R?o.statusCompleted:o.accent,strokeWidth:R?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:R?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:Z.x,cy:Z.y,r:R?8:6,fill:R?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),R&&jsx(motion.text,{x:Z.x+15,y:Z.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Z.x+10},animate:{opacity:1,x:Z.x+15},transition:{duration:.2},children:"Connect"})]}),(ee||de)&&!rt&&!e.segments&&jsx(motion.rect,{x:Ge-1,y:a-1,width:Le+2,height:we+2,rx:tt+1,fill:"none",stroke:de?o.accent:vt?"rgba(255,255,255,0.2)":o.taskBarPrimary,strokeWidth:vt?1:2,opacity:de||vt?.6:.4,initial:{opacity:0},animate:{opacity:de||vt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),lt&&jsxs(Fragment,{children:[jsx("line",{x1:O,y1:0,x2:O,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:O+F,y1:0,x2:O+F,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:ee&&!de&&!e.segments&&!x&&(()=>{let q=a<100,me=q?a+we+13:a-82-13,Ne=q?`M ${Ge+Le/2-6} ${a+we+3} L ${Ge+Le/2} ${a+we+13} L ${Ge+Le/2+6} ${a+we+3}`:`M ${Ge+Le/2-6} ${a-13} L ${Ge+Le/2} ${a-3} L ${Ge+Le/2+6} ${a-13}`,Xe=me+22,je=me+40,Oe=me+55,kt=me+70,pt=q?me+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:q?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:q?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:Ne,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Ge+Le/2-120,y:me,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:Ge+Le/2,y:Xe,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:Ge+Le/2-110,y:je,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Ge+Le/2-70,y:je,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:dt(e.startDate)}),jsx("text",{x:Ge+Le/2-110,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Ge+Le/2-70,y:Oe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:dt(e.endDate)}),jsx("text",{x:Ge+Le/2+10,y:je,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Ge+Le/2+65,y:je,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ut()}),jsx("text",{x:Ge+Le/2+10,y:Oe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Ge+Le/2+65,y:Oe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:Ge+Le/2-110,y:kt,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Ge+Le/2-50,y:kt,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Wt=>Wt.name).join(", ").substring(0,30),e.assignees.map(Wt=>Wt.name).join(", ").length>30?"...":""]})]}),!q&&jsx("text",{x:Ge+Le/2,y:pt,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:ft?"Left: move \u2022 Right: resize":_e?"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 Ad=260,In=8,bm=16,Tv=-12;function hm({tooltipData:e,theme:t,locale:a="en"}){let[r,o]=useState(null);if(useLayoutEffect(()=>{if(!e){o(null);return}let{task:b,mouseX:w,mouseY:C}=e,T=b.effortMinutes!=null||b.timeLoggedMinutes!=null||b.soldEffortMinutes!=null?155:105,k=w+bm,v=C+Tv-T;k+Ad>window.innerWidth-In&&(k=w-Ad-bm),k<In&&(k=In);let E=v<In;E&&(v=C+20),v+T>window.innerHeight-In&&(v=window.innerHeight-In-T),o({left:k,top:v,showBelow:E});},[e]),!e||!r)return null;let{task:s}=e,n=s.effortMinutes!=null||s.timeLoggedMinutes!=null||s.soldEffortMinutes!=null,l={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"},c=b=>b.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),i=()=>{if(!s.startDate||!s.endDate)return "N/A";let b=Math.ceil((s.endDate.getTime()-s.startDate.getTime())/(1e3*60*60*24));return a==="es"?`${b} d\xEDa${b!==1?"s":""}`:`${b} day${b!==1?"s":""}`},m=b=>{if(b==null||b===0)return "N/A";let w=Math.floor(b/60),C=b%60;return w===0?`${C}m`:C===0?`${w}h`:`${w}h ${C}m`},d=t.textTertiary||"#9CA3AF",p=t.textSecondary||"#D1D5DB",g=t.textPrimary||"#F9FAFB",y=t.accent||"#3B82F6",x=t.bgSecondary||"#1F2937",h=t.border||"#374151",f=jsxs("div",{style:{position:"fixed",left:r.left,top:r.top,width:Ad,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:x,border:`1px solid ${h}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:g,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(Ni,{label:l.start,value:s.startDate?c(s.startDate):"N/A",labelColor:d,valueColor:p}),jsx(Ni,{label:l.duration,value:i(),labelColor:d,valueColor:p}),jsx(Ni,{label:l.end,value:s.endDate?c(s.endDate):"N/A",labelColor:d,valueColor:p}),jsx(Ni,{label:l.progress,value:`${s.progress}%`,labelColor:d,valueColor:p})]}),s.assignees&&s.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:d},children:[l.assignees,": "]}),jsx("span",{style:{color:p,fontWeight:500},children:s.assignees.map(b=>b.name).join(", ")})]}),n&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[s.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[l.estimated,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:m(s.effortMinutes)})]}),s.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[l.logged,":"]})," ",jsx("span",{style:{color:y,fontWeight:600},children:m(s.timeLoggedMinutes)})]}),s.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[l.quoted,":"]})," ",jsx("span",{style:{color:p,fontWeight:600},children:m(s.soldEffortMinutes)})]})]})]}),jsx("style",{children:`
|
|
126
126
|
@keyframes gantt-tooltip-fade {
|
|
127
127
|
from { opacity: 0; transform: translateY(${r.showBelow?"-4px":"4px"}); }
|
|
128
128
|
to { opacity: 1; transform: translateY(0); }
|
|
129
129
|
}
|
|
130
|
-
`})]});return createPortal(f,document.body)}function
|
|
131
|
-
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=
|
|
130
|
+
`})]});return createPortal(f,document.body)}function Ni({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 hs({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false,onHoverChange:c,hoverOverlayOnly:i=false,colorOverride:m,strokeWidthOverride:d,glowFilter:p}){let[,g]=useState(false),[y,x]=useState(null),h=r-t,f=h>0,b=Math.abs(h)<5,w=20,C=!b&&a<=e,N,T,k=a-e,v=e+k/2;T=v;let E=8;if(n==="squared")if(b)N=`M ${e} ${t} L ${a} ${r}`;else if(C){let ve=e+15,ze=a-w,Be=f?t+20:t-20;T=ze;let st=f?1:-1;N=`M ${e} ${t} L ${ve-E} ${t} Q ${ve} ${t} ${ve} ${t+st*E} L ${ve} ${Be-st*E} Q ${ve} ${Be} ${ve-E} ${Be} L ${ze+E} ${Be} Q ${ze} ${Be} ${ze} ${Be+st*E} L ${ze} ${r-st*E} Q ${ze} ${r} ${ze+E} ${r} L ${a} ${r}`;}else {T=a-w;let Ae=f?1:-1;N=`M ${e} ${t} L ${T-E} ${t} Q ${T} ${t} ${T} ${t+Ae*E} L ${T} ${r-Ae*E} Q ${T} ${r} ${T+E} ${r} L ${a} ${r}`;}else N=`M ${e} ${t} C ${v} ${t}, ${v} ${r}, ${a} ${r}`;let I=6,S=5,X=`M ${a} ${r} L ${a-I} ${r-S/2} L ${a-I} ${r+S/2} Z`,O=!o.bgPrimary||o.bgPrimary.startsWith("#0")||o.bgPrimary.startsWith("#1"),$=m||(O?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),F=d||1,Y=o.dependencyHover||(O?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),Z="#f87171",Ee="rgba(248, 113, 113, 0.15)",R=T,_=(t+r)/2;if(y)if(n==="squared")if(b)R=Math.max(e+10,Math.min(a-10,y.x)),_=t;else if(C){let Ae=e+15,ve=a-w,ze=f?t+20:t-20,Be=[[e,t,Ae,t],[Ae,t,Ae,ze],[Ae,ze,ve,ze],[ve,ze,ve,r],[ve,r,a,r]],st=1/0,ee={x:R,y:_};for(let it of Be){let de=ye(y.x,y.y,it[0],it[1],it[2],it[3]),lt=Math.hypot(y.x-de.x,y.y-de.y);lt<st&&(st=lt,ee=de);}R=ee.x,_=ee.y;}else {let Ae=[[e,t,T,t],[T,t,T,r],[T,r,a,r]],ve=1/0,ze={x:R,y:_};for(let Be of Ae){let st=ye(y.x,y.y,Be[0],Be[1],Be[2],Be[3]),ee=Math.hypot(y.x-st.x,y.y-st.y);ee<ve&&(ve=ee,ze=st);}R=ze.x,_=ze.y;}else {let Ae=v,ve=t,ze=v,Be=r,st=1/0,ee=R,it=_;for(let de=0;de<=1;de+=.02){let lt=1-de,rt=lt*lt*lt*e+3*lt*lt*de*Ae+3*lt*de*de*ze+de*de*de*a,At=lt*lt*lt*t+3*lt*lt*de*ve+3*lt*de*de*Be+de*de*de*r,we=Math.hypot(y.x-rt,y.y-At);we<st&&(st=we,ee=rt,it=At);}R=ee,_=it;}function ye(Ae,ve,ze,Be,st,ee){let it=st-ze,de=ee-Be,lt=it*it+de*de;if(lt===0)return {x:ze,y:Be};let rt=((Ae-ze)*it+(ve-Be)*de)/lt;return rt=Math.max(0,Math.min(1,rt)),{x:ze+rt*it,y:Be+rt*de}}let Je=Ae=>{let ve=Ae.currentTarget.ownerSVGElement;if(!ve)return;let ze=ve.getScreenCTM();if(!ze)return;let Be=ze.inverse();x({x:Be.a*Ae.clientX+Be.c*Ae.clientY+Be.e,y:Be.b*Ae.clientX+Be.d*Ae.clientY+Be.f});},z=()=>{g(false),x(null),c?.(false);},re=()=>{g(true),c?.(true);},J=Ae=>s?jsxs(motion.g,{initial:Ae,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ve=>{ve.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsx("circle",{cx:R,cy:_,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsx("circle",{cx:R,cy:_,r:9,fill:Ee,stroke:Z,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("line",{x1:R-3,y1:_-3,x2:R+3,y2:_+3,stroke:Z,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("line",{x1:R+3,y1:_-3,x2:R-3,y2:_+3,stroke:Z,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return l?jsxs("g",{"data-dependency-line":"true",onMouseLeave:z,onMouseMove:Je,children:[jsx("path",{d:N,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:N,fill:"none",stroke:Y,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:N,fill:"none",stroke:Y,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:X,fill:Y,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:Y,opacity:.9,style:{pointerEvents:"none"}}),J({opacity:0,scale:.8})]}):i?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:re,onMouseLeave:z,onMouseMove:Je,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:N,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx("path",{d:N,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:N,fill:"none",stroke:Y,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsx("path",{d:N,fill:"none",stroke:Y,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:X,fill:Y,stroke:"none",style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:3.5,fill:Y,style:{pointerEvents:"none"}}),J({opacity:0,scale:0})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:re,onMouseLeave:z,onMouseMove:Je,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:N,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:N,fill:"none",stroke:$,strokeWidth:F,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:p||"none"}}),jsx(motion.path,{d:X,fill:$,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:$,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Mi({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=useState(false),l=16,c=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsx(motion.rect,{x:t-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children: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 Se={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=i=>{i.forEach(m=>{m.dependencies&&r.set(m.id,m.dependencies),m.subtasks&&o(m.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,c=i=>{if(!n.has(i)){n.add(i),l.add(i);let m=r.get(i)||[];for(let d of m){if(!n.has(d)&&c(d))return true;if(l.has(d))return true}}return l.delete(i),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,n)=>(s.position??0)-(n.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Se.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Se.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Se.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=Se.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
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=Se.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=Se.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)=>Se.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Se.findTaskById(e,t);return !a||!a.dependencies?[]:Se.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Se.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Se.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=Se.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>Se.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=Se.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=s.map(c=>{let i=c.startDate&&c.endDate?Se.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?Se.formatDate(c.startDate):"N/A",c.endDate?Se.formatDate(c.endDate):"N/A",i>0?`${i} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});r(o,{head:n,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t,a)=>{let r=await import('xlsx'),o=Se.flattenTasks(e),s=a?.rateMap,n=a?.defaultRate||0,l=h=>{if(!s||!h.assignees||h.assignees.length===0)return n;let f=h.assignees.map(b=>b.id?s[b.id]:void 0).filter(b=>b!=null&&b>0);return f.length===0?n:f.reduce((b,w)=>b+w,0)/f.length},c=new Map,i=(h,f="")=>{[...h].sort((w,C)=>(w.position??0)-(C.position??0)).forEach((w,C)=>{let N=f?`${f}.${C+1}`:`${C+1}`;c.set(w.id,N),w.subtasks?.length&&i(w.subtasks,N);});};i(e);let m=s&&Object.keys(s).length>0||o.some(h=>h._costRate>0),d=o.map(h=>{let f=h.startDate&&h.endDate?Se.calculateDuration(h.startDate,h.endDate):0,b=h.effortMinutes,w=h.timeLoggedMinutes,C=h.soldEffortMinutes,N=typeof b=="number"?+(b/60).toFixed(1):0,T=typeof w=="number"?+(w/60).toFixed(1):0,k=typeof C=="number"?+(C/60).toFixed(1):0,v=h._costRate>0?h._costRate:l(h),E={WBS:c.get(h.id)||"","Task Name":h.name,"Start Date":h.startDate?Se.formatDate(h.startDate):"","End Date":h.endDate?Se.formatDate(h.endDate):"","Duration (days)":f>0?f:"","Progress (%)":h.progress,Status:h.status||"",Assignees:h.assignees?.map(S=>S.name).join(", ")||"","Estimated (h)":N||"","Logged (h)":T||"","Quoted (h)":k||""};m&&(E["$ Estimated"]=N>0&&v>0?Math.round(N*v):"",E["$ Executed"]=T>0&&v>0?Math.round(T*v):"",E["$ Quoted"]=k>0&&v>0?Math.round(k*v):"",E["Rate ($/h)"]=v>0?v:"");let I=h.weight;return E["Weight (%)"]=typeof I=="number"&&I>0?I:"",E["Is Milestone"]=h.isMilestone?"Yes":"No",E}),p=a?.projectName||"";if(p||d.length>0){let h=0,f=0,b=0,w=0,C=0,N=0,T=0,k=0,v=o.filter(S=>S.startDate).map(S=>S.startDate.getTime()),E=o.filter(S=>S.endDate).map(S=>S.endDate.getTime());for(let S of d)typeof S["Estimated (h)"]=="number"&&(h+=S["Estimated (h)"]),typeof S["Logged (h)"]=="number"&&(f+=S["Logged (h)"]),typeof S["Quoted (h)"]=="number"&&(b+=S["Quoted (h)"]),m&&(typeof S["$ Estimated"]=="number"&&(w+=S["$ Estimated"]),typeof S["$ Executed"]=="number"&&(C+=S["$ Executed"]),typeof S["$ Quoted"]=="number"&&(N+=S["$ Quoted"])),typeof S["Progress (%)"]=="number"&&(T+=S["Progress (%)"],k++);let I={WBS:"0","Task Name":`\u{1F4CB} ${p||"PROJECT TOTAL"}`,"Start Date":v.length>0?Se.formatDate(new Date(Math.min(...v))):"","End Date":E.length>0?Se.formatDate(new Date(Math.max(...E))):"","Duration (days)":v.length>0&&E.length>0?Se.calculateDuration(new Date(Math.min(...v)),new Date(Math.max(...E))):"","Progress (%)":k>0?Math.round(T/k):0,Status:"",Assignees:"","Estimated (h)":+h.toFixed(1)||"","Logged (h)":+f.toFixed(1)||"","Quoted (h)":+b.toFixed(1)||""};m&&(I["$ Estimated"]=w||"",I["$ Executed"]=C||"",I["$ Quoted"]=N||"",I["Rate ($/h)"]=""),I["Is Milestone"]="No",d.unshift(I);}let g=r.utils.json_to_sheet(d),y=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},...m?[{wch:14},{wch:14},{wch:14},{wch:12}]:[],{wch:12}];g["!cols"]=y;let x=r.utils.book_new();if(r.utils.book_append_sheet(x,g,"Gantt Tasks"),!t){let h=new Date,f=w=>String(w).padStart(2,"0");t=`Project_${`${h.getFullYear()}-${f(h.getMonth()+1)}-${f(h.getDate())}_${f(h.getHours())}${f(h.getMinutes())}`}.xlsx`;}r.writeFile(x,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Se.flattenTasks(e),o=new Map;r.forEach((p,g)=>{o.set(p.id,g+1);});let s=p=>p.toISOString().replace("Z",""),n=Se.getEarliestStartDate(e)||new Date,l=Se.getLatestEndDate(e)||new Date,c=r.map((p,g)=>{let y=o.get(p.id),x=p.startDate&&p.endDate?Se.calculateDuration(p.startDate,p.endDate):0,h=(p.dependencies||[]).filter(f=>o.has(f)).map(f=>`
|
|
132
132
|
<PredecessorLink>
|
|
133
133
|
<PredecessorUID>${o.get(f)}</PredecessorUID>
|
|
134
134
|
<Type>1</Type>
|
|
@@ -211,7 +211,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
211
211
|
<EarnedValueMethod>0</EarnedValueMethod>
|
|
212
212
|
<IsPublished>1</IsPublished>
|
|
213
213
|
<CommitmentType>0</CommitmentType>${h}
|
|
214
|
-
</Task>`}).join(""),
|
|
214
|
+
</Task>`}).join(""),i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
215
215
|
<Project xmlns="http://schemas.microsoft.com/project">
|
|
216
216
|
<SaveVersion>14</SaveVersion>
|
|
217
217
|
<Name>${t.replace(/[<>&'"]/g,p=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[p]||p)}</Name>
|
|
@@ -220,7 +220,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
220
220
|
<LastSaved>${s(new Date)}</LastSaved>
|
|
221
221
|
<ScheduleFromStart>1</ScheduleFromStart>
|
|
222
222
|
<StartDate>${s(n)}</StartDate>
|
|
223
|
-
<FinishDate>${s(
|
|
223
|
+
<FinishDate>${s(l)}</FinishDate>
|
|
224
224
|
<FYStartDate>1</FYStartDate>
|
|
225
225
|
<CriticalSlackLimit>0</CriticalSlackLimit>
|
|
226
226
|
<CurrencyDigits>2</CurrencyDigits>
|
|
@@ -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>`,m=new Blob([l],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(m),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=De.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let r=new Map,o=l=>{if(r.has(l.id))return;let m=l.startDate&&l.endDate?De.calculateDuration(l.startDate,l.endDate):0,d=0;if(l.dependencies&&l.dependencies.length>0)for(let g of l.dependencies){let y=t.find(x=>x.id===g);if(y){o(y);let x=r.get(g)?.ef||0;d=Math.max(d,x);}}let p=d+m;r.set(l.id,{es:d,ef:p});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(l=>l.ef)),n=new Map,i=l=>{if(n.has(l.id))return;let m=l.startDate&&l.endDate?De.calculateDuration(l.startDate,l.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(l.id)),p=s;if(d.length>0)for(let y of d){i(y);let x=n.get(y.id)?.ls||0;p=Math.min(p,x);}let g=p-m;n.set(l.id,{ls:g,lf:p});};a.forEach(i);let c=[];for(let l of a){let m=r.get(l.id),d=n.get(l.id);if(m&&d){let p=d.ls-m.es;Math.abs(p)<.01&&c.push(l.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=De.flattenTasks(e).filter(p=>p.startDate&&p.endDate);if(r.length===0)return t;let o=new Map(r.map(p=>[p.id,p])),s=new Map;for(let p of r)s.has(p.id)||s.set(p.id,[]);for(let p of r)if(p.dependencies){for(let g of p.dependencies)if(o.has(g)){let y=s.get(g);y&&y.push(p.id);}}let n=new Map;for(let p of r)n.set(p.id,0);for(let p of r)if(p.dependencies)for(let g of p.dependencies)o.has(g)&&n.set(p.id,(n.get(p.id)||0)+1);let i=new Map,c=[],l=[];for(let p of r)(n.get(p.id)||0)===0&&l.push(p.id);for(;l.length>0;){let p=l.shift();c.push(p);let g=o.get(p);if(!g||!g.startDate||!g.endDate)continue;let y=De.calculateDuration(g.startDate,g.endDate),x=0;if(g.dependencies)for(let f of g.dependencies){let b=i.get(f);b&&(x=Math.max(x,b.ef));}i.set(p,{es:x,ef:x+y});let h=s.get(p)||[];for(let f of h){let b=(n.get(f)||1)-1;n.set(f,b),b===0&&l.push(f);}}if(c.length<r.length)return t;let m=Math.max(...Array.from(i.values()).map(p=>p.ef)),d=new Map;for(let p=c.length-1;p>=0;p--){let g=c[p];if(!g)continue;let y=o.get(g);if(!y||!y.startDate||!y.endDate)continue;let x=De.calculateDuration(y.startDate,y.endDate),h=s.get(g)||[],f=m;if(h.length>0)for(let b of h){let w=d.get(b);w&&(f=Math.min(f,w.ls));}d.set(g,{ls:f-x,lf:f});}for(let p of c){let g=i.get(p),y=d.get(p),x=y.ls-g.es,h=s.get(p)||[],f;h.length>0?f=Math.min(...h.map(b=>i.get(b).es))-g.ef:f=m-g.ef,t.set(p,{earlyStart:g.es,earlyFinish:g.ef,lateStart:y.ls,lateFinish:y.lf,totalFloat:Math.round(x*100)/100,freeFloat:Math.max(0,Math.round(f*100)/100),isCritical:x<=.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 o=De.getDependentTasks(e,t);if(o.length===0){let i=De.getLatestEndDate(e);if(!i)return null;let c=De.calculateDuration(a.endDate,i);return Math.max(0,c)}let s=o.filter(i=>i.startDate).map(i=>i.startDate.getTime()).sort((i,c)=>i-c)[0];if(!s)return null;let n=De.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>De.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let o=r||new Set;if(o.has(t))return e;o.add(t);let s=De.findTaskById(e,t);if(!s||!s.endDate)return e;let n=De.getDependentTasks(e,t);if(n.length===0)return e;let i=[...e];for(let c of n){if(o.has(c.id)||!c.startDate||!c.endDate)continue;let l=De.calculateDuration(c.startDate,c.endDate),m;if(a!==void 0?(m=new Date(c.startDate),m.setDate(m.getDate()+a)):(m=new Date(s.endDate),m.setDate(m.getDate()+1)),a!==void 0){let g=new Date(s.endDate),y=new Date(g);y.setDate(y.getDate()+1),m<y&&(m=y);}let d=De.calculateEndDate(m,l),p=g=>g.map(y=>y.id===c.id?{...y,startDate:m,endDate:d}:y.subtasks?{...y,subtasks:p(y.subtasks)}:y);i=p(i),i=De.autoScheduleDependents(i,c.id,a,o);}return i},calculateCascadePreview:(e,t,a,r,o,s,n,i)=>{if(a===0)return [];let c=[],l=o.getTime(),m=1e3*60*60*24,d=De.findTaskById(e,t);if(!d||!d.endDate)return [];let p=(g,y,x=new Set)=>{if(x.has(g))return;x.add(g);let h=De.getDependentTasks(e,g);for(let f of h){if(!f.startDate||!f.endDate)continue;let b=r.findIndex(D=>D.id===f.id);if(b===-1)continue;let w=f.startDate.getTime(),N=(f.endDate.getTime()-w)/m,k=(w-l)/m*s,v=k+y*s,E=Math.max(N*s,s),I=i+b*n+(n-18)/2;c.push({taskId:f.id,taskName:f.name,originalX:k,previewX:v,width:E,y:I,rowIndex:b,daysDelta:y,color:f.color}),p(f.id,y,x);}};return p(t,a),c},splitTask:(e,t,a,r=3)=>{let o=De.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let i=new Date(o.endDate);i.setDate(i.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:i}],l=m=>m.map(d=>d.id===o.id?{...d,endDate:i,segments:c}:d.subtasks?{...d,subtasks:l(d.subtasks)}:d);return l(e)}};function Mi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:i="en",templates:c,dependencyLineStyle:l="curved",showTaskBarLabels:m=true,onTaskClick:d,onTaskDblClick:p,onTaskContextMenu:g,onTaskDateChange:y,onDependencyCreate:x,onDependencyDelete:h,showBaseline:f,showCriticalPath:b=true,showDependencies:w=true,highlightWeekends:C=true,canEditTask:N}){let k=Rr(),v=useRef(null),[E,I]=useState([]),[D,X]=useState(null),[O,H]=useState(null),[F,Y]=useState(null),Z=useRef(false),[Se,R]=useState(new Set),[_,he]=useState(null),Je=useCallback($=>{if(F&&!Z.current){let de=$.target,S=false;for(;de&&de!==$.currentTarget;){if(de.getAttribute?.("data-dependency-line")==="true"||de.getAttribute?.("data-dependency-hover-overlay")==="true"){S=true;break}de=de.parentElement;}S||Y(null);}},[F]),z=useCallback($=>{H($);},[]),re=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),J=r==="day"?60:r==="week"?20:8,Pe=re*J*n,ve=$=>{let de=new Date(Date.UTC($.getFullYear(),$.getMonth(),$.getDate())),S=de.getUTCDay()||7;de.setUTCDate(de.getUTCDate()+4-S);let q=new Date(Date.UTC(de.getUTCFullYear(),0,1));return Math.ceil(((de.getTime()-q.getTime())/864e5+1)/7)},We=$=>{let de=$.getDay();return de===0||de===6},Re=useCallback($=>{let de=Math.round($/(J*n)),S=new Date(o);return S.setDate(S.getDate()+de),S},[o,J,n]),st=useCallback(($,de)=>{if(de.startDate&&de.endDate)return;let S=$.currentTarget.ownerSVGElement;if(!S)return;let q=S.createSVGPoint();q.x=$.clientX,q.y=$.clientY;let ce=q.matrixTransform(S.getScreenCTM()?.inverse()),Ce=Re(ce.x),W=new Date(Ce);W.setDate(W.getDate()+1),he(null),y?.(de,Ce,W);},[Re,y]),ee=useCallback(($,de,S)=>{let q=$.currentTarget.ownerSVGElement;if(!q)return;let ce=q.createSVGPoint();ce.x=$.clientX,ce.y=$.clientY;let Ce=ce.matrixTransform(q.getScreenCTM()?.inverse()),W=Re(Ce.x),Ge=Math.round(Ce.x/(J*n))*J*n;he({taskId:de.id,x:Ge,y:S*a+a/2,date:W});},[Re,J,n,a]),it=useCallback(()=>{he(null);},[]),le=useMemo(()=>{let $=ce=>ce.map(Ce=>{if(Ce.subtasks&&Ce.subtasks.length>0){let W=$(Ce.subtasks),te=W.filter(Ge=>Ge.startDate&&Ge.endDate);if(te.length>0){let Ge=te.map(Ve=>Ve.startDate.getTime()),Te=te.map(Ve=>Ve.endDate.getTime()),Ue=new Date(Math.min(...Ge)),Ne=new Date(Math.max(...Te));return {...Ce,subtasks:W,startDate:Ue,endDate:Ne}}return {...Ce,subtasks:W}}return Ce}),de=(ce,Ce=[])=>{let W=[...ce].sort((te,Ge)=>(te.position??0)-(Ge.position??0));for(let te of W)Ce.push(te),te.subtasks&&te.subtasks.length>0&&(te.isExpanded===void 0||te.isExpanded)&&de(te.subtasks,Ce);return Ce},S=$(e);return de(S)},[e]),ot=useCallback($=>{if(!$.startDate||!$.endDate)return {x:0,width:0};let de=$.startDate.getTime(),S=$.endDate.getTime(),q=o.getTime(),ce=(de-q)/(1e3*60*60*24),Ce=(S-de)/(1e3*60*60*24)+1,W=ce*J*n,te=Math.max(J*n,40),Ge=Math.max(Ce*J*n,te);return {x:W,width:Ge}},[o,J,n]),yt=useMemo(()=>le.filter($=>$.startDate&&$.endDate).map($=>{let{x:de,width:S}=ot($),ce=le.findIndex(Ce=>Ce.id===$.id)*a+(a-18)/2;return {id:$.id,x:de,y:ce,width:S,height:18}}),[le,ot]),Pt=useCallback(($,de,S)=>{if(!S){I([]),X(null);return}if(X({taskId:$,daysDelta:de}),de===0){I([]);return}let q=De.calculateCascadePreview(e,$,de,le,o,J*n,a,48);I(q);},[e,le,o,J,n,a,48]),ke=useCallback(($,de)=>{if(!D)return de;let S=J*n,q=D.daysDelta*S;if($===D.taskId)return {x:de.x+q,width:de.width};let ce=E.find(Ce=>Ce.taskId===$);return ce?{x:ce.previewX,width:ce.width}:de},[D,E,J,n]),xt=useMemo(()=>{let $=[],de=new Date(o);for(;de<=s;){let ce=(de.getTime()-o.getTime())/864e5*J*n;if(r==="day")$.push({date:new Date(de),label:de.toLocaleDateString(i,{day:"numeric",month:"short"}),x:ce}),de.setDate(de.getDate()+1);else if(r==="week"){let Ce=ve(de);$.push({date:new Date(de),label:`${k.labels.week} ${Ce}`,x:ce}),de.setDate(de.getDate()+7);}else $.push({date:new Date(de),label:de.toLocaleDateString(i,{month:"short",year:"numeric"}),x:ce}),de.setMonth(de.getMonth()+1);}return $},[o,s,r,J,n,i,k.labels.week]),ct=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*J*n,[o,J,n]),rt=Math.max(le.length*a,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(Pe,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(Pe,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),xt.map(($,de)=>jsxs("g",{children:[de>0&&jsx("line",{x1:$.x,y1:0,x2:$.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:$.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:$.label})]},`header-${de}`)),ct>=0&&ct<=Pe&&jsxs("g",{children:[jsx("circle",{cx:ct,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:ct,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${ct-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:k.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:v,width:Math.max(Pe,1e3),height:rt,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Je,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:"#2E94FF",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(Pe,1e3),height:rt,fill:t.bgPrimary}),le.map(($,de)=>jsx("rect",{x:0,y:de*a,width:Math.max(Pe,1e3),height:a,fill:de%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${$.id}`)),xt.map(($,de)=>de>0?jsx("line",{x1:$.x,y1:0,x2:$.x,y2:le.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${de}`):null),C&&xt.map(($,de)=>{let S=xt[de+1]?.x||Pe;return We($.date)?jsxs("g",{children:[jsx("rect",{x:$.x,y:0,width:S-$.x,height:le.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:$.x,y:0,width:S-$.x,height:le.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${de}`):null}),le.map(($,de)=>{let S=$.startDate&&$.endDate;return jsx("g",{children:!S&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:de*a,width:Pe,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:q=>st(q,$),onMouseMove:q=>ee(q,$,de),onMouseLeave:()=>{it();}},`clickable-${$.id}`),_&&_.taskId===$.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:_.x,y1:de*a+4,x2:_.x,y2:de*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:_.x,cy:_.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:_.x,cy:_.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${_.x}, ${de*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:_.date.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!_||_.taskId!==$.id)&&jsx("text",{x:ct>0?ct:100,y:de*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:k.labels.clickToSetDates},`placeholder-${$.id}`)]})},`row-group-${$.id}`)}),le.map(($,de)=>{if(!$.startDate||!$.endDate)return null;let{x:S,width:q}=ot($),ce=de*a+(a-18)/2,Ce=$.subtasks&&$.subtasks.length>0&&!$.isMilestone;if($.isMilestone)return jsx(Si,{task:$,x:S+q/2,y:ce+12,theme:t,onClick:d},$.id);if(Ce){let W=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),te=8,Ge=ce+(a-18)/2+(18-te)/2,Te=4,Ue=$.progress||0,Ne=new Date;Ne.setHours(0,0,0,0);let Ve=$.startDate&&Ne>=$.startDate,Tt=$.endDate&&(()=>{let ft=new Date($.endDate);return ft.setHours(0,0,0,0),Ne>ft})(),gt=$.startDate&&Ne<$.startDate,nt=1;if(Ve&&$.startDate&&$.endDate&&!gt){let ft=new Date($.startDate);ft.setHours(0,0,0,0);let Wt=new Date($.endDate);Wt.setHours(0,0,0,0);let Oe=Math.max(1,(Wt.getTime()-ft.getTime())/(1e3*60*60*24)),ut=Math.min((Ne.getTime()-ft.getTime())/(1e3*60*60*24),Oe)/Oe*100;nt=ut>0?Ue/ut:1;}let et;Ue>=100?et="#00E5CC":gt?et="#4B5563":Tt&&Ue<100?et="#EF4444":nt>=.95?et="#22C55E":nt>=.8?et="#F59E0B":et="#EF4444";let qt=Math.max(Ue/100*q,Ue>0?Te*2:0),At=q>100&&Ue>0,vt=$.isCriticalPath;return jsxs("g",{onClick:()=>d?.($),onContextMenu:ft=>{ft.preventDefault(),ft.stopPropagation(),g?.($,ft);},onMouseMove:ft=>{z({task:$,x:S,y:Ge,width:q,height:te,showBelow:Ge<100,mouseX:ft.clientX,mouseY:ft.clientY});},onMouseLeave:()=>z(null),style:{cursor:"default",opacity:b?vt?1:.25:1,transition:"opacity 300ms ease"},children:[jsx("rect",{x:S,y:ce,width:q,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:S,y:Ge,width:q,height:te,rx:Te,fill:W?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),Ue>0&&jsx("rect",{x:S,y:Ge,width:qt,height:te,rx:Te,fill:et}),b&&vt&&jsx("rect",{x:S,y:Ge,width:q,height:te,rx:Te,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),At&&jsxs("text",{x:S+qt+6,y:Ge+te/2,dominantBaseline:"central",fill:W?"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(Ue),"%"]})]},$.id)}return jsx(ki,{task:$,x:S,y:ce,width:q,theme:t,dayWidth:J*n,startDate:o,templates:c,onClick:d,onDoubleClick:p,onContextMenu:g,onDateChange:y,onDependencyCreate:x,allTaskPositions:yt,onDragMove:Pt,onHoverChange:z,showBaseline:f,showTaskBarLabels:m,showCriticalPath:b,readOnly:N?!N($):false},$.id)}),w&&le.map(($,de)=>!$.dependencies||$.dependencies.length===0||!$.startDate||!$.endDate?null:$.dependencies.map(S=>{let q=le.find(et=>et.id===S);if(!q||!q.startDate||!q.endDate)return null;let ce=le.findIndex(et=>et.id===S),Ce=ke(q.id,ot(q)),W=ke($.id,ot($)),te=Ce.x+Ce.width,Ge=ce*a+26,Te=W.x,Ue=de*a+26,Ne=`dep-${S}-${$.id}`;if(Se.has(Ne))return null;let Ve=b&&$.isCriticalPath&&q.isCriticalPath;return jsx(fs,{x1:te,y1:Ge,x2:Te,y2:Ue,theme:t,lineStyle:l,colorOverride:b?Ve?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:b?Ve?2:1:void 0,glowFilter:Ve?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.($.id,S),onHoverChange:et=>{Z.current=et,et&&Y({key:Ne,fromId:S,toId:$.id,exitX:te,exitY:Ge,enterX:Te,enterY:Ue});}},Ne)})),E.map($=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:$.previewX,y:$.y-48,width:$.width,height:18,rx:6,fill:$.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs($.daysDelta)>0&&jsx("text",{x:$.previewX+$.width/2,y:$.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:$.daysDelta>0?`+${$.daysDelta}d`:`${$.daysDelta}d`})]},`cascade-preview-${$.taskId}`)),w&&F&&jsx(fs,{x1:F.exitX,y1:F.exitY,x2:F.enterX,y2:F.enterY,theme:t,lineStyle:l,onDelete:()=>{let $=F.key;Y(null),Z.current=false,R(de=>new Set(de).add($)),h?.(F.toId,F.fromId);},hoverOverlayOnly:true,onHoverChange:$=>{Z.current=$,$||Y(null);}},`${F.key}-hover-overlay`),ct>=0&&ct<=Pe&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:ct,y1:0,x2:ct,y2:rt,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:ct,y1:0,x2:ct,y2:rt,stroke:t.today,strokeWidth:1,opacity:1})]})]}),O&&jsx(hm,{tooltipData:O,theme:t,locale:i==="es"?"es":"en"})]})}var Ev=['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"'],vm=({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"})}),Mv=()=>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"})}),Fv=()=>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"})}),Pv=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Av=()=>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 Ai({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:i,onDependencyDelete:c}){let[l,m]=useState(false),[d,p]=useState(false),[g,y]=useState([]),[x,h]=useState(""),[f,b]=useState(false),[w,C]=useState(true),[N,T]=useState(""),[k,v]=useState(-1),[E,I]=useState(false),[D,X]=useState(0),O=useRef(null),H=useRef(null),F=useRef(null),Y=useRef(null),{enabled:Z=true,placeholder:Se='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:_,suggestions:he=Ev,maxHistory:Je=50,persistHistory:z,mentionableUsers:re=[]}=a,J=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Pe=J?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",ve=J?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",We=J?"0 0 20px rgba(46, 148, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(46, 148, 255, 0.04)":"0 0 20px rgba(46, 148, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",Re=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",st=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ee=J?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",it=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",le=J?"rgba(46, 148, 255, 0.9)":"#2E94FF",ot=J?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",yt=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Pt=J?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(46, 148, 255, 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(46, 148, 255, 0.04)",ke=J?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",xt=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",ct=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",rt=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",$=J?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",de=J?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",S=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)",ce=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Ce="rgba(46, 148, 255, 0.04)",W=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",te=J?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ge=J?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",Te=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Ue=J?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Ne=J?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Ve=J?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",Tt=J?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",gt="rgba(46, 148, 255, 0.06)",nt=J?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",et=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",qt=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",At=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",vt=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",Dt=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",ft=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Wt=J?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Oe=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Le=J?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",ut=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ne=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",fe=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",L=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",j=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",K=z?.storageKey||"gantt-ai-history",me=z?.maxMessages??5,Me=re.filter(U=>{if(!N)return true;let oe=N.toLowerCase();return U.name.toLowerCase().includes(oe)||U.email&&U.email.toLowerCase().includes(oe)}).slice(0,5),qe=useCallback(U=>{if(h(U),re.length===0)return;let oe=O.current;if(!oe)return;let $e=oe.selectionStart||U.length,A=U.slice(0,$e),ge=A.lastIndexOf("@");if(ge>=0&&((ge>0?A[ge-1]:" ")===" "||ge===0)){let tt=A.slice(ge+1);if(tt.length<=40){T(tt),v(ge),I(true),X(0);return}}I(false),T(""),v(-1);},[re.length]),_e=useCallback(U=>{let oe=x.slice(0,k),$e=x.slice(k+1+N.length),A=`${oe}@${U.name} ${$e}`;h(A),I(false),T(""),v(-1),setTimeout(()=>O.current?.focus(),0);},[x,k,N]),Ie=useCallback(U=>{if(!E||Me.length===0)return false;if(U.key==="ArrowDown")return U.preventDefault(),X(oe=>oe<Me.length-1?oe+1:0),true;if(U.key==="ArrowUp")return U.preventDefault(),X(oe=>oe>0?oe-1:Me.length-1),true;if(U.key==="Enter"||U.key==="Tab"){U.preventDefault();let oe=Me[D];return oe&&_e(oe),true}return U.key==="Escape"?(I(false),true):false},[E,Me,D,_e]);useEffect(()=>{if(z?.enabled)try{let U=localStorage.getItem(K);if(U){let $e=JSON.parse(U).map(A=>({...A,timestamp:new Date(A.timestamp)}));y($e.slice(-me));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[z?.enabled,K,me]),useEffect(()=>{if(z?.enabled&&g.length>0)try{let U=g.filter(oe=>!oe.isLoading).slice(-me);localStorage.setItem(K,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[g,z?.enabled,K,me]),useEffect(()=>{H.current&&H.current.scrollIntoView({behavior:"smooth"});},[g]),useEffect(()=>{l&&!d&&O.current&&setTimeout(()=>O.current?.focus(),100);},[l,d]);let bt=useCallback(U=>{if(U.success)switch(U.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":U.taskId&&U.updates&&o?.(U.taskId,U.updates);break;case "create_task":U.newTask&&s?.(U.newTask);break;case "delete_task":U.taskId&&n?.(U.taskId);break;case "link_tasks":U.dependencyFrom&&U.dependencyTo&&i?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&c?.(U.taskId,U.dependencyFrom);break}},[o,s,n,i,c]),Nt=useCallback(async U=>{if(!U.trim()||f)return;let oe={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};y(A=>[...A.slice(-(Je-1)),oe]),h(""),C(false),b(true);let $e={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(A=>[...A,$e]);try{if(_){let A=await _(U,e);y(ge=>{let je=ge.filter(oa=>!oa.isLoading),tt={id:`assistant-${Date.now()}`,role:"assistant",content:A.message,timestamp:new Date,command:A};return [...je,tt]}),bt(A);}else y(A=>[...A.filter(je=>!je.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(A){y(ge=>[...ge.filter(tt=>!tt.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${A instanceof Error?A.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[f,Je,_,e,bt]),Ut=U=>{U.preventDefault(),Nt(x);},Ta=U=>{h(U),O.current?.focus();};if(useEffect(()=>{let U=oe=>{(oe.metaKey||oe.ctrlKey)&&oe.key==="k"&&(oe.preventDefault(),m($e=>!$e),l||p(false)),oe.key==="Escape"&&l&&m(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[l]),useEffect(()=>{if(!l)return;let U=$e=>{let A=$e.target;F.current&&!F.current.contains(A)&&m(false);},oe=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(oe),document.removeEventListener("mousedown",U);}},[l]),!Z)return null;let ta={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxs(Xt,{children:[jsx(AnimatePresence,{children:!l&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${ta[R]} 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 ${ve}`,color:"#2E94FF",cursor:"pointer",boxShadow:We,overflow:"visible"},onClick:()=>m(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${Re}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${st}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(vm,{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:le,background:ee,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${it}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
|
|
361
|
+
</Project>`,m=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(m),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=Se.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let m=i.startDate&&i.endDate?Se.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let y=t.find(x=>x.id===g);if(y){o(y);let x=r.get(g)?.ef||0;d=Math.max(d,x);}}let p=d+m;r.set(i.id,{es:d,ef:p});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let m=i.startDate&&i.endDate?Se.calculateDuration(i.startDate,i.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(i.id)),p=s;if(d.length>0)for(let y of d){l(y);let x=n.get(y.id)?.ls||0;p=Math.min(p,x);}let g=p-m;n.set(i.id,{ls:g,lf:p});};a.forEach(l);let c=[];for(let i of a){let m=r.get(i.id),d=n.get(i.id);if(m&&d){let p=d.ls-m.es;Math.abs(p)<.01&&c.push(i.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=Se.flattenTasks(e).filter(p=>p.startDate&&p.endDate);if(r.length===0)return t;let o=new Map(r.map(p=>[p.id,p])),s=new Map;for(let p of r)s.has(p.id)||s.set(p.id,[]);for(let p of r)if(p.dependencies){for(let g of p.dependencies)if(o.has(g)){let y=s.get(g);y&&y.push(p.id);}}let n=new Map;for(let p of r)n.set(p.id,0);for(let p of r)if(p.dependencies)for(let g of p.dependencies)o.has(g)&&n.set(p.id,(n.get(p.id)||0)+1);let l=new Map,c=[],i=[];for(let p of r)(n.get(p.id)||0)===0&&i.push(p.id);for(;i.length>0;){let p=i.shift();c.push(p);let g=o.get(p);if(!g||!g.startDate||!g.endDate)continue;let y=Se.calculateDuration(g.startDate,g.endDate),x=0;if(g.dependencies)for(let f of g.dependencies){let b=l.get(f);b&&(x=Math.max(x,b.ef));}l.set(p,{es:x,ef:x+y});let h=s.get(p)||[];for(let f of h){let b=(n.get(f)||1)-1;n.set(f,b),b===0&&i.push(f);}}if(c.length<r.length)return t;let m=Math.max(...Array.from(l.values()).map(p=>p.ef)),d=new Map;for(let p=c.length-1;p>=0;p--){let g=c[p];if(!g)continue;let y=o.get(g);if(!y||!y.startDate||!y.endDate)continue;let x=Se.calculateDuration(y.startDate,y.endDate),h=s.get(g)||[],f=m;if(h.length>0)for(let b of h){let w=d.get(b);w&&(f=Math.min(f,w.ls));}d.set(g,{ls:f-x,lf:f});}for(let p of c){let g=l.get(p),y=d.get(p),x=y.ls-g.es,h=s.get(p)||[],f;h.length>0?f=Math.min(...h.map(b=>l.get(b).es))-g.ef:f=m-g.ef,t.set(p,{earlyStart:g.es,earlyFinish:g.ef,lateStart:y.ls,lateFinish:y.lf,totalFloat:Math.round(x*100)/100,freeFloat:Math.max(0,Math.round(f*100)/100),isCritical:x<=.01});}return t},calculateSlack:(e,t)=>{let a=Se.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Se.calculateCriticalPath(e).includes(t))return 0;let o=Se.getDependentTasks(e,t);if(o.length===0){let l=Se.getLatestEndDate(e);if(!l)return null;let c=Se.calculateDuration(a.endDate,l);return Math.max(0,c)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,c)=>l-c)[0];if(!s)return null;let n=Se.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Se.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let o=r||new Set;if(o.has(t))return e;o.add(t);let s=Se.findTaskById(e,t);if(!s||!s.endDate)return e;let n=Se.getDependentTasks(e,t);if(n.length===0)return e;let l=[...e];for(let c of n){if(o.has(c.id)||!c.startDate||!c.endDate)continue;let i=Se.calculateDuration(c.startDate,c.endDate),m;if(a!==void 0?(m=new Date(c.startDate),m.setDate(m.getDate()+a)):(m=new Date(s.endDate),m.setDate(m.getDate()+1)),a!==void 0){let g=new Date(s.endDate),y=new Date(g);y.setDate(y.getDate()+1),m<y&&(m=y);}let d=Se.calculateEndDate(m,i),p=g=>g.map(y=>y.id===c.id?{...y,startDate:m,endDate:d}:y.subtasks?{...y,subtasks:p(y.subtasks)}:y);l=p(l),l=Se.autoScheduleDependents(l,c.id,a,o);}return l},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let c=[],i=o.getTime(),m=1e3*60*60*24,d=Se.findTaskById(e,t);if(!d||!d.endDate)return [];let p=(g,y,x=new Set)=>{if(x.has(g))return;x.add(g);let h=Se.getDependentTasks(e,g);for(let f of h){if(!f.startDate||!f.endDate)continue;let b=r.findIndex(S=>S.id===f.id);if(b===-1)continue;let w=f.startDate.getTime(),N=(f.endDate.getTime()-w)/m,k=(w-i)/m*s,v=k+y*s,E=Math.max(N*s,s),I=l+b*n+(n-18)/2;c.push({taskId:f.id,taskName:f.name,originalX:k,previewX:v,width:E,y:I,rowIndex:b,daysDelta:y,color:f.color}),p(f.id,y,x);}};return p(t,a),c},splitTask:(e,t,a,r=3)=>{let o=Se.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let n=new Date(a);n.setDate(n.getDate()+r);let l=new Date(o.endDate);l.setDate(l.getDate()+r);let c=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=m=>m.map(d=>d.id===o.id?{...d,endDate:l,segments:c}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Pi({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:c,dependencyLineStyle:i="curved",showTaskBarLabels:m=true,onTaskClick:d,onTaskDblClick:p,onTaskContextMenu:g,onTaskDateChange:y,onDependencyCreate:x,onDependencyDelete:h,showBaseline:f,showCriticalPath:b=true,showDependencies:w=true,highlightWeekends:C=true,canEditTask:N}){let k=Rr(),v=useRef(null),[E,I]=useState([]),[S,X]=useState(null),[O,$]=useState(null),[F,Y]=useState(null),Z=useRef(false),[Ee,R]=useState(new Set),[_,ye]=useState(null),Je=useCallback(H=>{if(F&&!Z.current){let le=H.target,D=false;for(;le&&le!==H.currentTarget;){if(le.getAttribute?.("data-dependency-line")==="true"||le.getAttribute?.("data-dependency-hover-overlay")==="true"){D=true;break}le=le.parentElement;}D||Y(null);}},[F]),z=useCallback(H=>{$(H);},[]),re=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),J=r==="day"?60:r==="week"?20:8,Ae=re*J*n,ve=H=>{let le=new Date(Date.UTC(H.getFullYear(),H.getMonth(),H.getDate())),D=le.getUTCDay()||7;le.setUTCDate(le.getUTCDate()+4-D);let K=new Date(Date.UTC(le.getUTCFullYear(),0,1));return Math.ceil(((le.getTime()-K.getTime())/864e5+1)/7)},ze=H=>{let le=H.getDay();return le===0||le===6},Be=useCallback(H=>{let le=Math.round(H/(J*n)),D=new Date(o);return D.setDate(D.getDate()+le),D},[o,J,n]),st=useCallback((H,le)=>{if(le.startDate&&le.endDate)return;let D=H.currentTarget.ownerSVGElement;if(!D)return;let K=D.createSVGPoint();K.x=H.clientX,K.y=H.clientY;let pe=K.matrixTransform(D.getScreenCTM()?.inverse()),Te=Be(pe.x),G=new Date(Te);G.setDate(G.getDate()+1),ye(null),y?.(le,Te,G);},[Be,y]),ee=useCallback((H,le,D)=>{let K=H.currentTarget.ownerSVGElement;if(!K)return;let pe=K.createSVGPoint();pe.x=H.clientX,pe.y=H.clientY;let Te=pe.matrixTransform(K.getScreenCTM()?.inverse()),G=Be(Te.x),Re=Math.round(Te.x/(J*n))*J*n;ye({taskId:le.id,x:Re,y:D*a+a/2,date:G});},[Be,J,n,a]),it=useCallback(()=>{ye(null);},[]),de=useMemo(()=>{let H=pe=>pe.map(Te=>{if(Te.subtasks&&Te.subtasks.length>0){let G=H(Te.subtasks),te=G.filter(Re=>Re.startDate&&Re.endDate);if(te.length>0){let Re=te.map(_e=>_e.startDate.getTime()),De=te.map(_e=>_e.endDate.getTime()),Ue=new Date(Math.min(...Re)),Fe=new Date(Math.max(...De));return {...Te,subtasks:G,startDate:Ue,endDate:Fe}}return {...Te,subtasks:G}}return Te}),le=(pe,Te=[])=>{let G=[...pe].sort((te,Re)=>(te.position??0)-(Re.position??0));for(let te of G)Te.push(te),te.subtasks&&te.subtasks.length>0&&(te.isExpanded===void 0||te.isExpanded)&&le(te.subtasks,Te);return Te},D=H(e);return le(D)},[e]),lt=useCallback(H=>{if(!H.startDate||!H.endDate)return {x:0,width:0};let le=H.startDate.getTime(),D=H.endDate.getTime(),K=o.getTime(),pe=(le-K)/(1e3*60*60*24),Te=(D-le)/(1e3*60*60*24)+1,G=pe*J*n,te=Math.max(J*n,40),Re=Math.max(Te*J*n,te);return {x:G,width:Re}},[o,J,n]),rt=useMemo(()=>de.filter(H=>H.startDate&&H.endDate).map(H=>{let{x:le,width:D}=lt(H),pe=de.findIndex(Te=>Te.id===H.id)*a+(a-18)/2;return {id:H.id,x:le,y:pe,width:D,height:18}}),[de,lt]),At=useCallback((H,le,D)=>{if(!D){I([]),X(null);return}if(X({taskId:H,daysDelta:le}),le===0){I([]);return}let K=Se.calculateCascadePreview(e,H,le,de,o,J*n,a,48);I(K);},[e,de,o,J,n,a,48]),we=useCallback((H,le)=>{if(!S)return le;let D=J*n,K=S.daysDelta*D;if(H===S.taskId)return {x:le.x+K,width:le.width};let pe=E.find(Te=>Te.taskId===H);return pe?{x:pe.previewX,width:pe.width}:le},[S,E,J,n]),vt=useMemo(()=>{let H=[],le=new Date(o);for(;le<=s;){let pe=(le.getTime()-o.getTime())/864e5*J*n;if(r==="day")H.push({date:new Date(le),label:le.toLocaleDateString(l,{day:"numeric",month:"short"}),x:pe}),le.setDate(le.getDate()+1);else if(r==="week"){let Te=ve(le);H.push({date:new Date(le),label:`${k.labels.week} ${Te}`,x:pe}),le.setDate(le.getDate()+7);}else H.push({date:new Date(le),label:le.toLocaleDateString(l,{month:"short",year:"numeric"}),x:pe}),le.setMonth(le.getMonth()+1);}return H},[o,s,r,J,n,l,k.labels.week]),gt=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*J*n,[o,J,n]),tt=Math.max(de.length*a,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(Ae,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(Ae,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),vt.map((H,le)=>jsxs("g",{children:[le>0&&jsx("line",{x1:H.x,y1:0,x2:H.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:H.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:H.label})]},`header-${le}`)),gt>=0&><=Ae&&jsxs("g",{children:[jsx("circle",{cx:gt,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:gt,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${gt-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:k.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:v,width:Math.max(Ae,1e3),height:tt,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Je,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:"#2E94FF",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(Ae,1e3),height:tt,fill:t.bgPrimary}),de.map((H,le)=>jsx("rect",{x:0,y:le*a,width:Math.max(Ae,1e3),height:a,fill:le%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${H.id}`)),vt.map((H,le)=>le>0?jsx("line",{x1:H.x,y1:0,x2:H.x,y2:de.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${le}`):null),C&&vt.map((H,le)=>{let D=vt[le+1]?.x||Ae;return ze(H.date)?jsxs("g",{children:[jsx("rect",{x:H.x,y:0,width:D-H.x,height:de.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:H.x,y:0,width:D-H.x,height:de.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${le}`):null}),de.map((H,le)=>{let D=H.startDate&&H.endDate;return jsx("g",{children:!D&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:le*a,width:Ae,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:K=>st(K,H),onMouseMove:K=>ee(K,H,le),onMouseLeave:()=>{it();}},`clickable-${H.id}`),_&&_.taskId===H.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:_.x,y1:le*a+4,x2:_.x,y2:le*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:_.x,cy:_.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:_.x,cy:_.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${_.x}, ${le*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:_.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!_||_.taskId!==H.id)&&jsx("text",{x:gt>0?gt:100,y:le*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:k.labels.clickToSetDates},`placeholder-${H.id}`)]})},`row-group-${H.id}`)}),de.map((H,le)=>{if(!H.startDate||!H.endDate)return null;let{x:D,width:K}=lt(H),pe=le*a+(a-18)/2,Te=H.subtasks&&H.subtasks.length>0&&!H.isMilestone;if(H.isMilestone)return jsx(Mi,{task:H,x:D+K/2,y:pe+12,theme:t,onClick:d},H.id);if(Te){let G=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),te=8,Re=pe+(a-18)/2+(18-te)/2,De=4,Ue=H.progress||0,Fe=new Date;Fe.setHours(0,0,0,0);let _e=H.startDate&&Fe>=H.startDate,ft=H.endDate&&(()=>{let bt=new Date(H.endDate);return bt.setHours(0,0,0,0),Fe>bt})(),dt=H.startDate&&Fe<H.startDate,ut=1;if(_e&&H.startDate&&H.endDate&&!dt){let bt=new Date(H.startDate);bt.setHours(0,0,0,0);let Ut=new Date(H.endDate);Ut.setHours(0,0,0,0);let Ge=Math.max(1,(Ut.getTime()-bt.getTime())/(1e3*60*60*24)),nt=Math.min((Fe.getTime()-bt.getTime())/(1e3*60*60*24),Ge)/Ge*100;ut=nt>0?Ue/nt:1;}let at;Ue>=100?at="#00E5CC":dt?at="#4B5563":ft&&Ue<100?at="#EF4444":ut>=.95?at="#22C55E":ut>=.8?at="#F59E0B":at="#EF4444";let Vt=Math.max(Ue/100*K,Ue>0?De*2:0),Mt=K>100&&Ue>0,Dt=H.isCriticalPath;return jsxs("g",{onClick:()=>d?.(H),onContextMenu:bt=>{bt.preventDefault(),bt.stopPropagation(),g?.(H,bt);},onMouseMove:bt=>{z({task:H,x:D,y:Re,width:K,height:te,showBelow:Re<100,mouseX:bt.clientX,mouseY:bt.clientY});},onMouseLeave:()=>z(null),style:{cursor:"default",opacity:b?Dt?1:.25:1,transition:"opacity 300ms ease"},children:[jsx("rect",{x:D,y:pe,width:K,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:D,y:Re,width:K,height:te,rx:De,fill:G?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),Ue>0&&jsx("rect",{x:D,y:Re,width:Vt,height:te,rx:De,fill:at}),b&&Dt&&jsx("rect",{x:D,y:Re,width:K,height:te,rx:De,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Mt&&jsxs("text",{x:D+Vt+6,y:Re+te/2,dominantBaseline:"central",fill:G?"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(Ue),"%"]})]},H.id)}return jsx(Ti,{task:H,x:D,y:pe,width:K,theme:t,dayWidth:J*n,startDate:o,templates:c,onClick:d,onDoubleClick:p,onContextMenu:g,onDateChange:y,onDependencyCreate:x,allTaskPositions:rt,onDragMove:At,onHoverChange:z,showBaseline:f,showTaskBarLabels:m,showCriticalPath:b,readOnly:N?!N(H):false},H.id)}),w&&de.map((H,le)=>!H.dependencies||H.dependencies.length===0||!H.startDate||!H.endDate?null:H.dependencies.map(D=>{let K=de.find(at=>at.id===D);if(!K||!K.startDate||!K.endDate)return null;let pe=de.findIndex(at=>at.id===D),Te=we(K.id,lt(K)),G=we(H.id,lt(H)),te=Te.x+Te.width,Re=pe*a+26,De=G.x,Ue=le*a+26,Fe=`dep-${D}-${H.id}`;if(Ee.has(Fe))return null;let _e=b&&H.isCriticalPath&&K.isCriticalPath;return jsx(hs,{x1:te,y1:Re,x2:De,y2:Ue,theme:t,lineStyle:i,colorOverride:b?_e?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:b?_e?2:1:void 0,glowFilter:_e?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>h?.(H.id,D),onHoverChange:at=>{Z.current=at,at&&Y({key:Fe,fromId:D,toId:H.id,exitX:te,exitY:Re,enterX:De,enterY:Ue});}},Fe)})),E.map(H=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:H.previewX,y:H.y-48,width:H.width,height:18,rx:6,fill:H.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(H.daysDelta)>0&&jsx("text",{x:H.previewX+H.width/2,y:H.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:H.daysDelta>0?`+${H.daysDelta}d`:`${H.daysDelta}d`})]},`cascade-preview-${H.taskId}`)),w&&F&&jsx(hs,{x1:F.exitX,y1:F.exitY,x2:F.enterX,y2:F.enterY,theme:t,lineStyle:i,onDelete:()=>{let H=F.key;Y(null),Z.current=false,R(le=>new Set(le).add(H)),h?.(F.toId,F.fromId);},hoverOverlayOnly:true,onHoverChange:H=>{Z.current=H,H||Y(null);}},`${F.key}-hover-overlay`),gt>=0&><=Ae&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:gt,y1:0,x2:gt,y2:tt,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:gt,y1:0,x2:gt,y2:tt,stroke:t.today,strokeWidth:1,opacity:1})]})]}),O&&jsx(hm,{tooltipData:O,theme:t,locale:l==="es"?"es":"en"})]})}var Ev=['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"'],vm=({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"})}),Mv=()=>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"})}),Fv=()=>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"})}),Pv=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Av=()=>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 Ii({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:c}){let[i,m]=useState(false),[d,p]=useState(false),[g,y]=useState([]),[x,h]=useState(""),[f,b]=useState(false),[w,C]=useState(true),[N,T]=useState(""),[k,v]=useState(-1),[E,I]=useState(false),[S,X]=useState(0),O=useRef(null),$=useRef(null),F=useRef(null),Y=useRef(null),{enabled:Z=true,placeholder:Ee='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:_,suggestions:ye=Ev,maxHistory:Je=50,persistHistory:z,mentionableUsers:re=[]}=a,J=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Ae=J?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",ve=J?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.25)",ze=J?"0 0 20px rgba(46, 148, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(46, 148, 255, 0.04)":"0 0 20px rgba(46, 148, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",Be=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",st=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",ee=J?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",it=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.2)",de=J?"rgba(46, 148, 255, 0.9)":"#2E94FF",lt=J?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",rt=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",At=J?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(46, 148, 255, 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(46, 148, 255, 0.04)",we=J?"rgba(46, 148, 255, 0.04)":"rgba(46, 148, 255, 0.03)",vt=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.08)",gt=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",tt=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",H=J?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",le=J?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",D=J?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",K=J?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",pe=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Te="rgba(46, 148, 255, 0.04)",G=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.12)",te=J?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Re=J?"rgba(46, 148, 255, 0.25)":"rgba(46, 148, 255, 0.3)",De=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Ue=J?"rgba(46, 148, 255, 0.15)":"rgba(46, 148, 255, 0.12)",Fe=J?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",_e=J?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",ft=J?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",dt="rgba(46, 148, 255, 0.06)",ut=J?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",at=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.1)",Vt=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Mt=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",Dt=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",wt=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",bt=J?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Ut=J?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Ge=J?"rgba(46, 148, 255, 0.1)":"rgba(46, 148, 255, 0.15)",Le=J?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",nt=J?"rgba(46, 148, 255, 0.08)":"rgba(46, 148, 255, 0.06)",oe=J?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",fe=J?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",L=J?"rgba(46, 148, 255, 0.12)":"rgba(46, 148, 255, 0.08)",j=J?"rgba(46, 148, 255, 0.2)":"rgba(46, 148, 255, 0.15)",q=z?.storageKey||"gantt-ai-history",me=z?.maxMessages??5,Ne=re.filter(U=>{if(!N)return true;let ne=N.toLowerCase();return U.name.toLowerCase().includes(ne)||U.email&&U.email.toLowerCase().includes(ne)}).slice(0,5),Xe=useCallback(U=>{if(h(U),re.length===0)return;let ne=O.current;if(!ne)return;let $e=ne.selectionStart||U.length,A=U.slice(0,$e),ge=A.lastIndexOf("@");if(ge>=0&&((ge>0?A[ge-1]:" ")===" "||ge===0)){let Ze=A.slice(ge+1);if(Ze.length<=40){T(Ze),v(ge),I(true),X(0);return}}I(false),T(""),v(-1);},[re.length]),je=useCallback(U=>{let ne=x.slice(0,k),$e=x.slice(k+1+N.length),A=`${ne}@${U.name} ${$e}`;h(A),I(false),T(""),v(-1),setTimeout(()=>O.current?.focus(),0);},[x,k,N]),Oe=useCallback(U=>{if(!E||Ne.length===0)return false;if(U.key==="ArrowDown")return U.preventDefault(),X(ne=>ne<Ne.length-1?ne+1:0),true;if(U.key==="ArrowUp")return U.preventDefault(),X(ne=>ne>0?ne-1:Ne.length-1),true;if(U.key==="Enter"||U.key==="Tab"){U.preventDefault();let ne=Ne[S];return ne&&je(ne),true}return U.key==="Escape"?(I(false),true):false},[E,Ne,S,je]);useEffect(()=>{if(z?.enabled)try{let U=localStorage.getItem(q);if(U){let $e=JSON.parse(U).map(A=>({...A,timestamp:new Date(A.timestamp)}));y($e.slice(-me));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[z?.enabled,q,me]),useEffect(()=>{if(z?.enabled&&g.length>0)try{let U=g.filter(ne=>!ne.isLoading).slice(-me);localStorage.setItem(q,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[g,z?.enabled,q,me]),useEffect(()=>{$.current&&$.current.scrollIntoView({behavior:"smooth"});},[g]),useEffect(()=>{i&&!d&&O.current&&setTimeout(()=>O.current?.focus(),100);},[i,d]);let kt=useCallback(U=>{if(U.success)switch(U.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":U.taskId&&U.updates&&o?.(U.taskId,U.updates);break;case "create_task":U.newTask&&s?.(U.newTask);break;case "delete_task":U.taskId&&n?.(U.taskId);break;case "link_tasks":U.dependencyFrom&&U.dependencyTo&&l?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&c?.(U.taskId,U.dependencyFrom);break}},[o,s,n,l,c]),pt=useCallback(async U=>{if(!U.trim()||f)return;let ne={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};y(A=>[...A.slice(-(Je-1)),ne]),h(""),C(false),b(true);let $e={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};y(A=>[...A,$e]);try{if(_){let A=await _(U,e);y(ge=>{let Ve=ge.filter(na=>!na.isLoading),Ze={id:`assistant-${Date.now()}`,role:"assistant",content:A.message,timestamp:new Date,command:A};return [...Ve,Ze]}),kt(A);}else y(A=>[...A.filter(Ve=>!Ve.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(A){y(ge=>[...ge.filter(Ze=>!Ze.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${A instanceof Error?A.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[f,Je,_,e,kt]),Wt=U=>{U.preventDefault(),pt(x);},Ta=U=>{h(U),O.current?.focus();};if(useEffect(()=>{let U=ne=>{(ne.metaKey||ne.ctrlKey)&&ne.key==="k"&&(ne.preventDefault(),m($e=>!$e),i||p(false)),ne.key==="Escape"&&i&&m(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[i]),useEffect(()=>{if(!i)return;let U=$e=>{let A=$e.target;F.current&&!F.current.contains(A)&&m(false);},ne=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(ne),document.removeEventListener("mousedown",U);}},[i]),!Z)return null;let Xt={"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(Qt,{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 ${Xt[R]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Ae,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${ve}`,color:"#2E94FF",cursor:"pointer",boxShadow:ze,overflow:"visible"},onClick:()=>m(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 ${st}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(vm,{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:de,background:ee,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${it}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
|
|
362
362
|
@keyframes ai-fab-pulse {
|
|
363
363
|
0%, 100% { transform: scale(1); opacity: 0.4; }
|
|
364
364
|
50% { transform: scale(1.15); opacity: 0; }
|
|
365
365
|
}
|
|
366
|
-
`})]})}),jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:F,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${ta[R]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:ot,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${yt}`,boxShadow:Pt},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:ke,borderBottom:`1px solid ${xt}`},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:ct,border:`1px solid ${rt}`,color:"#2E94FF"},children:jsx(vm,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:$},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>p(U=>!U),className:"p-1.5 rounded-lg transition-colors",style:{color:de},onMouseEnter:U=>{U.currentTarget.style.background=q,U.currentTarget.style.color=S;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=de;},children:jsx(Pv,{})}),jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg transition-colors",style:{color:de},onMouseEnter:U=>{U.currentTarget.style.background=q,U.currentTarget.style.color=S;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=de;},children:jsx(Fv,{})})]})]}),jsx(AnimatePresence,{children:!d&&jsxs(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&w&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:ce,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:he.slice(0,4).map((U,oe)=>jsx("button",{onClick:()=>Ta(U),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Ce,color:te,border:`1px solid ${W}`},onMouseEnter:$e=>{$e.currentTarget.style.borderColor=Ge,$e.currentTarget.style.color="#2E94FF";},onMouseLeave:$e=>{$e.currentTarget.style.borderColor=W,$e.currentTarget.style.color=te;},children:U.length>30?U.slice(0,30)+"...":U},oe))})]}),g.map(U=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${U.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${U.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:U.role==="user"?Te:Ne,color:U.role==="user"?"#2E94FF":Tt,border:U.role==="user"?`1px solid ${Ue}`:`1px solid ${Ve}`},children:[U.isLoading?jsx(Av,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:U.content}),U.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:U.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:U.command.success?"#10B981":"#EF4444",border:`1px solid ${U.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[U.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:U.command.type.replace(/_/g," ")})]})]})},U.id)),jsx("div",{ref:H})]}),jsxs("form",{onSubmit:U=>{if(E&&Me.length>0){U.preventDefault();return}Ut(U);},className:"p-3 relative",style:{borderTop:`1px solid ${gt}`},children:[jsx(AnimatePresence,{children:E&&Me.length>0&&jsx(motion.div,{ref:Y,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:Wt,border:`1px solid ${Oe}`,boxShadow:Le,backdropFilter:"blur(12px)"},children:Me.map((U,oe)=>jsxs("button",{type:"button",onClick:()=>_e(U),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:oe===D?ut:"transparent",color:ne},onMouseEnter:()=>X(oe),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:L,border:`1px solid ${j}`,color:"#2E94FF"},children:U.name.split(" ").map($e=>$e[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:U.name}),U.email&&jsx("div",{className:"text-xs truncate",style:{color:fe},children:U.email})]})]},U.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:nt,border:`1px solid ${et}`},children:[jsx("input",{ref:O,type:"text",value:x,onChange:U=>qe(U.target.value),onKeyDown:U=>{Ie(U);},placeholder:Se,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:qt,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!x.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?At:"transparent",color:x.trim()?"#2E94FF":Dt,border:x.trim()?`1px solid ${vt}`:"1px solid transparent"},children:jsx(Mv,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:ft,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function wm(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((l,m=true)=>{r(d=>{let p=typeof l=="function"?l(d.present):l;if(o.current)return {...d,present:p};if(!m)return {...d,present:p};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:p,future:[]}});},[t]),n=useCallback(()=>{r(l=>{if(l.past.length===0)return l;let m=l.past[l.past.length-1],d=l.past.slice(0,l.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:m,future:[l.present,...l.future]}});},[]),i=useCallback(()=>{r(l=>{if(l.future.length===0)return l;let m=l.future[0],d=l.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...l.past,l.present],present:m,future:d}});},[]),c=useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:i,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function km({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let i=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=i?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!i&&c&&n.key==="y"){n.preventDefault(),t();return}if(i&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Rv={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 Cm(e){return {...Rv,...e}}var Vv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Dm=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:i="comfortable",showThemeSelector:c=true,showExportButton:l=true,projectName:m,availableUsers:d=[],templates:p,enableAutoCriticalPath:g=true,persistExpandedState:y,persistFilter:x,clearFiltersKey:h,aiAssistant:f,locale:b="en",customTranslations:w,showCreateTaskButton:C=false,createTaskLabel:N,onCreateTask:T,taskFilter:k,onTaskFilterChange:v,toolbarRightContent:E,showBaseline:I,viewMode:D,onViewModeChange:X,projectForecast:O,onThemeChange:H,onTaskClick:F,onTaskDblClick:Y,onTaskContextMenu:Z,onTaskUpdate:Se,onDependentTasksScheduled:R,onProgressChange:_,onTaskEdit:he,onTaskAddSubtask:Je,onTaskMarkIncomplete:z,onTaskSetInProgress:re,onDependencyCreate:J,onDependencyDelete:Pe,onBeforeTaskAdd:ve,onAfterTaskAdd:We,onBeforeTaskUpdate:Re,onAfterTaskUpdate:st,onBeforeTaskDelete:ee,onAfterTaskDelete:it,permissions:le,onCopySnapshotLink:ot}=a,Pt=useContext(gi)?.theme,[ke,xt]=useState(Pt||s||"dark"),[ct,rt]=useState(n),[$,de]=useState(i),[S,q]=useState(1),[ce,Ce]=useState("all"),[W,te]=useState(D||"execution"),Ge=D??W,Te=useCallback(P=>{te(P),X?.(P);},[X]),Ue=I??Ge==="oracle",[Ne,Ve]=useState(a.showCriticalPath!==false),[Tt,gt]=useState(a.showDependencies!==false),[nt,et]=useState(a.highlightWeekends!==false),qt=useCallback(P=>{Ve(P),a.onShowCriticalPathChange?.(P);},[a.onShowCriticalPathChange]),At=useCallback(P=>{gt(P),a.onShowDependenciesChange?.(P);},[a.onShowDependenciesChange]),vt=useCallback(P=>{et(P),a.onHighlightWeekendsChange?.(P);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(ct);},[ct]),useEffect(()=>{a.onZoomChange?.(S);},[S]);let Dt=useRef(a.onDateRangeChange);Dt.current=a.onDateRangeChange;let ft=useCallback(()=>x?typeof x=="string"?x:"gantt-filter-state":null,[x]),[Wt,Oe]=useState(()=>{if(!x)return "all";try{let P=typeof x=="string"?x:"gantt-filter-state",B=localStorage.getItem(P);if(B){let V=JSON.parse(B);if(V.taskFilter)return V.taskFilter}}catch(P){console.warn("[GanttBoard] Error loading filter state from localStorage:",P);}return "all"}),Le=k??Wt,ut=v??Oe,[ne,fe]=useState(()=>{if(!x)return false;try{let P=typeof x=="string"?x:"gantt-filter-state",B=localStorage.getItem(P);if(B){let V=JSON.parse(B);if(typeof V.hideCompleted=="boolean")return V.hideCompleted}}catch(P){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",P);}return false});useEffect(()=>{let P=ft();if(P)try{let B={taskFilter:Le,hideCompleted:ne};localStorage.setItem(P,JSON.stringify(B));}catch(B){console.warn("[GanttBoard] Error saving filter state to localStorage:",B);}},[Le,ne,ft]);let L=useRef(h);useEffect(()=>{if(L.current!==h&&h!==void 0){Oe("all"),fe(false);let P=ft();if(P)try{localStorage.removeItem(P);}catch(B){console.warn("[GanttBoard] Error clearing filter state from localStorage:",B);}}L.current=h;},[h,ft]);let[j,K]=useState(0),[me,Me]=useState(false),[qe,_e]=useState(null),[Ie,bt]=useState({isOpen:false,x:0,y:0,task:null}),[Nt,Ut]=useState(null),[Ta,ta]=useState(null);useEffect(()=>{Pt&&Pt!==ke&&xt(Pt);},[Pt]),useEffect(()=>{s&&s!==ke&&xt(s);},[s]);let U=useCallback(P=>{xt(P),H?.(P);},[H]),{state:oe,setState:$e,undo:A,redo:ge,canUndo:je,canRedo:tt,clearHistory:oa}=wm(t,50),Gt=useMemo(()=>{let P=(B,V=0)=>{let Q=V;for(let we of B)we.subtasks?.length&&(Q=Math.max(Q,P(we.subtasks,V+1)));return Q};return P(oe)+1},[oe]),Na=useCallback(()=>y?typeof y=="string"?y:"gantt-expanded-tasks":null,[y]),Ma=useRef(new Map),Ga=useRef(false);if(!Ga.current&&y){Ga.current=true;let P=typeof y=="string"?y:"gantt-expanded-tasks";try{let B=localStorage.getItem(P);if(B){let V=JSON.parse(B);Array.isArray(V)&&(Ma.current=new Map(V));}}catch(B){console.warn("[GanttBoard] Error loading expanded state from localStorage:",B);}}let ha=useCallback(()=>{let P=Na();if(P)try{let B=Array.from(Ma.current.entries());localStorage.setItem(P,JSON.stringify(B));}catch(B){console.warn("[GanttBoard] Error saving expanded state to localStorage:",B);}},[Na]),nr=useRef(0),M=useRef(oe);useEffect(()=>{M.current=oe;},[oe]);let se=useRef(false),xe=useCallback(P=>{Ce(P),nr.current+=1,$e(B=>{let V=(we,Ae=0)=>we.map(Mt=>{let dt=P==="all"||Ae<P-1;return Mt.subtasks?.length&&Ma.current.set(Mt.id,dt),{...Mt,isExpanded:dt,subtasks:Mt.subtasks?V(Mt.subtasks,Ae+1):void 0}}),Q=V(B);return ha(),Q});},[$e,ha]);useEffect(()=>{if(nr.current>0){nr.current-=1;return}let P=V=>{let Q=new Map;for(let we of V){let Ae=we.id;Q.get(Ae)||Q.set(Ae,we);}return Array.from(Q.values())},B=V=>V.map(Q=>{let we=Ma.current.get(Q.id),Ae=we!==void 0?{...Q,isExpanded:we}:Q;if(Ae.subtasks?.length){let Mt=P(Ae.subtasks);return {...Ae,subtasks:B(Mt)}}return Ae});if(Ma.current.size>0)$e(Or(B(t)));else {let V=Q=>Q.map(we=>we.subtasks?.length?{...we,subtasks:P(V(we.subtasks))}:we);$e(Or(V(t)));}},[t,$e]);let Fe=useRef(t),Ke=useRef(true);useEffect(()=>{if(Ke.current){Ke.current=false,Fe.current=oe;return}if(se.current){se.current=false,Fe.current=oe;return}if(!r)return;let P=JSON.stringify(Fe.current),B=JSON.stringify(oe);P!==B&&(Fe.current=oe,r(oe));},[oe,r]);let Qe=useMemo(()=>yd(b,w),[b,w]),ye=useCallback(P=>[{id:"name",label:P.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:P.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:P.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:P.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:P.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:P.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:P.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:P.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[He,lt]=useState(()=>ye(Qe));useEffect(()=>{lt(P=>P.map(B=>({...B,label:Qe.columns[B.id==="name"?"taskName":B.id]||B.label})));},[Qe]);let wt=useMemo(()=>He.filter(B=>B.visible).reduce((B,V)=>B+V.width,0),[He]),Ot=useRef(He.filter(P=>P.visible).map(P=>P.id).join(","));useEffect(()=>{let P=He.filter(Q=>Q.visible),B=P.map(Q=>Q.id).join(","),V=Ot.current;if(B!==V){let Q=P.some(Ae=>Ae.id!=="name"),we=V.includes(",");Q?!we&&Q&&_e(null):_e(null),Ot.current=B;}},[He]);let St=60,Et=.6,ma=useMemo(()=>{let B=wt+St,V=typeof window<"u"?window.innerWidth*Et:800,Q=Math.max(B,V);return qe!==null?Math.max(200,Math.min(qe,Q)):Math.max(200,B)},[qe,wt]),na=useRef(null),Ya=useRef(null),fa=useRef(null),ya=useRef(null),Lt=useMemo(()=>zp(ke),[ke]),xr=useMemo(()=>({theme:Lt,themeName:ke}),[Lt,ke]),jc=useMemo(()=>Cm(p),[p]),il=useMemo(()=>{if(!g)return oe;let P=De.calculateCriticalPathFull(oe),B=V=>V.map(Q=>{let we=P.get(Q.id),Ae=Q.subtasks?B(Q.subtasks):void 0,Mt=Ae?.some(Fa=>Fa.isCriticalPath||Fa.subtasks&&Fa.subtasks.some(Yt=>Yt.isCriticalPath))||false,dt=we?we.isCritical:Mt;return {...Q,isCriticalPath:dt,cpmData:we||void 0,subtasks:Ae}});return B(oe)},[oe,g]),rf=useMemo(()=>De.flattenTasks(oe).some(B=>B.dependencies&&B.dependencies.length>0),[oe]),_c=useMemo(()=>{if(Le==="all"&&!ne)return il;let P=B=>{let V=[];for(let Q of B){let we=Q.subtasks?.length?P(Q.subtasks):void 0,Ae=false;if(ne)Ae=Q.progress<100;else switch(Le){case "all":Ae=true;break;case "incomplete":Ae=Q.progress<100;break;case "in_progress":Ae=Q.progress>0&&Q.progress<100;break;case "completed":Ae=Q.progress===100;break}(Ae||we&&we.length>0)&&V.push({...Q,subtasks:we});}return V};return P(il)},[il,Le,ne]),Rs=Vv($);km({undo:A,redo:ge,canUndo:je,canRedo:tt,enabled:true}),useImperativeHandle(o,()=>({getTask:P=>De.findTaskById(oe,P),addTask:(P,B)=>{$e(V=>{if(!B)return [...V,{...P,level:0}];let Q=we=>we.map(Ae=>Ae.id===B?{...Ae,subtasks:[...Ae.subtasks||[],{...P,parentId:B,level:(Ae.level||0)+1}],isExpanded:true}:Ae.subtasks?{...Ae,subtasks:Q(Ae.subtasks)}:Ae);return Q(V)});},updateTask:(P,B)=>{$e(V=>{let Q=we=>we.map(Ae=>Ae.id===P?{...Ae,...B}:Ae.subtasks?{...Ae,subtasks:Q(Ae.subtasks)}:Ae);return Q(V)});},deleteTask:P=>{$e(B=>{let V=Q=>Q.filter(we=>we.id===P?false:(we.subtasks&&(we.subtasks=V(we.subtasks)),true));return V(B)});},deleteTasks:P=>{$e(B=>Sd(B,P));},duplicateTask:P=>{if(a.onTaskDuplicate){let B=De.findTaskById(oe,P);B&&a.onTaskDuplicate(B);}else $e(B=>ms(B,[P]).tasks);},splitTask:(P,B,V=3)=>{$e(Q=>De.splitTask(Q,P,B,V));},calculateEndDate:De.calculateEndDate,calculateDuration:De.calculateDuration,validateDependency:(P,B)=>!De.validateDependencies(oe,P,B),getAllTasks:()=>De.flattenTasks(oe),getTasksByStatus:P=>De.flattenTasks(oe).filter(B=>B.status===P),getTasksByParent:P=>P?De.findTaskById(oe,P)?.subtasks||[]:oe.filter(V=>!V.parentId),getCriticalPath:()=>De.flattenTasks(oe).filter(P=>P.isCriticalPath),indentTask:P=>{$e(B=>Or(Td(B,[P])));},outdentTask:P=>{$e(B=>Or(Nd(B,[P])));},moveTask:(P,B)=>{$e(V=>Dd(V,[P],B));},createSubtask:async P=>{let{tasks:B,newTask:V}=Fd(oe,P);if(ve){let Q=ve({...V,parentId:P});if((Q instanceof Promise?await Q:Q)===false)return}$e(Or(B)),We&&We({...V,parentId:P});},scrollToTask:P=>{let V=De.flattenTasks(oe).findIndex(Q=>Q.id===P);if(V!==-1&&na.current){let Q=V*Rs;na.current.scrollTo({top:Q,behavior:"smooth"}),fa.current&&fa.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(P,B=2e3)=>{},expandTask:P=>{$e(B=>{let V=Q=>Q.map(we=>we.id===P?{...we,isExpanded:true}:we.subtasks?{...we,subtasks:V(we.subtasks)}:we);return V(B)});},collapseTask:P=>{$e(B=>{let V=Q=>Q.map(we=>we.id===P?{...we,isExpanded:false}:we.subtasks?{...we,subtasks:V(we.subtasks)}:we);return V(B)});},expandAll:()=>{$e(P=>{let B=V=>V.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?B(Q.subtasks):void 0}));return B(P)});},collapseAll:()=>{$e(P=>{let B=V=>V.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?B(Q.subtasks):void 0}));return B(P)});},collapseToLevel:P=>{xe(P);},undo:A,redo:ge,canUndo:()=>je,canRedo:()=>tt,clearHistory:oa,exportToPNG:async()=>{if(!ya.current||!na.current||!fa.current)throw new Error("Gantt container not found");let P=ya.current,B=na.current,V=Ya.current||B.querySelector(".gantt-grid-scroll"),Q=fa.current,we=V?.scrollTop||0,Ae=Q.scrollTop,Mt=P.style.overflow,dt=P.style.height,Fa=B.style.overflow;try{let Yt=V?.querySelector(".gantt-taskgrid-content"),ua=Q.querySelector("svg"),cr=Yt?.scrollHeight||V?.scrollHeight||600,Sr=ua?.getBoundingClientRect().height||Q.scrollHeight,Go=(P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(cr,Sr)+20;V&&(V.scrollTop=0),Q.scrollTop=0,P.style.overflow="visible",P.style.height=`${Go}px`,B.style.overflow="visible",await new Promise(fn=>setTimeout(fn,100));let to=await toPng(P,{backgroundColor:Lt.bgPrimary,pixelRatio:2,filter:fn=>{if(!(fn instanceof Element))return !0;let Os=window.getComputedStyle(fn),Kn=parseInt(Os.zIndex,10);return (isNaN(Kn)||Kn<50)&&Os.position!=="fixed"}});return await(await fetch(to)).blob()}finally{P.style.overflow=Mt,P.style.height=dt,B.style.overflow=Fa,V&&(V.scrollTop=we),Q.scrollTop=Ae;}},exportToPDF:async P=>{await De.exportToPDF(oe,P);},exportToExcel:async P=>{await De.exportToExcel(oe,P,ul.current);},exportToJSON:()=>De.exportToJSON(oe),exportToCSV:()=>De.exportToCSV(oe),importFromJSON:P=>{let B=De.importFromJSON(P);$e(B);},getTasks:()=>oe,refresh:()=>{$e(P=>[...P]);},clearAll:()=>{$e([]);}}),[oe,A,ge,je,tt,oa,Lt,Rs]);let of=useCallback(P=>{lt(B=>B.map(V=>V.id===P?{...V,visible:!V.visible}:V));},[]),nf=useCallback((P,B)=>{lt(V=>V.map(Q=>{if(Q.id!==P)return Q;let we=Q.minWidth??100,Ae=Q.maxWidth??800,Mt=Math.max(we,Math.min(Ae,B));return {...Q,width:Mt}}));},[]),sf=useCallback(P=>{$e(B=>{let V=Md(B,P),Q=we=>{for(let Ae of we){if(Ae.id===P){Ma.current.set(P,Ae.isExpanded??true);return}Ae.subtasks?.length&&Q(Ae.subtasks);}};return Q(V),ha(),V}),a.onTaskToggleExpand?.(P);},[a,ha]),un=useCallback((P,B)=>{if(Re&&Re(P,B)===false)return;let Q=De.findTaskById(oe,P)?.progress,we=Mt=>Mt.map(dt=>dt.id===P?{...dt,...B}:dt.subtasks?{...dt,subtasks:we(dt.subtasks)}:dt);$e(we(oe));let Ae=De.findTaskById(we(oe),P);Ae&&(Se?.(Ae),st?.(Ae),B.progress!==void 0&&Q!==void 0&&B.progress!==Q&&_?.(P,Q,B.progress));},[oe,Se,Re,st,_]),lf=useCallback(P=>{P.length!==0&&(nr.current+=1,se.current=true,$e(B=>Or(Td(B,P))),a.onTaskIndent?.(P[0]));},[a]),df=useCallback(P=>{P.length!==0&&(nr.current+=1,se.current=true,$e(B=>Or(Nd(B,P))),a.onTaskOutdent?.(P[0]));},[a]),cf=useCallback((P,B,V)=>{nr.current+=1,se.current=true,$e(Q=>Or(lm(Q,P,B,V))),a.onTaskReparent?.(P,B,V);},[a]),uf=useCallback((P,B)=>{P.length!==0&&(nr.current+=1,se.current=true,$e(V=>Dd(V,P,B)),a.onTaskMove?.(P[0],B));},[a]),ll=useCallback(async P=>{let B=[];for(let V of P)ee&&await Promise.resolve(ee(V))===false||B.push(V);B.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(B):($e(V=>Or(Sd(V,B))),B.forEach(V=>a.onTaskDelete?.(V))),it&&B.forEach(V=>it(V)));},[a,ee,it]),pf=useCallback(P=>{a.onTaskDuplicate?P.forEach(B=>{let V=De.findTaskById(oe,B);V&&a.onTaskDuplicate(V);}):$e(B=>ms(B,P).tasks);},[a,oe]),mf=useCallback((P,B)=>{$e(V=>{let{tasks:Q,newTask:we}=im(V,P,B);return ve&&ve(we)===false?V:(a.onTaskCreate?.(we.parentId,we.position||0),We?.(we),Q)});},[a,ve,We]),gf=useCallback((P,B)=>{$e(V=>Ed(V,P,B)),a.onTaskRename?.(P,B);},[a]),dl=useCallback(P=>{let{onTaskAddSubtask:B}=a;if(B){let V=An(oe,P);if(V){B(V);return}}$e(V=>{let{tasks:Q}=Fd(V,P);return a.onTaskCreate?.(P,0),Q});},[a,oe]),ff=useCallback((P,B,V)=>{let Q=!P.startDate&&!P.endDate,we=P.startDate?Math.round((B.getTime()-P.startDate.getTime())/(1e3*60*60*24)):0,Ae=Yt=>Yt.map(ua=>ua.id===P.id?{...ua,startDate:B,endDate:V,...P.segments&&{segments:P.segments}}:ua.subtasks?{...ua,subtasks:Ae(ua.subtasks)}:ua),Mt=Ae(oe),dt=Mt;Mt=De.autoScheduleDependents(Mt,P.id,we),Mt=Or(Mt),$e(Mt);let Fa={...P,startDate:B,endDate:V};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(P,B,V):Se?.(Fa),R&&we!==0){let Yt=De.flattenTasks(dt),ua=De.flattenTasks(Mt),cr=[];for(let Sr of ua){if(Sr.id===P.id)continue;let ko=Yt.find(to=>to.id===Sr.id);if(!ko)continue;let gn=Sr.startDate?.getTime()!==ko.startDate?.getTime(),Go=Sr.endDate?.getTime()!==ko.endDate?.getTime();(gn||Go)&&cr.push(Sr);}cr.length>0&&R(cr);}},[oe,Se,R,a]),bf=useCallback((P,B)=>{Z?.(P,B),bt({isOpen:true,x:B.clientX,y:B.clientY,task:P});},[Z]),hf=useCallback((P,B)=>{let V=De.splitTask(oe,P.id,B);$e(V),bt({isOpen:false,x:0,y:0,task:null});},[oe]),Kc=useCallback(P=>{let B=De.findTaskById(oe,P.id)||P;Y?.(B),he||Ut(B);},[oe,Y,he]),qc=useCallback((P,B,V)=>{let Q=new Map,we=Yt=>{Yt.forEach(ua=>{ua.dependencies&&Q.set(ua.id,ua.dependencies),ua.subtasks&&we(ua.subtasks);});};we(V);let Ae=Q.get(B)||[];Q.set(B,[...Ae,P]);let Mt=new Set,dt=new Set,Fa=Yt=>{if(!Mt.has(Yt)){Mt.add(Yt),dt.add(Yt);let ua=Q.get(Yt)||[];for(let cr of ua){if(!Mt.has(cr)&&Fa(cr))return true;if(dt.has(cr))return true}}return dt.delete(Yt),false};return Fa(B)},[]),Yc=useCallback((P,B)=>{if(qc(P.id,B,M.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:F,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${Xt[R]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:lt,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${rt}`,boxShadow:At},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:we,borderBottom:`1px solid ${vt}`},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:gt,border:`1px solid ${tt}`,color:"#2E94FF"},children:jsx(vm,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:H},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>p(U=>!U),className:"p-1.5 rounded-lg transition-colors",style:{color:le},onMouseEnter:U=>{U.currentTarget.style.background=K,U.currentTarget.style.color=D;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=le;},children:jsx(Pv,{})}),jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg transition-colors",style:{color:le},onMouseEnter:U=>{U.currentTarget.style.background=K,U.currentTarget.style.color=D;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=le;},children:jsx(Fv,{})})]})]}),jsx(AnimatePresence,{children:!d&&jsxs(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&w&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:pe,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:ye.slice(0,4).map((U,ne)=>jsx("button",{onClick:()=>Ta(U),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Te,color:te,border:`1px solid ${G}`},onMouseEnter:$e=>{$e.currentTarget.style.borderColor=Re,$e.currentTarget.style.color="#2E94FF";},onMouseLeave:$e=>{$e.currentTarget.style.borderColor=G,$e.currentTarget.style.color=te;},children:U.length>30?U.slice(0,30)+"...":U},ne))})]}),g.map(U=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${U.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${U.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:U.role==="user"?De:Fe,color:U.role==="user"?"#2E94FF":ft,border:U.role==="user"?`1px solid ${Ue}`:`1px solid ${_e}`},children:[U.isLoading?jsx(Av,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:U.content}),U.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:U.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:U.command.success?"#10B981":"#EF4444",border:`1px solid ${U.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[U.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:U.command.type.replace(/_/g," ")})]})]})},U.id)),jsx("div",{ref:$})]}),jsxs("form",{onSubmit:U=>{if(E&&Ne.length>0){U.preventDefault();return}Wt(U);},className:"p-3 relative",style:{borderTop:`1px solid ${dt}`},children:[jsx(AnimatePresence,{children:E&&Ne.length>0&&jsx(motion.div,{ref:Y,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:Ut,border:`1px solid ${Ge}`,boxShadow:Le,backdropFilter:"blur(12px)"},children:Ne.map((U,ne)=>jsxs("button",{type:"button",onClick:()=>je(U),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:ne===S?nt:"transparent",color:oe},onMouseEnter:()=>X(ne),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:L,border:`1px solid ${j}`,color:"#2E94FF"},children:U.name.split(" ").map($e=>$e[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:U.name}),U.email&&jsx("div",{className:"text-xs truncate",style:{color:fe},children:U.email})]})]},U.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:ut,border:`1px solid ${at}`},children:[jsx("input",{ref:O,type:"text",value:x,onChange:U=>Xe(U.target.value),onKeyDown:U=>{Oe(U);},placeholder:Ee,disabled:f,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Vt,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!x.trim()||f,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?Mt:"transparent",color:x.trim()?"#2E94FF":wt,border:x.trim()?`1px solid ${Dt}`:"1px solid transparent"},children:jsx(Mv,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:bt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function wm(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((i,m=true)=>{r(d=>{let p=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:p};if(!m)return {...d,present:p};let g=[...d.past,d.present];return g.length>t&&g.shift(),{past:g,present:p,future:[]}});},[t]),n=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let m=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:m,future:[i.present,...i.future]}});},[]),l=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let m=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:m,future:d}});},[]),c=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function km({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?n.metaKey:n.ctrlKey;if(c&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&c&&n.key==="y"){n.preventDefault(),t();return}if(l&&c&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Rv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Se.formatDate(e.startDate)} - ${Se.formatDate(e.endDate)}`);let a=Se.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=>Se.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Cm(e){return {...Rv,...e}}var Vv=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Dm=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:c=true,showExportButton:i=true,projectName:m,availableUsers:d=[],templates:p,enableAutoCriticalPath:g=true,persistExpandedState:y,persistFilter:x,clearFiltersKey:h,aiAssistant:f,locale:b="en",customTranslations:w,showCreateTaskButton:C=false,createTaskLabel:N,onCreateTask:T,taskFilter:k,onTaskFilterChange:v,toolbarRightContent:E,showBaseline:I,viewMode:S,onViewModeChange:X,projectForecast:O,onThemeChange:$,onTaskClick:F,onTaskDblClick:Y,onTaskContextMenu:Z,onTaskUpdate:Ee,onDependentTasksScheduled:R,onProgressChange:_,onTaskEdit:ye,onTaskAddSubtask:Je,onTaskMarkIncomplete:z,onTaskSetInProgress:re,onDependencyCreate:J,onDependencyDelete:Ae,onBeforeTaskAdd:ve,onAfterTaskAdd:ze,onBeforeTaskUpdate:Be,onAfterTaskUpdate:st,onBeforeTaskDelete:ee,onAfterTaskDelete:it,permissions:de,onCopySnapshotLink:lt}=a,At=useContext(bi)?.theme,[we,vt]=useState(At||s||"dark"),[gt,tt]=useState(n),[H,le]=useState(l),[D,K]=useState(1),[pe,Te]=useState("all"),[G,te]=useState(S||"execution"),Re=S??G,De=useCallback(P=>{te(P),X?.(P);},[X]),Ue=I??Re==="oracle",[Fe,_e]=useState(a.showCriticalPath!==false),[ft,dt]=useState(a.showDependencies!==false),[ut,at]=useState(a.highlightWeekends!==false),Vt=useCallback(P=>{_e(P),a.onShowCriticalPathChange?.(P);},[a.onShowCriticalPathChange]),Mt=useCallback(P=>{dt(P),a.onShowDependenciesChange?.(P);},[a.onShowDependenciesChange]),Dt=useCallback(P=>{at(P),a.onHighlightWeekendsChange?.(P);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(gt);},[gt]),useEffect(()=>{a.onZoomChange?.(D);},[D]);let wt=useRef(a.onDateRangeChange);wt.current=a.onDateRangeChange;let bt=useCallback(()=>x?typeof x=="string"?x:"gantt-filter-state":null,[x]),[Ut,Ge]=useState(()=>{if(!x)return "all";try{let P=typeof x=="string"?x:"gantt-filter-state",B=localStorage.getItem(P);if(B){let V=JSON.parse(B);if(V.taskFilter)return V.taskFilter}}catch(P){console.warn("[GanttBoard] Error loading filter state from localStorage:",P);}return "all"}),Le=k??Ut,nt=v??Ge,[oe,fe]=useState(()=>{if(!x)return false;try{let P=typeof x=="string"?x:"gantt-filter-state",B=localStorage.getItem(P);if(B){let V=JSON.parse(B);if(typeof V.hideCompleted=="boolean")return V.hideCompleted}}catch(P){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",P);}return false});useEffect(()=>{let P=bt();if(P)try{let B={taskFilter:Le,hideCompleted:oe};localStorage.setItem(P,JSON.stringify(B));}catch(B){console.warn("[GanttBoard] Error saving filter state to localStorage:",B);}},[Le,oe,bt]);let L=useRef(h);useEffect(()=>{if(L.current!==h&&h!==void 0){Ge("all"),fe(false);let P=bt();if(P)try{localStorage.removeItem(P);}catch(B){console.warn("[GanttBoard] Error clearing filter state from localStorage:",B);}}L.current=h;},[h,bt]);let[j,q]=useState(0),[me,Ne]=useState(false),[Xe,je]=useState(null),[Oe,kt]=useState({isOpen:false,x:0,y:0,task:null}),[pt,Wt]=useState(null),[Ta,Xt]=useState(null);useEffect(()=>{At&&At!==we&&vt(At);},[At]),useEffect(()=>{s&&s!==we&&vt(s);},[s]);let U=useCallback(P=>{vt(P),$?.(P);},[$]),{state:ne,setState:$e,undo:A,redo:ge,canUndo:Ve,canRedo:Ze,clearHistory:na}=wm(t,50),jt=useMemo(()=>{let P=(B,V=0)=>{let Q=V;for(let ke of B)ke.subtasks?.length&&(Q=Math.max(Q,P(ke.subtasks,V+1)));return Q};return P(ne)+1},[ne]),La=useCallback(()=>y?typeof y=="string"?y:"gantt-expanded-tasks":null,[y]),qa=useRef(new Map),Ia=useRef(false);if(!Ia.current&&y){Ia.current=true;let P=typeof y=="string"?y:"gantt-expanded-tasks";try{let B=localStorage.getItem(P);if(B){let V=JSON.parse(B);Array.isArray(V)&&(qa.current=new Map(V));}}catch(B){console.warn("[GanttBoard] Error loading expanded state from localStorage:",B);}}let ga=useCallback(()=>{let P=La();if(P)try{let B=Array.from(qa.current.entries());localStorage.setItem(P,JSON.stringify(B));}catch(B){console.warn("[GanttBoard] Error saving expanded state to localStorage:",B);}},[La]),cr=useRef(0),Kn=useRef(ne);useEffect(()=>{Kn.current=ne;},[ne]);let zr=useRef(false),M=useCallback(P=>{Te(P),cr.current+=1,$e(B=>{let V=(ke,Pe=0)=>ke.map(Ft=>{let ct=P==="all"||Pe<P-1;return Ft.subtasks?.length&&qa.current.set(Ft.id,ct),{...Ft,isExpanded:ct,subtasks:Ft.subtasks?V(Ft.subtasks,Pe+1):void 0}}),Q=V(B);return ga(),Q});},[$e,ga]);useEffect(()=>{if(cr.current>0){cr.current-=1;return}let P=V=>{let Q=new Map;for(let ke of V){let Pe=ke.id;Q.get(Pe)||Q.set(Pe,ke);}return Array.from(Q.values())},B=V=>V.map(Q=>{let ke=qa.current.get(Q.id),Pe=ke!==void 0?{...Q,isExpanded:ke}:Q;if(Pe.subtasks?.length){let Ft=P(Pe.subtasks);return {...Pe,subtasks:B(Ft)}}return Pe});if(qa.current.size>0)$e(Or(B(t)));else {let V=Q=>Q.map(ke=>ke.subtasks?.length?{...ke,subtasks:P(V(ke.subtasks))}:ke);$e(Or(V(t)));}},[t,$e]);let se=useRef(t),xe=useRef(true);useEffect(()=>{if(xe.current){xe.current=false,se.current=ne;return}if(zr.current){zr.current=false,se.current=ne;return}if(!r)return;let P=JSON.stringify(se.current),B=JSON.stringify(ne);P!==B&&(se.current=ne,r(ne));},[ne,r]);let Ce=useMemo(()=>xd(b,w),[b,w]),Ke=useCallback(P=>[{id:"name",label:P.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:P.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:P.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:P.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:P.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:P.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:P.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:P.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[ot,he]=useState(()=>Ke(Ce));useEffect(()=>{he(P=>P.map(B=>({...B,label:Ce.columns[B.id==="name"?"taskName":B.id]||B.label})));},[Ce]);let We=useMemo(()=>ot.filter(B=>B.visible).reduce((B,V)=>B+V.width,0),[ot]),mt=useRef(ot.filter(P=>P.visible).map(P=>P.id).join(","));useEffect(()=>{let P=ot.filter(Q=>Q.visible),B=P.map(Q=>Q.id).join(","),V=mt.current;if(B!==V){let Q=P.some(Pe=>Pe.id!=="name"),ke=V.includes(",");Q?!ke&&Q&&je(null):je(null),mt.current=B;}},[ot]);let St=60,Lt=.6,Et=useMemo(()=>{let B=We+St,V=typeof window<"u"?window.innerWidth*Lt:800,Q=Math.max(B,V);return Xe!==null?Math.max(200,Math.min(Xe,Q)):Math.max(200,B)},[Xe,We]),Ct=useRef(null),sa=useRef(null),aa=useRef(null),Ba=useRef(null),Ot=useMemo(()=>zp(we),[we]),Wa=useMemo(()=>({theme:Ot,themeName:we}),[Ot,we]),Qa=useMemo(()=>Cm(p),[p]),ur=useMemo(()=>{if(!g)return ne;let P=Se.calculateCriticalPathFull(ne),B=V=>V.map(Q=>{let ke=P.get(Q.id),Pe=Q.subtasks?B(Q.subtasks):void 0,Ft=Pe?.some(Sa=>Sa.isCriticalPath||Sa.subtasks&&Sa.subtasks.some(Jt=>Jt.isCriticalPath))||false,ct=ke?ke.isCritical:Ft;return {...Q,isCriticalPath:ct,cpmData:ke||void 0,subtasks:Pe}});return B(ne)},[ne,g]),rf=useMemo(()=>Se.flattenTasks(ne).some(B=>B.dependencies&&B.dependencies.length>0),[ne]),_c=useMemo(()=>{if(Le==="all"&&!oe)return ur;let P=B=>{let V=[];for(let Q of B){let ke=Q.subtasks?.length?P(Q.subtasks):void 0,Pe=false;if(oe)Pe=Q.progress<100;else switch(Le){case "all":Pe=true;break;case "incomplete":Pe=Q.progress<100;break;case "in_progress":Pe=Q.progress>0&&Q.progress<100;break;case "completed":Pe=Q.progress===100;break}(Pe||ke&&ke.length>0)&&V.push({...Q,subtasks:ke});}return V};return P(ur)},[ur,Le,oe]),$s=Vv(H);km({undo:A,redo:ge,canUndo:Ve,canRedo:Ze,enabled:true}),useImperativeHandle(o,()=>({getTask:P=>Se.findTaskById(ne,P),addTask:(P,B)=>{$e(V=>{if(!B)return [...V,{...P,level:0}];let Q=ke=>ke.map(Pe=>Pe.id===B?{...Pe,subtasks:[...Pe.subtasks||[],{...P,parentId:B,level:(Pe.level||0)+1}],isExpanded:true}:Pe.subtasks?{...Pe,subtasks:Q(Pe.subtasks)}:Pe);return Q(V)});},updateTask:(P,B)=>{$e(V=>{let Q=ke=>ke.map(Pe=>Pe.id===P?{...Pe,...B}:Pe.subtasks?{...Pe,subtasks:Q(Pe.subtasks)}:Pe);return Q(V)});},deleteTask:P=>{$e(B=>{let V=Q=>Q.filter(ke=>ke.id===P?false:(ke.subtasks&&(ke.subtasks=V(ke.subtasks)),true));return V(B)});},deleteTasks:P=>{$e(B=>Ed(B,P));},duplicateTask:P=>{if(a.onTaskDuplicate){let B=Se.findTaskById(ne,P);B&&a.onTaskDuplicate(B);}else $e(B=>fs(B,[P]).tasks);},splitTask:(P,B,V=3)=>{$e(Q=>Se.splitTask(Q,P,B,V));},calculateEndDate:Se.calculateEndDate,calculateDuration:Se.calculateDuration,validateDependency:(P,B)=>!Se.validateDependencies(ne,P,B),getAllTasks:()=>Se.flattenTasks(ne),getTasksByStatus:P=>Se.flattenTasks(ne).filter(B=>B.status===P),getTasksByParent:P=>P?Se.findTaskById(ne,P)?.subtasks||[]:ne.filter(V=>!V.parentId),getCriticalPath:()=>Se.flattenTasks(ne).filter(P=>P.isCriticalPath),indentTask:P=>{$e(B=>Or(Nd(B,[P])));},outdentTask:P=>{$e(B=>Or(Dd(B,[P])));},moveTask:(P,B)=>{$e(V=>Sd(V,[P],B));},createSubtask:async P=>{let{tasks:B,newTask:V}=Pd(ne,P);if(ve){let Q=ve({...V,parentId:P});if((Q instanceof Promise?await Q:Q)===false)return}$e(Or(B)),ze&&ze({...V,parentId:P});},scrollToTask:P=>{let V=Se.flattenTasks(ne).findIndex(Q=>Q.id===P);if(V!==-1&&Ct.current){let Q=V*$s;Ct.current.scrollTo({top:Q,behavior:"smooth"}),aa.current&&aa.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(P,B=2e3)=>{},expandTask:P=>{$e(B=>{let V=Q=>Q.map(ke=>ke.id===P?{...ke,isExpanded:true}:ke.subtasks?{...ke,subtasks:V(ke.subtasks)}:ke);return V(B)});},collapseTask:P=>{$e(B=>{let V=Q=>Q.map(ke=>ke.id===P?{...ke,isExpanded:false}:ke.subtasks?{...ke,subtasks:V(ke.subtasks)}:ke);return V(B)});},expandAll:()=>{$e(P=>{let B=V=>V.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?B(Q.subtasks):void 0}));return B(P)});},collapseAll:()=>{$e(P=>{let B=V=>V.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?B(Q.subtasks):void 0}));return B(P)});},collapseToLevel:P=>{M(P);},undo:A,redo:ge,canUndo:()=>Ve,canRedo:()=>Ze,clearHistory:na,exportToPNG:async()=>{if(!Ba.current||!Ct.current||!aa.current)throw new Error("Gantt container not found");let P=Ba.current,B=Ct.current,V=sa.current||B.querySelector(".gantt-grid-scroll"),Q=aa.current,ke=V?.scrollTop||0,Pe=Q.scrollTop,Ft=P.style.overflow,ct=P.style.height,Sa=B.style.overflow;try{let Jt=V?.querySelector(".gantt-taskgrid-content"),pa=Q.querySelector("svg"),dr=Jt?.scrollHeight||V?.scrollHeight||600,Sr=pa?.getBoundingClientRect().height||Q.scrollHeight,Vo=(P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(dr,Sr)+20;V&&(V.scrollTop=0),Q.scrollTop=0,P.style.overflow="visible",P.style.height=`${Vo}px`,B.style.overflow="visible",await new Promise(bn=>setTimeout(bn,100));let ao=await toPng(P,{backgroundColor:Ot.bgPrimary,pixelRatio:2,filter:bn=>{if(!(bn instanceof Element))return !0;let Hs=window.getComputedStyle(bn),Yn=parseInt(Hs.zIndex,10);return (isNaN(Yn)||Yn<50)&&Hs.position!=="fixed"}});return await(await fetch(ao)).blob()}finally{P.style.overflow=Ft,P.style.height=ct,B.style.overflow=Sa,V&&(V.scrollTop=ke),Q.scrollTop=Pe;}},exportToPDF:async P=>{await Se.exportToPDF(ne,P);},exportToExcel:async P=>{await Se.exportToExcel(ne,P,pl.current);},exportToJSON:()=>Se.exportToJSON(ne),exportToCSV:()=>Se.exportToCSV(ne),importFromJSON:P=>{let B=Se.importFromJSON(P);$e(B);},getTasks:()=>ne,refresh:()=>{$e(P=>[...P]);},clearAll:()=>{$e([]);}}),[ne,A,ge,Ve,Ze,na,Ot,$s]);let of=useCallback(P=>{he(B=>B.map(V=>V.id===P?{...V,visible:!V.visible}:V));},[]),nf=useCallback((P,B)=>{he(V=>V.map(Q=>{if(Q.id!==P)return Q;let ke=Q.minWidth??100,Pe=Q.maxWidth??800,Ft=Math.max(ke,Math.min(Pe,B));return {...Q,width:Ft}}));},[]),sf=useCallback(P=>{$e(B=>{let V=Fd(B,P),Q=ke=>{for(let Pe of ke){if(Pe.id===P){qa.current.set(P,Pe.isExpanded??true);return}Pe.subtasks?.length&&Q(Pe.subtasks);}};return Q(V),ga(),V}),a.onTaskToggleExpand?.(P);},[a,ga]),pn=useCallback((P,B)=>{if(Be&&Be(P,B)===false)return;let Q=Se.findTaskById(ne,P)?.progress,ke=Ft=>Ft.map(ct=>ct.id===P?{...ct,...B}:ct.subtasks?{...ct,subtasks:ke(ct.subtasks)}:ct);$e(ke(ne));let Pe=Se.findTaskById(ke(ne),P);Pe&&(Ee?.(Pe),st?.(Pe),B.progress!==void 0&&Q!==void 0&&B.progress!==Q&&_?.(P,Q,B.progress));},[ne,Ee,Be,st,_]),lf=useCallback(P=>{P.length!==0&&(cr.current+=1,zr.current=true,$e(B=>Or(Nd(B,P))),a.onTaskIndent?.(P[0]));},[a]),df=useCallback(P=>{P.length!==0&&(cr.current+=1,zr.current=true,$e(B=>Or(Dd(B,P))),a.onTaskOutdent?.(P[0]));},[a]),cf=useCallback((P,B,V)=>{cr.current+=1,zr.current=true,$e(Q=>Or(lm(Q,P,B,V))),a.onTaskReparent?.(P,B,V);},[a]),uf=useCallback((P,B)=>{P.length!==0&&(cr.current+=1,zr.current=true,$e(V=>Sd(V,P,B)),a.onTaskMove?.(P[0],B));},[a]),dl=useCallback(async P=>{let B=[];for(let V of P)ee&&await Promise.resolve(ee(V))===false||B.push(V);B.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(B):($e(V=>Or(Ed(V,B))),B.forEach(V=>a.onTaskDelete?.(V))),it&&B.forEach(V=>it(V)));},[a,ee,it]),pf=useCallback(P=>{a.onTaskDuplicate?P.forEach(B=>{let V=Se.findTaskById(ne,B);V&&a.onTaskDuplicate(V);}):$e(B=>fs(B,P).tasks);},[a,ne]),mf=useCallback((P,B)=>{$e(V=>{let{tasks:Q,newTask:ke}=im(V,P,B);return ve&&ve(ke)===false?V:(a.onTaskCreate?.(ke.parentId,ke.position||0),ze?.(ke),Q)});},[a,ve,ze]),gf=useCallback((P,B)=>{$e(V=>Md(V,P,B)),a.onTaskRename?.(P,B);},[a]),cl=useCallback(P=>{let{onTaskAddSubtask:B}=a;if(B){let V=Ln(ne,P);if(V){B(V);return}}$e(V=>{let{tasks:Q}=Pd(V,P);return a.onTaskCreate?.(P,0),Q});},[a,ne]),ff=useCallback((P,B,V)=>{let Q=!P.startDate&&!P.endDate,ke=P.startDate?Math.round((B.getTime()-P.startDate.getTime())/(1e3*60*60*24)):0,Pe=Jt=>Jt.map(pa=>pa.id===P.id?{...pa,startDate:B,endDate:V,...P.segments&&{segments:P.segments}}:pa.subtasks?{...pa,subtasks:Pe(pa.subtasks)}:pa),Ft=Pe(ne),ct=Ft;Ft=Se.autoScheduleDependents(Ft,P.id,ke),Ft=Or(Ft),$e(Ft);let Sa={...P,startDate:B,endDate:V};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(P,B,V):Ee?.(Sa),R&&ke!==0){let Jt=Se.flattenTasks(ct),pa=Se.flattenTasks(Ft),dr=[];for(let Sr of pa){if(Sr.id===P.id)continue;let Co=Jt.find(ao=>ao.id===Sr.id);if(!Co)continue;let fn=Sr.startDate?.getTime()!==Co.startDate?.getTime(),Vo=Sr.endDate?.getTime()!==Co.endDate?.getTime();(fn||Vo)&&dr.push(Sr);}dr.length>0&&R(dr);}},[ne,Ee,R,a]),bf=useCallback((P,B)=>{Z?.(P,B),kt({isOpen:true,x:B.clientX,y:B.clientY,task:P});},[Z]),hf=useCallback((P,B)=>{let V=Se.splitTask(ne,P.id,B);$e(V),kt({isOpen:false,x:0,y:0,task:null});},[ne]),Kc=useCallback(P=>{let B=Se.findTaskById(ne,P.id)||P;Y?.(B),ye||Wt(B);},[ne,Y,ye]),qc=useCallback((P,B,V)=>{let Q=new Map,ke=Jt=>{Jt.forEach(pa=>{pa.dependencies&&Q.set(pa.id,pa.dependencies),pa.subtasks&&ke(pa.subtasks);});};ke(V);let Pe=Q.get(B)||[];Q.set(B,[...Pe,P]);let Ft=new Set,ct=new Set,Sa=Jt=>{if(!Ft.has(Jt)){Ft.add(Jt),ct.add(Jt);let pa=Q.get(Jt)||[];for(let dr of pa){if(!Ft.has(dr)&&Sa(dr))return true;if(ct.has(dr))return true}}return ct.delete(Jt),false};return Sa(B)},[]),Yc=useCallback((P,B)=>{if(qc(P.id,B,Kn.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 V=Q=>Q.map(we=>{if(we.id===B){let Ae=we.dependencies||[];if(!Ae.includes(P.id))return {...we,dependencies:[...Ae,P.id]}}return we.subtasks?{...we,subtasks:V(we.subtasks)}:we});nr.current+=1,$e(Q=>V(Q)),J?.(P.id,B);},[J,qc]),Xc=useCallback((P,B)=>{let V=Q=>Q.map(we=>{if(we.id===P&&we.dependencies){let Ae=we.dependencies.filter(Mt=>Mt!==B);return {...we,dependencies:Ae}}return we.subtasks?{...we,subtasks:V(we.subtasks)}:we});nr.current+=1,$e(Q=>V(Q)),Pe?.(P,B);},[Pe]),{startDate:pn,endDate:cl}=useMemo(()=>{let P=oe.filter(Ae=>Ae.startDate&&Ae.endDate);if(P.length===0){let Ae=new Date,Mt=new Date(Ae);Mt.setDate(Mt.getDate()-30);let dt=new Date(Ae);return dt.setDate(dt.getDate()+60),{startDate:Mt,endDate:dt}}let B=P.flatMap(Ae=>[Ae.startDate,Ae.endDate]).filter(Ae=>Ae!==void 0),V=new Date(Math.min(...B.map(Ae=>Ae.getTime()))),Q=new Date(Math.max(...B.map(Ae=>Ae.getTime()))),we=ct==="day"?7:ct==="week"?14:30;return V.setDate(V.getDate()-we),Q.setDate(Q.getDate()+we),{startDate:V,endDate:Q}},[oe,ct]);useEffect(()=>{Dt.current?.(pn,cl);},[pn,cl]);let yf=useCallback(async()=>{if(!ya.current||!na.current||!fa.current)return;await new Promise(Go=>setTimeout(Go,200));let P=ya.current,B=na.current,V=Ya.current||B.querySelector(".gantt-grid-scroll"),Q=fa.current,we=V?.scrollTop||0,Ae=V?.scrollLeft||0,Mt=Q.scrollTop,dt=Q.scrollLeft,Fa=P.style.overflow,Yt=P.style.height,ua=V?.style.overflow||"",cr=Q.style.overflow,Sr=B.style.overflow,ko=P.style.width,gn=Q.style.width;try{let Go=V?.querySelector(".gantt-taskgrid-content"),to=Q.querySelector("svg"),ml=to?.getAttribute("height")?parseInt(to.getAttribute("height"),10):to?.getBoundingClientRect().height||0,fn=Go?.scrollHeight||V?.scrollHeight||600,Os=Math.max(ml,Q.scrollHeight),Kn=to?.getAttribute("width")?parseInt(to.getAttribute("width"),10):to?.getBoundingClientRect().width||Q.scrollWidth,Df=P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,gl=Math.max(fn,Os,ml),Zc=Df+gl+50,eu=(V?.offsetWidth||B.offsetWidth||300)+Kn+10;V&&(V.scrollTop=0,V.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,P.style.overflow="visible",P.style.height=`${Zc}px`,P.style.width=`${eu}px`,B.style.overflow="visible",V&&(V.style.overflow="visible",V.style.height=`${gl+50}px`),Q.style.overflow="visible",Q.style.height=`${gl+50}px`,Q.style.width=`${Kn+10}px`,await new Promise($s=>setTimeout($s,150));let Sf=await toPng(P,{backgroundColor:Lt.bgPrimary,pixelRatio:2,width:eu,height:Zc,skipFonts:!1,filter:$s=>{if(!($s instanceof Element))return !0;let tu=window.getComputedStyle($s),au=parseInt(tu.zIndex,10);return !(!isNaN(au)&&au>=50||tu.position==="fixed")}}),fl=document.createElement("a");fl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,fl.href=Sf,fl.click();}finally{P.style.overflow=Fa,P.style.height=Yt,P.style.width=ko,B.style.overflow=Sr,V&&(V.style.overflow=ua,V.style.height="",V.scrollTop=we,V.scrollLeft=Ae),Q.style.overflow=cr,Q.style.height="",Q.style.width=gn,Q.scrollTop=Mt,Q.scrollLeft=dt;}},[Lt]),xf=useCallback(async()=>{await De.exportToPDF(oe);},[oe]),ul=useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m});ul.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m};let vf=useCallback(async()=>{let P=new Date,B=we=>String(we).padStart(2,"0"),V=`${P.getFullYear()}-${B(P.getMonth()+1)}-${B(P.getDate())}_${B(P.getHours())}${B(P.getMinutes())}`,Q=m?m.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await De.exportToExcel(oe,`${Q}_${V}.xlsx`,ul.current);},[oe,m]),wf=useCallback(()=>{let P=De.exportToCSV(oe),B=new Blob([P],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(B),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[oe]),kf=useCallback(()=>{let P=De.exportToJSON(oe),B=new Blob([P],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(B),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[oe]),Cf=useCallback(()=>{De.exportToMSProject(oe,"Gantt Project","project.xml");},[oe]),Tf=P=>{P.preventDefault(),Me(true);},mn=useRef(false),[pl,Jc]=useState(false),_n=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let P=fa.current,B=na.current?.querySelector(".gantt-grid-scroll");if(!P||!B)return;let V=()=>{if(mn.current)return;mn.current=true;let dt=P.scrollTop;K(dt),B.scrollTop=dt,requestAnimationFrame(()=>{mn.current=false;});},Q=()=>{if(mn.current)return;mn.current=true;let dt=B.scrollTop;K(dt),P.scrollTop=dt,requestAnimationFrame(()=>{mn.current=false;});},we=dt=>{if(me&&B){let Yt=B.parentElement?.getBoundingClientRect()?.left||0,ua=dt.clientX-Yt,cr=200,Sr=wt+St,ko=window.innerWidth*Et,gn=Math.max(Sr,ko);ua>=cr&&ua<=gn&&_e(ua);}if(pl&&P){let Fa=dt.clientX-_n.current.x,Yt=dt.clientY-_n.current.y;P.scrollLeft=_n.current.scrollLeft-Fa,P.scrollTop=_n.current.scrollTop-Yt;}},Ae=()=>{Me(false),Jc(false);},Mt=dt=>{if(dt.button!==0)return;let Fa=dt.target;Fa.closest("[data-task-bar]")||Fa.closest("[data-dependency-line]")||Fa.closest("button")||Fa.closest('[role="button"]')||Fa.tagName==="rect"&&Fa.getAttribute("data-clickable")==="true"||(Jc(true),_n.current={x:dt.clientX,y:dt.clientY,scrollLeft:P.scrollLeft,scrollTop:P.scrollTop},dt.preventDefault());};return P.addEventListener("scroll",V),B.addEventListener("scroll",Q),P.addEventListener("mousedown",Mt),document.addEventListener("mousemove",we),document.addEventListener("mouseup",Ae),()=>{P.removeEventListener("scroll",V),B.removeEventListener("scroll",Q),P.removeEventListener("mousedown",Mt),document.removeEventListener("mousemove",we),document.removeEventListener("mouseup",Ae);}},[me,pl,wt]);let Qc=useRef(false),Nf=useRef(null);return useLayoutEffect(()=>{if(Qc.current||oe.length===0||!fa.current)return;Qc.current=true,Nf.current=pn;let P=fa.current,B=new Date,V=ct==="day"?60:ct==="week"?20:8,Q=(B.getTime()-pn.getTime())/(1e3*60*60*24),we=P.clientWidth,Mt=Q*V*S-we/2;Q>=0&&we>0&&(P.scrollLeft=Math.max(0,Mt));},[oe.length,pn,ct,S]),jsx(En.Provider,{value:Qe,children:jsx(vl.Provider,{value:xr,children:jsxs("div",{ref:ya,className:"flex flex-col h-full w-full",style:{backgroundColor:Lt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Lt.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Lt.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx("div",{style:{position:"relative",zIndex:100},children:jsx(bi,{theme:Lt,timeScale:ct,onTimeScaleChange:rt,zoom:S,onZoomChange:q,currentTheme:ke,onThemeChange:U,rowDensity:$,onRowDensityChange:de,showThemeSelector:c,showCreateTaskButton:C&&le?.canCreateTask!==false&&!le?.canCreateSubtaskOnly,createTaskLabel:N,onCreateTask:T,taskFilter:Le,onTaskFilterChange:ut,hideCompleted:ne,onHideCompletedChange:fe,toolbarRightContent:E,wbsLevel:ce,onWbsLevelChange:xe,maxWbsDepth:Gt,viewMode:Ge,onViewModeChange:Te,projectForecast:O,onExportPNG:l?yf:void 0,onExportPDF:l?xf:void 0,onExportExcel:l?vf:void 0,onExportCSV:l?wf:void 0,onExportJSON:l?kf:void 0,onExportMSProject:l?Cf:void 0,showCriticalPath:Ne,onShowCriticalPathChange:qt,showDependencies:Tt,onShowDependenciesChange:At,highlightWeekends:nt,onHighlightWeekendsChange:vt,showBaseline:Ue,onShowBaselineChange:P=>{P&&Ge!=="oracle"&&Te("oracle"),!P&&Ge==="oracle"&&Te("execution");},onCopySnapshotLink:ot,hasDependencies:rf})}),jsxs("div",{ref:na,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:Ya,className:"gantt-grid-scroll flex-shrink-0",style:{width:ma,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(xi,{tasks:_c,theme:Lt,rowHeight:Rs,availableUsers:d,templates:jc,showCriticalPath:Ne,onTaskClick:F,onTaskDblClick:Kc,onTaskContextMenu:Z,onTaskToggle:sf,scrollTop:j,columns:He,onToggleColumn:of,onColumnResize:nf,onTaskUpdate:un,onTaskIndent:lf,onTaskOutdent:df,onTaskMove:uf,onMultiTaskDelete:ll,onTaskDuplicate:pf,onTaskCreate:mf,onTaskRename:gf,onCreateSubtask:dl,onOpenTaskModal:F?P=>F(P):void 0,onDeleteRequest:(P,B)=>ta({taskId:P,taskName:B}),onTaskReparent:cf,scrollContainerRef:Ya})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Lt.border,zIndex:15},onMouseDown:Tf}),jsx("div",{ref:fa,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:pl?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Mi,{tasks:_c,theme:Lt,rowHeight:Rs,timeScale:ct,startDate:pn,endDate:cl,zoom:S,locale:b,templates:jc,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:F,onTaskDblClick:Kc,onTaskContextMenu:bf,onTaskDateChange:ff,onDependencyCreate:Yc,onDependencyDelete:Xc,showBaseline:Ue,showCriticalPath:Ne,showDependencies:Tt,highlightWeekends:nt,canEditTask:le?.canEditTask})})]}),Ie.task&&jsx(Fn,{isOpen:Ie.isOpen,x:Ie.x,y:Ie.y,theme:Lt,onClose:()=>bt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=Ie.task;if(!P)return [];let B=De.findTaskById(oe,P.id)||P,V=B.subtasks&&B.subtasks.length>0,Q=le?.canCreateTask!==false,we=le?.canDeleteTask!==false;if(V){let Yt=[],ua=le?.canDuplicateTask!==false;return Q&&Yt.push({id:"addSubtask",label:Qe.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{Je?Je(B):dl(B.id);}}),ua&&Yt.push({id:"duplicate",label:Qe.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(B):$e(cr=>ms(cr,[B.id]).tasks),bt({isOpen:false,x:0,y:0,task:null});}}),we&&(Yt.length>0&&Yt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Yt.push({id:"delete",label:Qe.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{ta({taskId:B.id,taskName:B.name});}})),Yt}let Ae=le?.canUpdateTask!==false,Mt=le?.canDuplicateTask!==false,dt=[];return Ae&&dt.push({id:"edit",label:Qe.contextMenu?.editTask||"Edit Task",icon:ca.Pencil,onClick:()=>{he?he(B):Ut(B);}}),Q&&dt.push({id:"addSubtask",label:Qe.contextMenu?.addSubtask||"Add Subtask",icon:ca.Add,onClick:()=>{Je?Je(B):dl(B.id);}}),dt.length>0&&Ae&&dt.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Ae&&(dt.push({id:"markIncomplete",label:Qe.contextMenu?.markIncomplete||"Mark Incomplete",icon:ca.MarkIncomplete,onClick:()=>{z?z(B):un(B.id,{status:"todo",progress:0});},disabled:B.status==="todo"}),dt.push({id:"setInProgress",label:Qe.contextMenu?.setInProgress||"Set In Progress",icon:ca.SetInProgress,onClick:()=>{re?re(B):un(B.id,{status:"in-progress"});},disabled:B.status==="in-progress"}),dt.push({id:"markComplete",label:Qe.contextMenu?.markComplete||"Mark Complete",icon:ca.MarkComplete,onClick:()=>{un(B.id,{status:"completed",progress:100});},disabled:B.status==="completed"})),(Mt||Ae&&B.startDate&&B.endDate)&&dt.length>0&&dt.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Mt&&dt.push({id:"duplicate",label:Qe.contextMenu?.duplicateTask||"Duplicate Task",icon:ca.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(B):$e(Yt=>ms(Yt,[B.id]).tasks),bt({isOpen:false,x:0,y:0,task:null});}}),Ae&&B.startDate&&B.endDate&&dt.push({id:"split",label:Qe.contextMenu?.splitTask||"Split Task",icon:ca.Split,onClick:()=>{let Yt=B.startDate.getTime(),ua=B.endDate.getTime(),cr=Yt+(ua-Yt)/2,Sr=new Date(cr);hf(B,Sr);}}),we&&(dt.length>0&&dt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),dt.push({id:"delete",label:Qe.contextMenu?.deleteTask||"Delete Task",icon:ca.Delete,onClick:()=>{ta({taskId:B.id,taskName:B.name});}})),dt})()}),jsx(fo,{task:Nt,isOpen:!!Nt,onClose:()=>Ut(null),onTaskUpdate:P=>{Nt&&(un(Nt.id,P),Ut(null));},theme:ke==="light"?"light":"dark",locale:b==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsx(AnimatePresence,{children:Ta&&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:()=>ta(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:P=>P.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Lt.bgSecondary,border:`1px solid ${Lt.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Lt.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:Lt.textPrimary,fontFamily:"Inter, sans-serif"},children:[Qe.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:Lt.textSecondary,fontFamily:"Inter, sans-serif"},children:b==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsxs("p",{className:"text-sm leading-relaxed",style:{color:Lt.textSecondary,fontFamily:"Inter, sans-serif"},children:[b==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:Lt.textPrimary},children:['"',Ta.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Lt.bgPrimary,borderTop:`1px solid ${Lt.border}`},children:[jsx("button",{onClick:()=>ta(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Lt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=Lt.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:b==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{ll([Ta.taskId]),ta(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:P=>{P.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),b==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsx(Ai,{tasks:oe,theme:Lt,config:f,onTasksUpdate:$e,onTaskUpdate:un,onTaskCreate:P=>{$e(B=>[...B,P]);},onTaskDelete:P=>{ll([P]);},onDependencyCreate:(P,B)=>{let V=De.findTaskById(oe,P);V&&Yc(V,B);},onDependencyDelete:Xc})]})})})});function t2(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 a2(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var Ld=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Id=[{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 Mm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:i=a?"edit":"create",theme:c="dark",customStatuses:l=[],availableTags:m=[],onCreateTag:d,attachments:p=[],onUploadAttachments:g,onDeleteAttachment:y,defaultStatus:x}){let h=[...Ld,...l.filter(S=>!Ld.some(q=>q.id===S.id))],f=pt[c]||pt.dark,[b,w]=useState(false),[C,N]=useState(false),[T,k]=useState(false),[v,E]=useState(false),[I,D]=useState({top:0,left:0}),[X$1,O]=useState(null),[H,F]=useState(new Date),[Y,Z]=useState({top:0,left:0}),[Se,R]=useState(false),[_,he]=useState([]),[Je,z]=useState(false),[re,J]=useState(""),Pe=useRef(null),ve=useRef(null),We=useRef(null),Re=useRef(null),st=useRef(null),[ee,it]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[le,ot]=useState({});useEffect(()=>{a?(it({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||"#2E94FF",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)):(it({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),R(false),he([]));},[a,e,x]),useEffect(()=>{let S=q=>{Pe.current&&!Pe.current.contains(q.target)&&w(false),ve.current&&!ve.current.contains(q.target)&&N(false),We.current&&!We.current.contains(q.target)&&k(false),Re.current&&!Re.current.contains(q.target)&&E(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);let yt=()=>{let S={};return ee.name.trim()||(S.name="El nombre es requerido"),ee.startDate&&ee.endDate&&ee.startDate>ee.endDate&&(S.endDate="La fecha de fin debe ser posterior a la de inicio"),ot(S),Object.keys(S).length===0},Pt=async S=>{if(S.preventDefault(),!!yt())try{let q=i==="create"&&_.length>0?{...ee,pendingFiles:_}:ee;await s(q),he([]),t();}catch(q){console.error("Error submitting task:",q);}},ke=(S,q)=>{it(ce=>{let Ce={...ce,[S]:q};if(S==="status"){let W=q;W==="todo"?Ce.progress=0:W==="in-progress"?(ce.progress===0||ce.progress===100)&&(Ce.progress=50):W==="completed"||W==="closed"?Ce.progress=100:(W==="in-review"||W==="review")&&(Ce.progress=75);}if(S==="progress"){let W=typeof q=="number"?q:parseInt(q,10);W===100&&ce.status!=="completed"?Ce.status="completed":W>0&&W<100&&ce.status==="todo"?Ce.status="in-progress":W===0&&ce.status!=="todo"&&(Ce.status="todo");}return Ce}),le[S]&&ot(ce=>{let Ce={...ce};return delete Ce[S],Ce});},xt=h.find(S=>S.id===ee.status)??Ld[0],ct=Id.find(S=>S.id===ee.priority)??Id[1],rt=Yo.find(S=>S.value===ee.color)??Yo[0],$=c==="dark",de={backgroundColor:$?"#1d1f27":f.bgSecondary,border:`1px solid ${$?"rgba(65,71,84,0.1)":f.borderLight}`,color:f.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:$?"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:$?"#0a0a0a":f.bgPrimary,border:`1px solid ${$?"rgba(65,71,84,0.1)":f.border}`,boxShadow:$?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:S=>S.stopPropagation(),children:jsxs("form",{onSubmit:Pt,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsx("input",{type:"text",value:ee.name,onChange:S=>ke("name",S.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),le.name&&jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),le.name]}),jsx("textarea",{value:ee.description||"",onChange:S=>ke("description",S.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:f.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":f.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})]}),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:()=>!n&&w(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...de,borderColor:xt.color,backgroundColor:`${xt.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:xt.color}}),jsx("span",{style:{color:xt.color},children:xt.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:xt.color}})]}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(S=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:q=>q.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{ke("status",S.id),w(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:S.color}}),S.title,ee.status===S.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},S.id))})})]}),jsxs("div",{ref:ve,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&N(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:ct.color}}),jsx("span",{children:ct.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:C&&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:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Id.map(S=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:q=>q.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:q=>q.currentTarget.style.backgroundColor="transparent",onClick:()=>{ke("priority",S.id),N(false);},children:[jsx("span",{children:S.icon}),S.label,ee.priority===S.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},S.id))})})]}),o.length>0&&jsxs("div",{ref:We,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&k(!T),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[ee.assignees&&ee.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:ee.assignees.slice(0,3).map((S,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:S.color||f.accent,borderColor:f.bgSecondary},children:S.initials},q))}),ee.assignees.length>3&&jsxs("span",{style:{color:f.textTertiary},children:["+",ee.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:T&&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:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(S=>{let q=ee.assignees?.some(ce=>ce.name===S.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:ce=>ce.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:ce=>ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ce=q?(ee.assignees||[]).filter(Ce=>Ce.name!==S.name):[...ee.assignees||[],{name:S.name,avatar:S.avatar,initials:S.name.split(" ").map(Ce=>Ce[0]).join("").toUpperCase().slice(0,2),color:f.accent}];ke("assignees",ce);},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:f.accent},children:S.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:S.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:f.accent}})})]},S.id)})})})]}),jsxs("div",{ref:Re,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(v)E(false);else {if(Re.current){let S=Re.current.getBoundingClientRect(),q=window.innerHeight,ce=120,W=q-S.bottom<ce?S.top-ce-8:S.bottom+8;D({top:W,left:S.left});}E(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:de,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ee.color}}),jsx("span",{children:rt.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:v&&jsxs(Xt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>E(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${I.top}px`,left:`${I.left}px`,zIndex:99999,backgroundColor:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:S=>S.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Yo.slice(0,18).map(S=>{let q=ee.color===S.value;return jsx("button",{type:"button",onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),ke("color",S.value),E(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:S.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:S.value,outline:q?`2px solid ${S.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},S.value)})})})})]})})]}),m.length>0||d?jsx(Do,{selectedTags:ee.tags||[],availableTags:m,onChange:S=>ke("tags",S),onCreateTag:d,theme:f,disabled:n}):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:f.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:$?"#191b22":f.bgSecondary,borderRadius:8,border:`1px solid ${$?"rgba(65,71,84,0.05)":f.borderLight}`,padding:"10px 16px"},children:[jsx(Calendar,{className:"w-5 h-5",style:{color:"#007BFF"}}),jsxs("div",{ref:st,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!ee.isMilestone)if(X$1==="start")O(null);else {if(st.current){let S=st.current.getBoundingClientRect();Z({top:S.bottom+8,left:Math.max(16,S.left-40)});}O("start"),F(ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...de,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:n||ee.isMilestone,children:ee.startDate?ee.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!ee.isMilestone)if(X$1==="end")O(null);else {if(st.current){let S=st.current.getBoundingClientRect();Z({top:S.bottom+8,left:Math.max(16,S.left-40)});}O("end"),F(ee.endDate||ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...de,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:n||ee.isMilestone,children:ee.endDate?ee.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:X$1&&jsxs(Xt,{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:`${Y.top}px`,left:`${Y.left}px`,zIndex:99999,backgroundColor:$?"#0a0a0a":f.bgPrimary,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:S=>S.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${$?"#262626":f.border}`},children:[(()=>{let S=new Date,q=new Date(S);q.setDate(S.getDate()+1);let ce=new Date(S);ce.setDate(S.getDate()+7);let Ce=new Date(S);return Ce.setDate(S.getDate()+14),[{label:"Hoy",date:S},{label:"Ma\xF1ana",date:q},{label:"Pr\xF3xima semana",date:ce},{label:"2 semanas",date:Ce}].map((te,Ge)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:Te=>Te.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:Te=>Te.currentTarget.style.backgroundColor="transparent",onClick:()=>{X$1==="start"?(ke("startDate",te.date),(!ee.endDate||te.date>ee.endDate)&&ke("endDate",te.date),O("end")):(ke("endDate",te.date),(!ee.startDate||te.date<ee.startDate)&&ke("startDate",te.date),O(null));},children:te.label},Ge))})(),jsx("div",{style:{borderTop:`1px solid ${f.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:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",onClick:()=>{ke("startDate",void 0),ke("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(H.getFullYear(),H.getMonth()-1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:H.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>F(new Date(H.getFullYear(),H.getMonth()+1)),className:"p-1 rounded",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((S,q)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:S},q))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let S=H.getFullYear(),q=H.getMonth(),ce=new Date(S,q,1).getDay(),Ce=new Date(S,q+1,0).getDate(),W=new Date,te=[];for(let Te=ce-1;Te>=0;Te--)te.push({day:new Date(S,q,-Te).getDate(),date:new Date(S,q-1,new Date(S,q,-Te).getDate()),isCurrentMonth:false});for(let Te=1;Te<=Ce;Te++)te.push({day:Te,date:new Date(S,q,Te),isCurrentMonth:true});let Ge=42-te.length;for(let Te=1;Te<=Ge;Te++)te.push({day:Te,date:new Date(S,q+1,Te),isCurrentMonth:false});return te.map((Te,Ue)=>{let Ne=Te.date.toDateString()===W.toDateString(),Ve=ee.startDate?.toDateString()===Te.date.toDateString(),Tt=ee.endDate?.toDateString()===Te.date.toDateString(),gt=ee.startDate&&ee.endDate&&Te.date>=ee.startDate&&Te.date<=ee.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Te.isCurrentMonth?Ve||Tt?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:Ve?f.accent:Tt?"#7C3AED":gt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ne&&!Ve&&!Tt?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{X$1==="start"?(ke("startDate",Te.date),ee.endDate&&Te.date>ee.endDate&&ke("endDate",Te.date),O("end")):(ke("endDate",Te.date),ee.startDate&&Te.date<ee.startDate&&ke("startDate",Te.date),O(null));},children:Te.day},Ue)})})()})]})]})]})})]}),le.endDate&&jsx("span",{className:"text-xs text-red-400",children:le.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:f.textTertiary},children:"Progreso Inicial"}),jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#007BFF"},children:[ee.progress,"%"]})]}),jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:$?"#33343c":"#E5E7EB"},onClick:S=>{if(n)return;let q=S.currentTarget.getBoundingClientRect(),ce=Math.round((S.clientX-q.left)/q.width*100/5)*5;ke("progress",Math.max(0,Math.min(100,ce)));},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ee.progress}%`,backgroundColor:"#007BFF"}})})]})]}),jsxs("div",{style:{borderTop:`1px solid ${$?"rgba(65,71,84,0.05)":f.borderLight}`,paddingTop:16},children:[jsxs("button",{type:"button",onClick:()=>R(!Se),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:f.textPrimary},children:[jsx(ChevronDown,{className:`w-4 h-4 transition-transform ${Se?"":"-rotate-90"}`,style:{color:f.textTertiary}}),jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsx(AnimatePresence,{children:Se&&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:f.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Horas Estimadas"})]}),jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:ee.effortMinutes?t2(ee.effortMinutes):"",onChange:S=>{let q=a2(S.target.value);ke("effortMinutes",q);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.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:f.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:f.textTertiary},children:"Fase Padre"})]}),jsxs("select",{value:ee.parentId||"",onChange:S=>ke("parentId",S.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n,children:[jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(S=>S.id!==a?.id).map(S=>jsx("option",{value:S.id,children:S.name},S.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:f.textTertiary},children:"Ubicaci\xF3n"})]}),jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:ee.location||"",onChange:S=>ke("location",S.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n})]}),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:f.textTertiary},children:"Activo / Equipo"})]}),jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:ee.equipment||"",onChange:S=>ke("equipment",S.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n})]})]}),(g||p.length>0||i==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.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:f.textTertiary},children:["Adjuntos ",i==="create"?_.length>0&&`(${_.length})`:p.length>0&&`(${p.length})`]})]}),i==="create"?jsx(so,{cardId:"pending",attachments:_.map((S,q)=>({id:`pending-${q}`,cardId:"pending",name:S.name,size:S.size,type:S.type,url:URL.createObjectURL(S),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:S=>he(q=>[...q,...S]),onDelete:S=>{let q=parseInt(S.replace("pending-",""),10);he(ce=>ce.filter((Ce,W)=>W!==q));},maxSizeMB:10,maxFiles:20}):jsx(so,{cardId:a?.id||"new",attachments:p,onUpload:g&&a?.id?S=>g(a.id,S):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),i==="create"&&_.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[_.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:S=>S.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:S=>S.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:ee.isMilestone,onChange:S=>ke("isMilestone",S.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:f.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:f.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ee.dependencies&&ee.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ee.dependencies.map(S=>{let q=r.find(ce=>ce.id===S);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[q?.name||S.slice(0,8),jsx("button",{type:"button",onClick:()=>{let ce=(ee.dependencies||[]).filter(Ce=>Ce!==S);ke("dependencies",ce);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsx(X,{className:"w-3 h-3"})})]},S)})}),jsxs("button",{type:"button",onClick:()=>{z(!Je),J("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:Je&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{z(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:$?"#0a0a0a":f.bgPrimary,backdropFilter:$?"blur(16px)":void 0,border:`1px solid ${$?"#262626":f.border}`,boxShadow:$?"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 ${f.border}`},children:jsx("input",{type:"text",value:re,onChange:S=>J(S.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(S=>S.id!==a?.id).filter(S=>re===""||S.name.toLowerCase().includes(re.toLowerCase())).map(S=>{let q=ee.dependencies?.includes(S.id);return jsxs("button",{type:"button",onClick:()=>{let ce=ee.dependencies||[],Ce;q?Ce=ce.filter(W=>W!==S.id):Ce=[...ce,S.id],ke("dependencies",Ce);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:q?`${f.accent}10`:"transparent"},onMouseEnter:ce=>{q||(ce.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:ce=>{ce.currentTarget.style.backgroundColor=q?`${f.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?f.accent:"transparent",borderColor:q?f.accent:f.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:f.textPrimary},children:S.name}),jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:S.id.slice(0,8)})]})]},S.id)}),r.filter(S=>S.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.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 ${$?"rgba(65,71,84,0.1)":f.border}`,backgroundColor:$?"rgba(25,27,34,0.2)":void 0},children:[jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:f.textTertiary},onMouseEnter:S=>S.currentTarget.style.color=f.textPrimary,onMouseLeave:S=>S.currentTarget.style.color=f.textTertiary,disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#007BFF",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:S=>!n&&(S.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:S=>!n&&(S.currentTarget.style.filter="brightness(1)"),children:n?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:i==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var Fm=`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 V=Q=>Q.map(ke=>{if(ke.id===B){let Pe=ke.dependencies||[];if(!Pe.includes(P.id))return {...ke,dependencies:[...Pe,P.id]}}return ke.subtasks?{...ke,subtasks:V(ke.subtasks)}:ke});cr.current+=1,$e(Q=>V(Q)),J?.(P.id,B);},[J,qc]),Xc=useCallback((P,B)=>{let V=Q=>Q.map(ke=>{if(ke.id===P&&ke.dependencies){let Pe=ke.dependencies.filter(Ft=>Ft!==B);return {...ke,dependencies:Pe}}return ke.subtasks?{...ke,subtasks:V(ke.subtasks)}:ke});cr.current+=1,$e(Q=>V(Q)),Ae?.(P,B);},[Ae]),{startDate:mn,endDate:ul}=useMemo(()=>{let P=ne.filter(Pe=>Pe.startDate&&Pe.endDate);if(P.length===0){let Pe=new Date,Ft=new Date(Pe);Ft.setDate(Ft.getDate()-30);let ct=new Date(Pe);return ct.setDate(ct.getDate()+60),{startDate:Ft,endDate:ct}}let B=P.flatMap(Pe=>[Pe.startDate,Pe.endDate]).filter(Pe=>Pe!==void 0),V=new Date(Math.min(...B.map(Pe=>Pe.getTime()))),Q=new Date(Math.max(...B.map(Pe=>Pe.getTime()))),ke=gt==="day"?7:gt==="week"?14:30;return V.setDate(V.getDate()-ke),Q.setDate(Q.getDate()+ke),{startDate:V,endDate:Q}},[ne,gt]);useEffect(()=>{wt.current?.(mn,ul);},[mn,ul]);let yf=useCallback(async()=>{if(!Ba.current||!Ct.current||!aa.current)return;await new Promise(Vo=>setTimeout(Vo,200));let P=Ba.current,B=Ct.current,V=sa.current||B.querySelector(".gantt-grid-scroll"),Q=aa.current,ke=V?.scrollTop||0,Pe=V?.scrollLeft||0,Ft=Q.scrollTop,ct=Q.scrollLeft,Sa=P.style.overflow,Jt=P.style.height,pa=V?.style.overflow||"",dr=Q.style.overflow,Sr=B.style.overflow,Co=P.style.width,fn=Q.style.width;try{let Vo=V?.querySelector(".gantt-taskgrid-content"),ao=Q.querySelector("svg"),gl=ao?.getAttribute("height")?parseInt(ao.getAttribute("height"),10):ao?.getBoundingClientRect().height||0,bn=Vo?.scrollHeight||V?.scrollHeight||600,Hs=Math.max(gl,Q.scrollHeight),Yn=ao?.getAttribute("width")?parseInt(ao.getAttribute("width"),10):ao?.getBoundingClientRect().width||Q.scrollWidth,Df=P.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,fl=Math.max(bn,Hs,gl),Zc=Df+fl+50,eu=(V?.offsetWidth||B.offsetWidth||300)+Yn+10;V&&(V.scrollTop=0,V.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,P.style.overflow="visible",P.style.height=`${Zc}px`,P.style.width=`${eu}px`,B.style.overflow="visible",V&&(V.style.overflow="visible",V.style.height=`${fl+50}px`),Q.style.overflow="visible",Q.style.height=`${fl+50}px`,Q.style.width=`${Yn+10}px`,await new Promise(zs=>setTimeout(zs,150));let Sf=await toPng(P,{backgroundColor:Ot.bgPrimary,pixelRatio:2,width:eu,height:Zc,skipFonts:!1,filter:zs=>{if(!(zs instanceof Element))return !0;let tu=window.getComputedStyle(zs),au=parseInt(tu.zIndex,10);return !(!isNaN(au)&&au>=50||tu.position==="fixed")}}),bl=document.createElement("a");bl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,bl.href=Sf,bl.click();}finally{P.style.overflow=Sa,P.style.height=Jt,P.style.width=Co,B.style.overflow=Sr,V&&(V.style.overflow=pa,V.style.height="",V.scrollTop=ke,V.scrollLeft=Pe),Q.style.overflow=dr,Q.style.height="",Q.style.width=fn,Q.scrollTop=Ft,Q.scrollLeft=ct;}},[Ot]),xf=useCallback(async()=>{await Se.exportToPDF(ne);},[ne]),pl=useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m});pl.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m};let vf=useCallback(async()=>{let P=new Date,B=ke=>String(ke).padStart(2,"0"),V=`${P.getFullYear()}-${B(P.getMonth()+1)}-${B(P.getDate())}_${B(P.getHours())}${B(P.getMinutes())}`,Q=m?m.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Se.exportToExcel(ne,`${Q}_${V}.xlsx`,pl.current);},[ne,m]),wf=useCallback(()=>{let P=Se.exportToCSV(ne),B=new Blob([P],{type:"text/csv;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(B),V.download="gantt-chart.csv",V.click(),URL.revokeObjectURL(V.href);},[ne]),kf=useCallback(()=>{let P=Se.exportToJSON(ne),B=new Blob([P],{type:"application/json;charset=utf-8;"}),V=document.createElement("a");V.href=URL.createObjectURL(B),V.download="gantt-chart.json",V.click(),URL.revokeObjectURL(V.href);},[ne]),Cf=useCallback(()=>{Se.exportToMSProject(ne,"Gantt Project","project.xml");},[ne]),Tf=P=>{P.preventDefault(),Ne(true);},gn=useRef(false),[ml,Jc]=useState(false),qn=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let P=aa.current,B=Ct.current?.querySelector(".gantt-grid-scroll");if(!P||!B)return;let V=()=>{if(gn.current)return;gn.current=true;let ct=P.scrollTop;q(ct),B.scrollTop=ct,requestAnimationFrame(()=>{gn.current=false;});},Q=()=>{if(gn.current)return;gn.current=true;let ct=B.scrollTop;q(ct),P.scrollTop=ct,requestAnimationFrame(()=>{gn.current=false;});},ke=ct=>{if(me&&B){let Jt=B.parentElement?.getBoundingClientRect()?.left||0,pa=ct.clientX-Jt,dr=200,Sr=We+St,Co=window.innerWidth*Lt,fn=Math.max(Sr,Co);pa>=dr&&pa<=fn&&je(pa);}if(ml&&P){let Sa=ct.clientX-qn.current.x,Jt=ct.clientY-qn.current.y;P.scrollLeft=qn.current.scrollLeft-Sa,P.scrollTop=qn.current.scrollTop-Jt;}},Pe=()=>{Ne(false),Jc(false);},Ft=ct=>{if(ct.button!==0)return;let Sa=ct.target;Sa.closest("[data-task-bar]")||Sa.closest("[data-dependency-line]")||Sa.closest("button")||Sa.closest('[role="button"]')||Sa.tagName==="rect"&&Sa.getAttribute("data-clickable")==="true"||(Jc(true),qn.current={x:ct.clientX,y:ct.clientY,scrollLeft:P.scrollLeft,scrollTop:P.scrollTop},ct.preventDefault());};return P.addEventListener("scroll",V),B.addEventListener("scroll",Q),P.addEventListener("mousedown",Ft),document.addEventListener("mousemove",ke),document.addEventListener("mouseup",Pe),()=>{P.removeEventListener("scroll",V),B.removeEventListener("scroll",Q),P.removeEventListener("mousedown",Ft),document.removeEventListener("mousemove",ke),document.removeEventListener("mouseup",Pe);}},[me,ml,We]);let Qc=useRef(false),Nf=useRef(null);return useLayoutEffect(()=>{if(Qc.current||ne.length===0||!aa.current)return;Qc.current=true,Nf.current=mn;let P=aa.current,B=new Date,V=gt==="day"?60:gt==="week"?20:8,Q=(B.getTime()-mn.getTime())/(1e3*60*60*24),ke=P.clientWidth,Ft=Q*V*D-ke/2;Q>=0&&ke>0&&(P.scrollLeft=Math.max(0,Ft));},[ne.length,mn,gt,D]),jsx(Mn.Provider,{value:Ce,children:jsx(wl.Provider,{value:Wa,children:jsxs("div",{ref:Ba,className:"flex flex-col h-full w-full",style:{backgroundColor:Ot.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Ot.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Ot.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx("div",{style:{position:"relative",zIndex:100},children:jsx(yi,{theme:Ot,timeScale:gt,onTimeScaleChange:tt,zoom:D,onZoomChange:K,currentTheme:we,onThemeChange:U,rowDensity:H,onRowDensityChange:le,showThemeSelector:c,showCreateTaskButton:C&&de?.canCreateTask!==false&&!de?.canCreateSubtaskOnly,createTaskLabel:N,onCreateTask:T,taskFilter:Le,onTaskFilterChange:nt,hideCompleted:oe,onHideCompletedChange:fe,toolbarRightContent:E,wbsLevel:pe,onWbsLevelChange:M,maxWbsDepth:jt,viewMode:Re,onViewModeChange:De,projectForecast:O,onExportPNG:i?yf:void 0,onExportPDF:i?xf:void 0,onExportExcel:i?vf:void 0,onExportCSV:i?wf:void 0,onExportJSON:i?kf:void 0,onExportMSProject:i?Cf:void 0,showCriticalPath:Fe,onShowCriticalPathChange:Vt,showDependencies:ft,onShowDependenciesChange:Mt,highlightWeekends:ut,onHighlightWeekendsChange:Dt,showBaseline:Ue,onShowBaselineChange:P=>{P&&Re!=="oracle"&&De("oracle"),!P&&Re==="oracle"&&De("execution");},onCopySnapshotLink:lt,hasDependencies:rf})}),jsxs("div",{ref:Ct,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:sa,className:"gantt-grid-scroll flex-shrink-0",style:{width:Et,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(wi,{tasks:_c,theme:Ot,rowHeight:$s,availableUsers:d,templates:Qa,showCriticalPath:Fe,onTaskClick:F,onTaskDblClick:Kc,onTaskContextMenu:Z,onTaskToggle:sf,scrollTop:j,columns:ot,onToggleColumn:of,onColumnResize:nf,onTaskUpdate:pn,onTaskIndent:lf,onTaskOutdent:df,onTaskMove:uf,onMultiTaskDelete:dl,onTaskDuplicate:pf,onTaskCreate:mf,onTaskRename:gf,onCreateSubtask:cl,onOpenTaskModal:F?P=>F(P):void 0,onDeleteRequest:(P,B)=>Xt({taskId:P,taskName:B}),onTaskReparent:cf,scrollContainerRef:sa})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Ot.border,zIndex:15},onMouseDown:Tf}),jsx("div",{ref:aa,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:ml?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Pi,{tasks:_c,theme:Ot,rowHeight:$s,timeScale:gt,startDate:mn,endDate:ul,zoom:D,locale:b,templates:Qa,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:F,onTaskDblClick:Kc,onTaskContextMenu:bf,onTaskDateChange:ff,onDependencyCreate:Yc,onDependencyDelete:Xc,showBaseline:Ue,showCriticalPath:Fe,showDependencies:ft,highlightWeekends:ut,canEditTask:de?.canEditTask})})]}),Oe.task&&jsx(Pn,{isOpen:Oe.isOpen,x:Oe.x,y:Oe.y,theme:Ot,onClose:()=>kt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=Oe.task;if(!P)return [];let B=Se.findTaskById(ne,P.id)||P,V=B.subtasks&&B.subtasks.length>0,Q=de?.canCreateTask!==false,ke=de?.canDeleteTask!==false;if(V){let Jt=[],pa=de?.canDuplicateTask!==false;return Q&&Jt.push({id:"addSubtask",label:Ce.contextMenu?.addSubtask||"Add Subtask",icon:ua.Add,onClick:()=>{Je?Je(B):cl(B.id);}}),pa&&Jt.push({id:"duplicate",label:Ce.contextMenu?.duplicateTask||"Duplicate Task",icon:ua.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(B):$e(dr=>fs(dr,[B.id]).tasks),kt({isOpen:false,x:0,y:0,task:null});}}),ke&&(Jt.length>0&&Jt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Jt.push({id:"delete",label:Ce.contextMenu?.deleteTask||"Delete Task",icon:ua.Delete,onClick:()=>{Xt({taskId:B.id,taskName:B.name});}})),Jt}let Pe=de?.canUpdateTask!==false,Ft=de?.canDuplicateTask!==false,ct=[];return Pe&&ct.push({id:"edit",label:Ce.contextMenu?.editTask||"Edit Task",icon:ua.Pencil,onClick:()=>{ye?ye(B):Wt(B);}}),Q&&ct.push({id:"addSubtask",label:Ce.contextMenu?.addSubtask||"Add Subtask",icon:ua.Add,onClick:()=>{Je?Je(B):cl(B.id);}}),ct.length>0&&Pe&&ct.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),Pe&&(ct.push({id:"markIncomplete",label:Ce.contextMenu?.markIncomplete||"Mark Incomplete",icon:ua.MarkIncomplete,onClick:()=>{z?z(B):pn(B.id,{status:"todo",progress:0});},disabled:B.status==="todo"}),ct.push({id:"setInProgress",label:Ce.contextMenu?.setInProgress||"Set In Progress",icon:ua.SetInProgress,onClick:()=>{re?re(B):pn(B.id,{status:"in-progress"});},disabled:B.status==="in-progress"}),ct.push({id:"markComplete",label:Ce.contextMenu?.markComplete||"Mark Complete",icon:ua.MarkComplete,onClick:()=>{pn(B.id,{status:"completed",progress:100});},disabled:B.status==="completed"})),(Ft||Pe&&B.startDate&&B.endDate)&&ct.length>0&&ct.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Ft&&ct.push({id:"duplicate",label:Ce.contextMenu?.duplicateTask||"Duplicate Task",icon:ua.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(B):$e(Jt=>fs(Jt,[B.id]).tasks),kt({isOpen:false,x:0,y:0,task:null});}}),Pe&&B.startDate&&B.endDate&&ct.push({id:"split",label:Ce.contextMenu?.splitTask||"Split Task",icon:ua.Split,onClick:()=>{let Jt=B.startDate.getTime(),pa=B.endDate.getTime(),dr=Jt+(pa-Jt)/2,Sr=new Date(dr);hf(B,Sr);}}),ke&&(ct.length>0&&ct.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),ct.push({id:"delete",label:Ce.contextMenu?.deleteTask||"Delete Task",icon:ua.Delete,onClick:()=>{Xt({taskId:B.id,taskName:B.name});}})),ct})()}),jsx(bo,{task:pt,isOpen:!!pt,onClose:()=>Wt(null),onTaskUpdate:P=>{pt&&(pn(pt.id,P),Wt(null));},theme:we==="light"?"light":"dark",locale:b==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsx(AnimatePresence,{children:Ta&&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:()=>Xt(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:P=>P.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Ot.bgSecondary,border:`1px solid ${Ot.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Ot.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:Ot.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ce.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:Ot.textSecondary,fontFamily:"Inter, sans-serif"},children:b==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsxs("p",{className:"text-sm leading-relaxed",style:{color:Ot.textSecondary,fontFamily:"Inter, sans-serif"},children:[b==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:Ot.textPrimary},children:['"',Ta.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Ot.bgPrimary,borderTop:`1px solid ${Ot.border}`},children:[jsx("button",{onClick:()=>Xt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Ot.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=Ot.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:b==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{dl([Ta.taskId]),Xt(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:P=>{P.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),b==="es"?"Eliminar":"Delete"]})]})]})})}),f?.enabled&&jsx(Ii,{tasks:ne,theme:Ot,config:f,onTasksUpdate:$e,onTaskUpdate:pn,onTaskCreate:P=>{$e(B=>[...B,P]);},onTaskDelete:P=>{dl([P]);},onDependencyCreate:(P,B)=>{let V=Se.findTaskById(ne,P);V&&Yc(V,B);},onDependencyDelete:Xc})]})})})});function t2(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 a2(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 o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var Id=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Bd=[{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 Mm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:c="dark",customStatuses:i=[],availableTags:m=[],onCreateTag:d,attachments:p=[],onUploadAttachments:g,onDeleteAttachment:y,defaultStatus:x}){let h=[...Id,...i.filter(D=>!Id.some(K=>K.id===D.id))],f=ht[c]||ht.dark,[b,w]=useState(false),[C,N]=useState(false),[T,k]=useState(false),[v,E]=useState(false),[I,S]=useState({top:0,left:0}),[X$1,O]=useState(null),[$,F]=useState(new Date),[Y,Z]=useState({top:0,left:0}),[Ee,R]=useState(false),[_,ye]=useState([]),[Je,z]=useState(false),[re,J]=useState(""),Ae=useRef(null),ve=useRef(null),ze=useRef(null),Be=useRef(null),st=useRef(null),[ee,it]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[de,lt]=useState({});useEffect(()=>{a?(it({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||"#2E94FF",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)):(it({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#2E94FF",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),R(false),ye([]));},[a,e,x]),useEffect(()=>{let D=K=>{Ae.current&&!Ae.current.contains(K.target)&&w(false),ve.current&&!ve.current.contains(K.target)&&N(false),ze.current&&!ze.current.contains(K.target)&&k(false),Be.current&&!Be.current.contains(K.target)&&E(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);let rt=()=>{let D={};return ee.name.trim()||(D.name="El nombre es requerido"),ee.startDate&&ee.endDate&&ee.startDate>ee.endDate&&(D.endDate="La fecha de fin debe ser posterior a la de inicio"),lt(D),Object.keys(D).length===0},At=async D=>{if(D.preventDefault(),!!rt())try{let K=l==="create"&&_.length>0?{...ee,pendingFiles:_}:ee;await s(K),ye([]),t();}catch(K){console.error("Error submitting task:",K);}},we=(D,K)=>{it(pe=>{let Te={...pe,[D]:K};if(D==="status"){let G=K;G==="todo"?Te.progress=0:G==="in-progress"?(pe.progress===0||pe.progress===100)&&(Te.progress=50):G==="completed"||G==="closed"?Te.progress=100:(G==="in-review"||G==="review")&&(Te.progress=75);}if(D==="progress"){let G=typeof K=="number"?K:parseInt(K,10);G===100&&pe.status!=="completed"?Te.status="completed":G>0&&G<100&&pe.status==="todo"?Te.status="in-progress":G===0&&pe.status!=="todo"&&(Te.status="todo");}return Te}),de[D]&<(pe=>{let Te={...pe};return delete Te[D],Te});},vt=h.find(D=>D.id===ee.status)??Id[0],gt=Bd.find(D=>D.id===ee.priority)??Bd[1],tt=Xo.find(D=>D.value===ee.color)??Xo[0],H=c==="dark",le={backgroundColor:H?"#1d1f27":f.bgSecondary,border:`1px solid ${H?"rgba(65,71,84,0.1)":f.borderLight}`,color:f.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:H?"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:H?"#0a0a0a":f.bgPrimary,border:`1px solid ${H?"rgba(65,71,84,0.1)":f.border}`,boxShadow:H?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:D=>D.stopPropagation(),children:jsxs("form",{onSubmit:At,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsx("input",{type:"text",value:ee.name,onChange:D=>we("name",D.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:f.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),de.name&&jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),de.name]}),jsx("textarea",{value:ee.description||"",onChange:D=>we("description",D.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:f.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":f.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})]}),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:Ae,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&w(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...le,borderColor:vt.color,backgroundColor:`${vt.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:vt.color}}),jsx("span",{style:{color:vt.color},children:vt.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:vt.color}})]}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:h.map(D=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:K=>K.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:K=>K.currentTarget.style.backgroundColor="transparent",onClick:()=>{we("status",D.id),w(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:D.color}}),D.title,ee.status===D.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),jsxs("div",{ref:ve,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&N(!C),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:le,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:gt.color}}),jsx("span",{children:gt.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:C&&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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Bd.map(D=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:K=>K.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:K=>K.currentTarget.style.backgroundColor="transparent",onClick:()=>{we("priority",D.id),N(false);},children:[jsx("span",{children:D.icon}),D.label,ee.priority===D.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:f.accent}})]},D.id))})})]}),o.length>0&&jsxs("div",{ref:ze,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&k(!T),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:le,disabled:n,children:[ee.assignees&&ee.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:ee.assignees.slice(0,3).map((D,K)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:D.color||f.accent,borderColor:f.bgSecondary},children:D.initials},K))}),ee.assignees.length>3&&jsxs("span",{style:{color:f.textTertiary},children:["+",ee.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:f.textTertiary}}),jsx("span",{style:{color:f.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:T&&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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:o.map(D=>{let K=ee.assignees?.some(pe=>pe.name===D.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:f.textPrimary},onMouseEnter:pe=>pe.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:pe=>pe.currentTarget.style.backgroundColor="transparent",onClick:()=>{let pe=K?(ee.assignees||[]).filter(Te=>Te.name!==D.name):[...ee.assignees||[],{name:D.name,avatar:D.avatar,initials:D.name.split(" ").map(Te=>Te[0]).join("").toUpperCase().slice(0,2),color:f.accent}];we("assignees",pe);},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:f.accent},children:D.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:D.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:K&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:f.accent}})})]},D.id)})})})]}),jsxs("div",{ref:Be,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(v)E(false);else {if(Be.current){let D=Be.current.getBoundingClientRect(),K=window.innerHeight,pe=120,G=K-D.bottom<pe?D.top-pe-8:D.bottom+8;S({top:G,left:D.left});}E(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:le,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ee.color}}),jsx("span",{children:tt.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:f.textTertiary}})]}),jsx(AnimatePresence,{children:v&&jsxs(Qt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>E(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${I.top}px`,left:`${I.left}px`,zIndex:99999,backgroundColor:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:D=>D.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Xo.slice(0,18).map(D=>{let K=ee.color===D.value;return jsx("button",{type:"button",onClick:pe=>{pe.preventDefault(),pe.stopPropagation(),we("color",D.value),E(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:D.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:D.value,outline:K?`2px solid ${D.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},D.value)})})})})]})})]}),m.length>0||d?jsx(So,{selectedTags:ee.tags||[],availableTags:m,onChange:D=>we("tags",D),onCreateTag:d,theme:f,disabled:n}):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:f.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:H?"#191b22":f.bgSecondary,borderRadius:8,border:`1px solid ${H?"rgba(65,71,84,0.05)":f.borderLight}`,padding:"10px 16px"},children:[jsx(Calendar,{className:"w-5 h-5",style:{color:"#007BFF"}}),jsxs("div",{ref:st,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!ee.isMilestone)if(X$1==="start")O(null);else {if(st.current){let D=st.current.getBoundingClientRect();Z({top:D.bottom+8,left:Math.max(16,D.left-40)});}O("start"),F(ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...le,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:n||ee.isMilestone,children:ee.startDate?ee.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:f.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!ee.isMilestone)if(X$1==="end")O(null);else {if(st.current){let D=st.current.getBoundingClientRect();Z({top:D.bottom+8,left:Math.max(16,D.left-40)});}O("end"),F(ee.endDate||ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...le,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:n||ee.isMilestone,children:ee.endDate?ee.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:X$1&&jsxs(Qt,{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:`${Y.top}px`,left:`${Y.left}px`,zIndex:99999,backgroundColor:H?"#0a0a0a":f.bgPrimary,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${H?"#262626":f.border}`},children:[(()=>{let D=new Date,K=new Date(D);K.setDate(D.getDate()+1);let pe=new Date(D);pe.setDate(D.getDate()+7);let Te=new Date(D);return Te.setDate(D.getDate()+14),[{label:"Hoy",date:D},{label:"Ma\xF1ana",date:K},{label:"Pr\xF3xima semana",date:pe},{label:"2 semanas",date:Te}].map((te,Re)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:f.textPrimary},onMouseEnter:De=>De.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:De=>De.currentTarget.style.backgroundColor="transparent",onClick:()=>{X$1==="start"?(we("startDate",te.date),(!ee.endDate||te.date>ee.endDate)&&we("endDate",te.date),O("end")):(we("endDate",te.date),(!ee.startDate||te.date<ee.startDate)&&we("startDate",te.date),O(null));},children:te.label},Re))})(),jsx("div",{style:{borderTop:`1px solid ${f.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:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",onClick:()=>{we("startDate",void 0),we("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($.getFullYear(),$.getMonth()-1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:f.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:f.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:$.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>F(new Date($.getFullYear(),$.getMonth()+1)),className:"p-1 rounded",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:f.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((D,K)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:f.textTertiary},children:D},K))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let D=$.getFullYear(),K=$.getMonth(),pe=new Date(D,K,1).getDay(),Te=new Date(D,K+1,0).getDate(),G=new Date,te=[];for(let De=pe-1;De>=0;De--)te.push({day:new Date(D,K,-De).getDate(),date:new Date(D,K-1,new Date(D,K,-De).getDate()),isCurrentMonth:false});for(let De=1;De<=Te;De++)te.push({day:De,date:new Date(D,K,De),isCurrentMonth:true});let Re=42-te.length;for(let De=1;De<=Re;De++)te.push({day:De,date:new Date(D,K+1,De),isCurrentMonth:false});return te.map((De,Ue)=>{let Fe=De.date.toDateString()===G.toDateString(),_e=ee.startDate?.toDateString()===De.date.toDateString(),ft=ee.endDate?.toDateString()===De.date.toDateString(),dt=ee.startDate&&ee.endDate&&De.date>=ee.startDate&&De.date<=ee.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:De.isCurrentMonth?_e||ft?"#FFF":f.textPrimary:f.textTertiary,backgroundColor:_e?f.accent:ft?"#7C3AED":dt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Fe&&!_e&&!ft?`inset 0 0 0 1px ${f.accent}`:"none"},onClick:()=>{X$1==="start"?(we("startDate",De.date),ee.endDate&&De.date>ee.endDate&&we("endDate",De.date),O("end")):(we("endDate",De.date),ee.startDate&&De.date<ee.startDate&&we("startDate",De.date),O(null));},children:De.day},Ue)})})()})]})]})]})})]}),de.endDate&&jsx("span",{className:"text-xs text-red-400",children:de.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:f.textTertiary},children:"Progreso Inicial"}),jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#007BFF"},children:[ee.progress,"%"]})]}),jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:H?"#33343c":"#E5E7EB"},onClick:D=>{if(n)return;let K=D.currentTarget.getBoundingClientRect(),pe=Math.round((D.clientX-K.left)/K.width*100/5)*5;we("progress",Math.max(0,Math.min(100,pe)));},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ee.progress}%`,backgroundColor:"#007BFF"}})})]})]}),jsxs("div",{style:{borderTop:`1px solid ${H?"rgba(65,71,84,0.05)":f.borderLight}`,paddingTop:16},children:[jsxs("button",{type:"button",onClick:()=>R(!Ee),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:f.textPrimary},children:[jsx(ChevronDown,{className:`w-4 h-4 transition-transform ${Ee?"":"-rotate-90"}`,style:{color:f.textTertiary}}),jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsx(AnimatePresence,{children:Ee&&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:f.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:f.textTertiary},children:"Horas Estimadas"})]}),jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:ee.effortMinutes?t2(ee.effortMinutes):"",onChange:D=>{let K=a2(D.target.value);we("effortMinutes",K);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.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:f.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:f.textTertiary},children:"Fase Padre"})]}),jsxs("select",{value:ee.parentId||"",onChange:D=>we("parentId",D.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n,children:[jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(D=>D.id!==a?.id).map(D=>jsx("option",{value:D.id,children:D.name},D.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:f.textTertiary},children:"Ubicaci\xF3n"})]}),jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:ee.location||"",onChange:D=>we("location",D.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n})]}),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:f.textTertiary},children:"Activo / Equipo"})]}),jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:ee.equipment||"",onChange:D=>we("equipment",D.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textPrimary,border:`1px solid ${f.borderLight}`},disabled:n})]})]}),(g||p.length>0||l==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:f.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:f.textTertiary},children:["Adjuntos ",l==="create"?_.length>0&&`(${_.length})`:p.length>0&&`(${p.length})`]})]}),l==="create"?jsx(io,{cardId:"pending",attachments:_.map((D,K)=>({id:`pending-${K}`,cardId:"pending",name:D.name,size:D.size,type:D.type,url:URL.createObjectURL(D),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:D=>ye(K=>[...K,...D]),onDelete:D=>{let K=parseInt(D.replace("pending-",""),10);ye(pe=>pe.filter((Te,G)=>G!==K));},maxSizeMB:10,maxFiles:20}):jsx(io,{cardId:a?.id||"new",attachments:p,onUpload:g&&a?.id?D=>g(a.id,D):void 0,onDelete:y,maxSizeMB:10,maxFiles:20}),l==="create"&&_.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:f.textTertiary},children:[_.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:D=>D.currentTarget.style.backgroundColor=f.hoverBg,onMouseLeave:D=>D.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:ee.isMilestone,onChange:D=>we("isMilestone",D.target.checked),className:"w-4 h-4 rounded",style:{accentColor:f.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:f.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:f.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ee.dependencies&&ee.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ee.dependencies.map(D=>{let K=r.find(pe=>pe.id===D);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${f.accent}20`,color:f.accent},children:[K?.name||D.slice(0,8),jsx("button",{type:"button",onClick:()=>{let pe=(ee.dependencies||[]).filter(Te=>Te!==D);we("dependencies",pe);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsx(X,{className:"w-3 h-3"})})]},D)})}),jsxs("button",{type:"button",onClick:()=>{z(!Je),J("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:f.bgSecondary,color:f.textSecondary},disabled:n,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:Je&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{z(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:H?"#0a0a0a":f.bgPrimary,backdropFilter:H?"blur(16px)":void 0,border:`1px solid ${H?"#262626":f.border}`,boxShadow:H?"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 ${f.border}`},children:jsx("input",{type:"text",value:re,onChange:D=>J(D.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:f.bgSecondary,color:f.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(D=>D.id!==a?.id).filter(D=>re===""||D.name.toLowerCase().includes(re.toLowerCase())).map(D=>{let K=ee.dependencies?.includes(D.id);return jsxs("button",{type:"button",onClick:()=>{let pe=ee.dependencies||[],Te;K?Te=pe.filter(G=>G!==D.id):Te=[...pe,D.id],we("dependencies",Te);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:K?`${f.accent}10`:"transparent"},onMouseEnter:pe=>{K||(pe.currentTarget.style.backgroundColor=f.hoverBg);},onMouseLeave:pe=>{pe.currentTarget.style.backgroundColor=K?`${f.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:K?f.accent:"transparent",borderColor:K?f.accent:f.borderLight},children:K&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:f.textPrimary},children:D.name}),jsx("span",{className:"text-[10px]",style:{color:f.textTertiary},children:D.id.slice(0,8)})]})]},D.id)}),r.filter(D=>D.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:f.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 ${H?"rgba(65,71,84,0.1)":f.border}`,backgroundColor:H?"rgba(25,27,34,0.2)":void 0},children:[jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:f.textTertiary},onMouseEnter:D=>D.currentTarget.style.color=f.textPrimary,onMouseLeave:D=>D.currentTarget.style.color=f.textTertiary,disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#007BFF",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:D=>!n&&(D.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:D=>!n&&(D.currentTarget.style.filter="brightness(1)"),children:n?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:l==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var Fm=`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
|
|
@@ -410,13 +410,13 @@ If ambiguous, ask for clarification in the message field.`;function Pm(e){return
|
|
|
410
410
|
${Am(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
|
|
411
411
|
`)}
|
|
412
412
|
|
|
413
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function Am(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function vo(e,t){let a=Am(e),r=t.toLowerCase().trim(),o=a.find(i=>i.name.toLowerCase()===r);if(o)return o;let s=a.find(i=>i.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(i=>{let c=i.name.toLowerCase();return n.every(l=>c.includes(l))})}function Bd(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let p=new Date(r);return p.setDate(p.getDate()+1),p}if(a==="yesterday"||a==="ayer"){let p=new Date(r);return p.setDate(p.getDate()-1),p}if(a==="next week"||a==="la pr\xF3xima semana"){let p=new Date(r);return p.setDate(p.getDate()+7),p}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let y=new Date(r),x=y.getDay(),h=g-x;return h<=0&&(h+=7),y.setDate(y.getDate()+h),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let p=parseInt(s[1],10),g=s[2].toLowerCase(),y=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?y.setDate(y.getDate()+p):g==="week"||g==="semana"||g==="semanas"?y.setDate(y.getDate()+p*7):(g==="month"||g==="mes"||g==="meses")&&y.setMonth(y.getMonth()+p),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let i=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(i&&i[1]&&i[2]&&i[3]){let p=parseInt(i[1],10),g=parseInt(i[2],10)-1,y=parseInt(i[3],10);return new Date(y,g,p)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},l=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let p=parseInt(l[1],10),g=c[l[2].toLowerCase()],y=l[3]?parseInt(l[3],10):r.getFullYear();if(g!==void 0)return new Date(y,g,p)}let m={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let p=m[d[1].toLowerCase()],g=parseInt(d[2],10),y=d[3]?parseInt(d[3],10):r.getFullYear();if(p!==void 0)return new Date(y,p,g)}return null}function Rd(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function Od(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function Lm(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 Im(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let l=r[1].trim(),m=r[2].trim(),d=vo(t,l),p=Bd(m);if(!d)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${m}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(p);return y.setDate(y.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:p,endDate:y},message:`Moved "${d.name}" to ${p.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),m=o[2].trim(),d=vo(t,l),p=Rd(m);if(!d)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!p||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+p),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${p} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),m=s[2].trim(),d=vo(t,l),p=Od(m);return d?p===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:p},message:`Set "${d.name}" progress to ${p}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let l=n[1].trim(),m=n[2].trim(),d=vo(t,l);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:m},message:`Renamed "${d.name}" to "${m}".`,success:true}:{type:"rename_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let i=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let l=i[1].trim(),m=i[2].trim(),d=vo(t,l),p=vo(t,m);return d?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:d.id,dependencyTo:p.id,message:`Linked "${d.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:m,message:`Could not find a task named "${m}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let l=c[1].trim(),m=vo(t,l);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function Bm(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 r2(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 o2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Bi(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let d=a.find(p=>p.id===m);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>Bi(m,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let n=m=>{if(m)return typeof m=="string"?new Date(m):m},i=n(e.startDate),c=n(e.endDate),l=e.metadata?.isMilestone===true||i&&c&&Math.abs(c.getTime()-i.getTime())<=864e5;return {id:e.id,name:e.title,startDate:i,endDate:c,progress:e.progress||0,status:r2(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function Rm(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:o2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Om(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Bi(r,e,t))}var $d={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},Hd={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Equipo",blockers:"Bloqueantes",weight:"Peso"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},Ri={en:$d,es:Hd};function zd(e){return Ri[e]||Ri.en}function Oi(e,t){let a=zd(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 Ud=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function $m(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 Hm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),i=useRef(null);useEffect(()=>{let g=y=>{i.current&&!i.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=$m(e),l=Ud[0],m=Ud.find(g=>g.value===c)??l,d=m.icon,p=g=>{switch($m(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(d,{className:u("w-4 h-4 flex-shrink-0",m.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)})]}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(d,{className:u("w-4 h-4 flex-shrink-0",m.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:u("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:Ud.map(g=>{let y=g.icon;return jsxs("button",{onClick:x=>{x.stopPropagation(),t(g.value),n(false);},className:u("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===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(y,{className:u("w-4 h-4",g.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p(g.value)})]},g.value)})})]})}var Wd=[{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 Um({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),i=useRef(null);useEffect(()=>{let m=d=>{i.current&&!i.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let c=Wd.find(m=>m.value===e)??Wd[4],l=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:u("w-4 h-4",c.color)}),jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]})]}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:m=>{m.stopPropagation(),n(!s);},className:u("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:u("w-4 h-4",c.color)}),jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[l]}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Wd.map(m=>jsxs("button",{onClick:d=>{d.stopPropagation(),t(m.value),n(false);},className:u("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===m.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:u("w-2 h-2 rounded-full",m.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:m.label[l]})]},m.value))})]})}function xs(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Gd(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function Vd({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,i]=useState(false),[c,l]=useState(""),m=useRef(null),d=useRef(null);useEffect(()=>{let x=h=>{m.current&&!m.current.contains(h.target)&&(i(false),l(""));};return n&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let p=t.filter(x=>x.name.toLowerCase().includes(c.toLowerCase())),g=x=>e.some(h=>h.name===x),y=x=>{if(a){if(g(x.name))a(e.filter(h=>h.name!==x.name));else {let h={name:x.name,initials:xs(x.name),color:x.color||Gd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};a([...e,h]);}i(false),l("");}};return s||!a?e.length===0?jsx("span",{className:u("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,h)=>jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Gd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||xs(x.name)},`${x.name}-${h}`)),e.length>3&&jsxs("div",{className:u("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:m,className:"relative",children:[jsx("button",{onClick:x=>{x.stopPropagation(),i(!n);},className:u("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:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:u("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,h)=>jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Gd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||xs(x.name)},`${x.name}-${h}`)),e.length>2&&jsxs("span",{className:u("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:d,type:"text",value:c,onChange:x=>l(x.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,h)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||xs(x.name)}),x.name.split(" ")[0],jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(b=>b.name!==x.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsx(X,{style:{width:10,height:10}})})]},`${x.name}-${h}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:p.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):p.map(x=>{let h=g(x.name);return jsxs("button",{onClick:f=>{f.stopPropagation(),y(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:h?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{h||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{h||(f.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):xs(x.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),h&&jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function Km({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:i=false,placeholder:c}){let[l,m]=useState(false),[d,p]=useState(o),[g,y]=useState(()=>{let k=o==="start"?e:t;if(k){let v=k instanceof Date?k:new Date(k);return new Date(v.getFullYear(),v.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=useRef(null),h=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let k=v=>{x.current&&!x.current.contains(v.target)&&m(false);};return l&&document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),useEffect(()=>{l&&p(r?o:"start");},[l,r,o]);let b=k=>k?k.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=useCallback(()=>{let k=g.getFullYear(),v=g.getMonth(),E=new Date(k,v,1),D=new Date(k,v+1,0).getDate(),X=E.getDay(),O=[],F=new Date(k,v,0).getDate();for(let Z=X-1;Z>=0;Z--)O.push({date:new Date(k,v-1,F-Z),isCurrentMonth:false});for(let Z=1;Z<=D;Z++)O.push({date:new Date(k,v,Z),isCurrentMonth:true});let Y=42-O.length;for(let Z=1;Z<=Y;Z++)O.push({date:new Date(k,v+1,Z),isCurrentMonth:false});return O},[g]),C=k=>{if(r)o==="start"?a(k,f||void 0):a(h||void 0,k),m(false);else if(d==="start"){let v=f&&k>f?k:f;a(k,v||void 0),p("end");}else {let v=h&&k<h?k:h;a(v||void 0,k),m(false);}},N=()=>{let k=new Date,v=new Date(k);v.setDate(k.getDate()+1);let E=new Date(k);E.setDate(k.getDate()+((6-k.getDay()+7)%7||7));let I=new Date(k);I.setDate(k.getDate()+((1-k.getDay()+7)%7||7));let D=new Date(k);D.setDate(k.getDate()+(6-k.getDay()+7)%7+7);let X=new Date(k);X.setDate(k.getDate()+14);let O=new Date(k);return O.setDate(k.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:k,display:k.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:v,display:v.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:E,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:I,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:D,display:D.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:X,display:X.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(i){let k=r&&o==="start"?h:f;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(k)})]})}let T=r&&o==="start"?h:f;return jsxs("div",{ref:x,className:"relative",children:[jsxs("button",{onClick:k=>{k.stopPropagation(),m(!l);let v=o==="start"?h:f;v&&y(new Date(v.getFullYear(),v.getMonth(),1));},className:u("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:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(T)})]}),l&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>m(false)}),jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:k=>k.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[N().map((k,v)=>jsxs("button",{className:u("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(k.date),children:[jsx("span",{children:k.label}),jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:k.display})]},v)),jsx("div",{className:u("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(h||void 0,void 0):a(void 0,void 0),m(false);},className:u("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:n==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:u("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>y(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(k=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:k},k))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((k,v)=>{let E=k.date.toDateString()===new Date().toDateString(),I=h?.toDateString()===k.date.toDateString(),D=f?.toDateString()===k.date.toDateString(),X=I||D,O=!r&&h&&f&&k.date>=h&&k.date<=f;return jsx("button",{onClick:()=>C(new Date(k.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!k.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),k.isCurrentMonth&&(s?"text-white":"text-gray-900"),E&&"ring-2 ring-[#007BFF]",I&&"bg-[#007BFF] text-white",D&&!I&&"bg-[#7C3AED] text-white",O&&!X&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!X&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:k.date.getDate()},v)})})]})]})]})]})}function zi({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:i}){let c=e?e instanceof Date?e:new Date(e):null;return jsx(Km,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:i||null,onChange:(p,g)=>{t&&t(s==="start"?p:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function $n(e=600){let[t,a]=useState(false),r=useRef(null),o=useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Ui(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=useState(e),[i,c]=useState(false),l=useRef(e),m=useRef([]);return useEffect(()=>{if(m.current.forEach(clearTimeout),m.current=[],!a||e===l.current||e===void 0){n(e),l.current=e;return}let d=l.current??0,p=e,g=p-d,y=r/o;c(true);for(let x=1;x<=o;x++){let h=setTimeout(()=>{let f=x/o,b=1-Math.pow(1-f,3),w=Math.round(d+g*b);n(w),x===o&&(c(false),n(p));},y*x);m.current.push(h);}return l.current=e,()=>{m.current.forEach(clearTimeout),m.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:i}}function qm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,i]=useState(0),c=useRef(null),l=useRef(null),m=useCallback(g=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(g),i(0);let y=Date.now();l.current=setInterval(()=>{let x=Date.now()-y,h=Math.min(x/a*100,100);i(h);},16),c.current=setTimeout(()=>{l.current&&clearInterval(l.current),e?.(g),s(null),i(0);},a);},[a,e]),d=useCallback(()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(null),i(0),r?.();},[r]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:m,cancelChange:d}}function Xm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,i]=useState(false),[c,l]=useState(""),m=useRef(null),{isFlashing:d,triggerFlash:p}=$n(),{displayValue:g,isAnimating:y}=Ui(e,{enabled:o,duration:300,steps:6}),x=C=>{if(r||!t)return;C.stopPropagation();let N=C.currentTarget.getBoundingClientRect(),T=C.clientX-N.left,k=Math.round(T/N.width*100),v=Math.max(0,Math.min(100,k));v!==e&&(t(v),s&&p());},h=useCallback(C=>{r||!t||(C.stopPropagation(),l(String(e)),i(true));},[r,t,e]);useEffect(()=>{n&&m.current&&(m.current.focus(),m.current.select());},[n]);let f=useCallback(()=>{i(false);let C=parseInt(c,10);if(!isNaN(C)&&t){let N=Math.max(0,Math.min(100,C));N!==e&&(t(N),s&&p());}},[c,t,e,s,p]),b=useCallback(C=>{C.key==="Enter"&&f(),C.key==="Escape"&&i(false);},[f]),w=g??e;return jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",d&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[jsx("div",{onClick:x,className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:u("h-full rounded-full transition-[width]",w===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",y&&"transition-none"),style:{width:`${w}%`}})}),n?jsxs("div",{className:"flex items-center gap-0.5",onClick:C=>C.stopPropagation(),children:[jsx("input",{ref:m,value:c,onChange:C=>l(C.target.value.replace(/[^0-9]/g,"")),onBlur:f,onKeyDown:b,maxLength:3,className:u("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-blue-400":"bg-white border-gray-300 text-gray-900 focus:border-blue-500")}),jsx("span",{className:u("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:h,className:u("text-xs w-8 text-right tabular-nums font-mono rounded px-1",a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",y&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[w,"%"]})]})}function Zm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[i,c]=useState(e),l=useRef(null);useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),useEffect(()=>{c(e);},[e]);let m=()=>{i!==e&&t?.(i),n(false);},d=p=>{p.key==="Enter"?m():p.key==="Escape"&&(c(e),n(false));};return o||!t?jsx("span",{className:u("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:l,type:"text",value:i,onChange:p=>c(p.target.value),onBlur:m,onKeyDown:d,onClick:p=>p.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:p=>{p.stopPropagation(),n(true);},className:u("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 ag({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:i=true,enableSaveFlash:c=true}){let[l,m]=useState(false),[d,p]=useState(e?.toString()||""),g=useRef(null),{isFlashing:y,triggerFlash:x}=$n(),{displayValue:h,isAnimating:f}=Ui(e,{enabled:i&&!l});useEffect(()=>{l&&g.current&&(g.current.focus(),g.current.select());},[l]),useEffect(()=>{p(e?.toString()||"");},[e]);let b=()=>{let C=parseFloat(d);if(!isNaN(C)){let N=C;o!==void 0&&(N=Math.max(o,N)),s!==void 0&&(N=Math.min(s,N)),N!==e&&(t?.(N),c&&x());}m(false);},w=C=>{C.key==="Enter"?b():C.key==="Escape"&&(p(e?.toString()||""),m(false));};return n||!t?jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:h!==void 0?h:r}):l?jsx("input",{ref:g,type:"number",value:d,onChange:C=>p(C.target.value),onBlur:b,onKeyDown:w,onClick:C=>C.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:C=>{C.stopPropagation(),m(true);},className:u("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"),y&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:h!==void 0?h:r})}function rg({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,i]=useState(false),c=useRef(null);return useEffect(()=>{let l=m=>{c.current&&!c.current.contains(m.target)&&i(false);};return n&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n]),s||!a?jsx("span",{className:u("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:l=>{l.stopPropagation(),i(!n);},className:u("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:u("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsx(ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(l=>jsxs("button",{onClick:m=>{m.stopPropagation(),a(l),i(false);},className:u("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===l&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:l}),e===l&&jsx(Check,{className:"w-4 h-4 text-[#007BFF]"})]},l))})]})}function ng({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:i,progress:c,startChange:l,cancelChange:m}=qm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?i?m():l(!e):t(!e));},p=i?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:d,disabled:r||!t,className:u("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",p?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",i&&"ring-2 ring-offset-1",i&&p&&"ring-green-500/50",i&&!p&&"ring-red-500/50",i&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[i&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),i?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),i&&jsx("button",{onClick:g=>{g.stopPropagation(),m();},className:u("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 lg({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:u("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[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)),o>0&&jsxs("span",{className:u("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:["+",o]})]})}function W2(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 G2(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let i=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(i*60)+c}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function Dr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:i=false,lens:c="hours",hourlyRate:l=0}){let[m,d]=useState(false),[p,g]=useState(""),y=useRef(null),{isFlashing:x,triggerFlash:h}=$n(),f=c==="financial"&&l>0,b=f&&e?`$${Math.round(e/60*l).toLocaleString("en-US")}`:W2(e,r);useEffect(()=>{m&&y.current&&(y.current.focus(),y.current.select());},[m]),useEffect(()=>{if(e){let T=Math.floor(e/60),k=e%60;T>0&&k>0?g(`${T}h ${k}m`):T>0?g(`${T}h`):g(`${k}m`);}else g("");},[e,m]);let w=()=>{let T=G2(p);T!==e&&(t?.(T),n&&h()),d(false);},C=T=>{T.key==="Enter"?w():T.key==="Escape"&&d(false);};if(i)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:u("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 N=f?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(N,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:b})]}):m?jsx("input",{ref:y,type:"text",value:p,onChange:T=>g(T.target.value),onBlur:w,onKeyDown:C,onClick:T=>T.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:T=>{T.stopPropagation(),d(true);},className:u("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",x&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(N,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:b})]})}function pg({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:u("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let n=c=>c.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),i=()=>{if(a==null)return null;let c=o==="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:u("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?n(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?n(t):"\u2014"]}),i()]})}function gg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:i="hours",hourlyRate:c=0}){let l=a==="es",m=i==="financial"&&c>0,d=Z=>m?`$${Math.round(Z*c).toLocaleString("en-US")}`:`${Z}h`,[p,g]=useState(false),[y,x]=useState(false),[h,f]=useState(null),b=useRef(null),w=e.timeLoggedMinutes||0,C=e.effortMinutes||0,N=e.soldEffortMinutes||0,T=Math.round(w/60*10)/10,k=Math.round(C/60*10)/10,v=C>0?w/C*100:0,E=v>100?Math.round((w-C)/60*10)/10:0,I=v>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!y&&!h)return;let Z=Se=>{b.current&&!b.current.contains(Se.target)&&(x(false),f(null));};return document.addEventListener("mousedown",Z),()=>document.removeEventListener("mousedown",Z)},[y,h]);let D=Z=>{if(Z.stopPropagation(),r&&!o&&!s){f("log");return}if(r||o||s){x(Se=>!Se),f(null);return}n&&n(e);},X=Z=>{x(false),f(Z);},O=async(Z,Se)=>{h==="log"&&r&&Z?r(e,Z,Se):h==="estimate"&&o?o(e,Z):h==="quoted"&&s&&s(e,Z),f(null);},H=r||o||s||n,F=[{mode:"log",icon:Clock,label:l?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:l?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:DollarSign,label:l?"T. Ofertado":"Quoted time",show:!!s}].filter(Z=>Z.show),Y=h==="estimate"?C:h==="quoted"?N:void 0;return C===0&&w===0&&N===0?jsxs("div",{ref:b,className:"relative flex items-center gap-2",onClick:Z=>Z.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),p&&H&&jsx("button",{onClick:D,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:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Z.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Z.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&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(Z=>jsxs("button",{onClick:Se=>{Se.stopPropagation(),X(Z.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:Se=>{Se.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Se=>{Se.target.style.background="transparent";},children:[jsx(Z.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Z.label]},Z.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(ro,{mode:h,locale:a,isDark:t,currentValue:Y||void 0,onSave:O,onClose:()=>f(null)})})})})]}):jsxs("div",{ref:b,className:"relative flex items-center gap-2 w-full",onClick:Z=>Z.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:d(T)}),C>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(k)]}),E>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:"#EF4444",backgroundColor:"rgba(239,68,68,0.15)"},children:["+",d(E)," ",l?"Excedido":"Over"]})]}),C>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(v,100)}%`,backgroundColor:I,borderRadius:2,transition:"width 0.3s"}})})]}),H&&jsx("button",{onClick:D,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:p?1:0,pointerEvents:p?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Z.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Z.currentTarget.style.backgroundColor="transparent";},title:l?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&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(Z=>jsxs("button",{onClick:Se=>{Se.stopPropagation(),X(Z.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:Se=>{Se.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Se=>{Se.target.style.background="transparent";},children:[jsx(Z.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Z.label]},Z.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(ro,{mode:h,locale:a,isDark:t,currentValue:Y||void 0,onSave:O,onClose:()=>f(null)})})})})]})}function X2(e){let t=new Map;function a(r){if(r.assignees)for(let o of r.assignees)o.name&&!t.has(o.name)&&t.set(o.name,o);if(r.subtasks)for(let o of r.subtasks)a(o);}return a(e),Array.from(t.values())}function J2(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 fg({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",o=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:u(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsx("div",{className:u(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",o,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function bg({task:e,isDark:t,locale:a="en"}){let r=a==="es",o=!!e.hasChildren,s=e.assignees?.[0],n=e.teamLoad;if(o){let m=X2(e);if(m.length===0)return null;let d=m.slice(0,3),p=m.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:d.map((g,y)=>jsx(fg,{assignee:g,size:24,isDark:t},g.name+y))}),p>0&&jsxs("span",{className:u("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:m.slice(3).map(g=>g.name).join(", "),children:["+",p]})]})}if(!s)return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:u("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:u("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let i=n?.percentage??0,c=!!n&&i>0,l=c?J2(i):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(fg,{assignee:s,size:28,isDark:t}),jsx("span",{className:u("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),c&&l&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:l.bg,color:l.text},children:[i,"% LOAD"]})]})}var Q2={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function yg({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:u("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,o)=>jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",Q2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function m1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function g1(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 Tg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:i,onColumnHide:c,onColumnSort:l,availableUsers:m=[],onOpenTimeLog:d,onReportBlocker:p,onCopyTaskLink:g,onTaskMove:y,onTaskIndent:x,onTaskOutdent:h}){let f=useRef(null),b=r==="es"?wg.es:wg.en;if(useEffect(()=>{let k=E=>{f.current&&!f.current.contains(E.target)&&t();},v=E=>{E.key==="Escape"&&t();};return document.addEventListener("mousedown",k),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",v);}},[t]),!e.isOpen)return null;let w=()=>{if(!e.task)return [];let k=[];return o&&k.push({id:"edit",label:b.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),k.push({id:"sep1",label:"",icon:null,separator:true}),i&&(k.push({id:"status",label:b.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{i({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:b.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{i({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:b.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{i({...e.task,status:"completed",progress:100}),t();}}]}),k.push({id:"priority",label:b.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{i({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:b.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{i({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:b.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{i({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:b.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{i({...e.task,priority:"low"}),t();}}]}),m.length>0&&k.push({id:"assign",label:b.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:m.slice(0,5).map(v=>({id:`assign-${v.id}`,label:v.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:v.name.charAt(0).toUpperCase()}),onClick:()=>{let E=e.task.assignees||[],D=E.some(X=>X.name===v.name)?E.filter(X=>X.name!==v.name):[...E,{name:v.name,initials:m1(v.name),color:v.color||g1(v.name),avatar:v.avatarUrl}];i({...e.task,assignees:D}),t();}}))})),d&&k.push({id:"log-time",label:b.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),p&&k.push({id:"report-blocker",label:b.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),g&&k.push({id:"copy-link",label:b.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),k.push({id:"sep2",label:"",icon:null,separator:true}),s&&k.push({id:"duplicate",label:b.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(y||x||h)&&(k.push({id:"sep3",label:"",icon:null,separator:true}),y&&(k.push({id:"move-up",label:b.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"up"),t();}}),k.push({id:"move-down",label:b.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"down"),t();}})),x&&k.push({id:"indent",label:b.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),h&&k.push({id:"outdent",label:b.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),n&&k.push({id:"delete",label:b.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),k},C=()=>{if(!e.columnId)return [];let k=[];return l&&(k.push({id:"sort-asc",label:b.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),k.push({id:"sort-desc",label:b.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(k.push({id:"sep-hide",label:"",icon:null,separator:true}),k.push({id:"hide",label:b.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),k},N=e.type==="task"?w():C(),T={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:f,style:T,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:N.map(k=>k.separator?jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},k.id):k.submenu?jsx(f1,{item:k,isDark:a},k.id):jsxs("button",{onClick:k.onClick,className:u("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",k.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:u(k.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:k.icon}),k.label]},k.id))})}function f1({item:e,isDark:t}){let[a,r]=useState(false),o=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:u("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:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:u("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(i=>jsxs("button",{onClick:i.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:i.icon}),i.label]},i.id))})]})}var wg={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var Ag={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"})},A1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function Ig({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:i}){let[c,l]=useState(""),[m,d]=useState(null),[p,g]=useState(null),y=useRef(null),x=i==="es"?Lg.es:Lg.en;useLayoutEffect(()=>{if(!e||!y.current)return;let k=()=>{if(!y.current)return;let v=y.current.parentElement;if(v){let X=v.getBoundingClientRect();g({top:X.bottom+4,right:window.innerWidth-X.right});}let E=y.current.getBoundingClientRect(),D=window.innerHeight-E.top-20;d(Math.max(300,D));};return requestAnimationFrame(k),window.addEventListener("resize",k),()=>window.removeEventListener("resize",k)},[e]),useEffect(()=>{if(!e)return;let k=setTimeout(()=>{let v=I=>{y.current&&!y.current.contains(I.target)&&t();},E=I=>{I.key==="Escape"&&t();};document.addEventListener("mousedown",v),document.addEventListener("keydown",E),y._cleanup=()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",E);};},100);return ()=>{clearTimeout(k),y._cleanup&&y._cleanup();}},[e,t]);let h=useMemo(()=>{let k=new Set([...A1]);return a.forEach(v=>{v.type&&v.type!=="assignees"&&k.add(v.type);}),Array.from(k)},[a]);if(!e)return null;let f=k=>{let v=x.columns[k];if(v)return v;let E=a.find(I=>I.type===k);return E?.label?E.label:k},b=k=>{if(k==="name")return;let v=a.map(E=>E.id===k?{...E,visible:!E.visible}:E);o(v);},w=(k,v)=>{let E=a.find(D=>D.type===k&&(!v||D.customFieldId===v));if(E){b(E.id);return}let I={id:v||k,type:k,label:v?r.find(D=>D.id===v)?.name||k:f(k),width:120,visible:true,sortable:true,resizable:true,customFieldId:v};o([...a,I]);},C=h.filter(k=>k!=="assignees"&&f(k).toLowerCase().includes(c.toLowerCase())),N=r.filter(k=>k.name.toLowerCase().includes(c.toLowerCase())),T=n?"#00E5FF":"#2E94FF";return jsxs("div",{ref:y,style:{...m?{maxHeight:`${m}px`}:{},...p?{top:p.top,right:p.right}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"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 ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:x.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",k.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:k=>{k.currentTarget.style.backgroundColor="transparent",k.currentTarget.style.color=n?"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:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:c,onChange:k=>l(k.target.value),placeholder:x.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"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:k=>{k&&k.style.setProperty("--focus-border",T);},onFocus:k=>{k.currentTarget.style.borderColor=T,k.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:k=>{k.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",k.currentTarget.style.background=n?"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:k=>k.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:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:x.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:C.map(k=>{let v=a.find(D=>D.type===k&&!D.customFieldId),E=v?.visible??false,I=k==="name";return jsxs("button",{onClick:()=>{I||(v?b(v.id):w(k));},disabled:I,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:I?.4:1,cursor:I?"not-allowed":"pointer"},onMouseEnter:D=>{I||(D.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:E?T:"transparent",border:E?`1.5px solid ${T}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:E?`0 0 6px ${T}40`:"none"},children:E&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:E?T:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Ag[k]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:E?500:400,color:E?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:f(k),children:f(k)})]},k)})})]}),N.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:x.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:N.map(k=>{let E=a.find(I=>I.customFieldId===k.id)?.visible??false;return jsxs("button",{onClick:()=>w(k.type,k.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:I=>{I.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:I=>{I.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:E?T:"transparent",border:E?`1.5px solid ${T}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:E?`0 0 6px ${T}40`:"none"},children:E&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:E?T:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Ag[k.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:E?500:400,color:E?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:k.name})]},k.id)})})]})]})]})}var Lg={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var U1=[{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 Og({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[i,c]=useState("text"),[l,m]=useState([""]),d=o==="es"?Rg.es:Rg.en;useEffect(()=>{e&&(n(""),c("text"),m([""]));},[e]),useEffect(()=>{let h=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let p=()=>{if(!s.trim())return;let h={name:s.trim(),type:i};i==="dropdown"&&(h.options=l.filter(f=>f.trim())),a(h),t();},g=()=>{m([...l,""]);},y=(h,f)=>{let b=[...l];b[h]=f,m(b);},x=h=>{l.length>1&&m(l.filter((f,b)=>b!==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:u("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:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:u("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:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsx("input",{type:"text",value:s,onChange:h=>n(h.target.value),placeholder:d.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/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:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:U1.map(h=>jsxs("button",{onClick:()=>c(h.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",i===h.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:i===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:h.icon}),jsx("span",{className:u("text-xs",i===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[h.type]})]},h.type))})]}),i==="dropdown"&&jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxs("div",{className:"space-y-2",children:[l.map((h,f)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:h,onChange:b=>y(f,b.target.value),placeholder:`${d.option} ${f+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),l.length>1&&jsx("button",{onClick:()=>x(f),className:u("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"})})]},f)),jsxs("button",{onClick:g,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxs("div",{className:u("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:u("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:d.cancel}),jsx("button",{onClick:p,disabled:!s.trim(),className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var Rg={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 zg={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 Ug({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,i]=useState(false),c=useRef(null),l=useRef(0),m=s==="es"?zg.es:zg.en;useEffect(()=>{if(!n)return;let g=x=>{Date.now()-l.current<100||c.current&&!c.current.contains(x.target)&&i(false);},y=x=>{x.key==="Escape"&&i(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y);}},[n]);let d=[{value:"all",label:m.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:m.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:m.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:m.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n||(l.current=Date.now()),i(y=>!y);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),m.filters,p&&jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxs("div",{className:u("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:m.filterByStatus})}),jsx("div",{className:"py-2",children:d.map(g=>{let y=e===g.value&&!t,x=()=>g.value==="all"?y?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxs("button",{onClick:()=>{a(g.value),r(false),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:u(y?g.color:"text-gray-400","flex-shrink-0"),children:x()}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),y&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),i(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:m.hideCompleted}),t&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function Wg(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 Cs(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function Gg({data:e,isDark:t,locale:a="en",onClose:r,lens:o="hours"}){let s=a==="es",n=o==="financial";return jsxs("div",{className:u("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:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:u("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:n?s?"SALUD FINANCIERA":"FINANCIAL HEALTH":s?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsx("button",{onClick:r,className:u("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:s?"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"})})})]}),n&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let i=e.totalOffered??0,c=e.totalEstimated??0,l=e.totalExecuted??0,m=i-c,d=i>0?Math.round(m/i*100):0,p=i>0?Math.min(Math.round(c/i*100),120):0,g=c>i&&i>0,y=g?"#F87171":"#00E5CC";return jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:s?"PRESUPUESTO":"BUDGET"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ofertado":"Offered"}),jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Cs(i)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Estimado":"Estimated"}),jsx("span",{className:u("text-[11px] font-mono font-bold",g?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Cs(c)})]}),l>0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Ejecutado":"Executed"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Cs(l)})]}),i>0&&jsx("div",{className:u("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(p,100)}%`,backgroundColor:y}})}),jsxs("div",{className:u("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",m>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[m>=0?`+${Cs(m)} ${s?"Disp.":"Avail."}`:`${Cs(Math.abs(m))} ${s?"P\xE9rdida":"Loss"}`,i>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",d,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let i=e.totalHoursSpentMinutes??0,c=e.totalHoursAllocatedMinutes??0,l=c>0?Math.min(Math.round(i/c*100),100):0,m=i>c&&c>0,d=m?"#F87171":l>=80?"#FFD60A":"#3BF06E";return jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:s?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Usado":"Spent"}),jsx("span",{className:u("text-[11px] font-mono font-bold",m?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Wg(i)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Asignado":"Allocated"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Wg(c)})]}),c>0&&jsx("div",{className:u("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:`${l}%`,backgroundColor:d}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:s?"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:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:u("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:u("text-xs",t?"text-white/60":"text-gray-600"),children:s?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:u("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:s?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let i=e.scheduleVarianceDays??0,c=i>0,l=i<0,m=e.scheduleVarianceLabel||(c?`+${i} ${s?"D\xEDas ADELANTE":"Days AHEAD"}`:l?`${i} ${s?"D\xEDas ATR\xC1S":"Days BEHIND"}`:s?"EN TIEMPO":"ON TRACK");return jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",c&&"bg-[#3BF06E]/15 text-[#3BF06E]",l&&"bg-[#F87171]/15 text-[#F87171]",!c&&!l&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:s?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((i,c)=>{let l=i.utilizationPercent>=100?"#F87171":i.utilizationPercent>=80?"#FFD60A":i.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:i.name}),jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[i.utilizationPercent,"%"]})]}),jsx("div",{className:u("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(i.utilizationPercent,100)}%`,backgroundColor:l}})})]},`${i.name}-${c}`)})})]})]})}var rw=[{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 Yg(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...Yg(r.subtasks,t+1));return a}function ow(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let m=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(m<=0)continue;let d=(s.progress||0)/m;r+=d,o++;}return o>0?r/o:null}function Gn(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let o of e.subtasks)if(o.subtasks?.length){let s=Gn(o);t+=s.spent>0?s.spent:o.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:o.effortMinutes??0,r+=s.quoted>0?s.quoted:o.soldEffortMinutes??0;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Wn(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 nw({value:e,onChange:t,isDark:a}){let[r,o]=useState(false),[s,n]=useState(String(e||""));return r?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:i=>i.stopPropagation(),onChange:i=>n(i.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let i=parseFloat(s);!isNaN(i)&&i>=0&&i<=100?t(i):s===""&&t(0),o(false);},onKeyDown:i=>{i.key==="Enter"&&i.target.blur(),i.key==="Escape"&&(n(String(e||"")),o(false));},className:u("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-blue-400 text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:i=>{i.stopPropagation(),n(String(e||"")),o(true);},className:u("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 Xg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:i=[],customFields:c=[],toolbarRightContent:l}){let{theme:m="dark",locale:d="en",customTranslations:p,showSearch:g=true,showHierarchy:y=true,tableColumns:x,allowColumnCustomization:h=true,allowColumnResize:f=true,enableContextMenu:b=true,showCreateTaskButton:w=false,onCreateTask:C,persistFilter:N=false,financialBlur:T,healthSidebar:k,lens:v="hours",hourlyRate:E=0,rateMap:I,aggregateParentHours:D=false,showProjectTotals:X=false}=t,O=Oi(d,p),H=m==="dark",F=M=>{if(!I||!M.assignees||M.assignees.length===0)return E;let se=M.assignees.map(xe=>xe.id?I[xe.id]:void 0).filter(xe=>xe!=null&&xe>0);return se.length===0?E:se.reduce((xe,Fe)=>xe+Fe,0)/se.length},Y=M=>{let se=0,xe=0,Fe=0,Ke=Qe=>{for(let ye of Qe)if(ye.subtasks&&ye.subtasks.length>0){let He={s:se,a:xe,q:Fe};if(Ke(ye.subtasks),se-He.s+(xe-He.a)+(Fe-He.q)===0){let wt=F(ye);se+=(ye.timeLoggedMinutes??0)/60*wt,xe+=(ye.effortMinutes??0)/60*wt,Fe+=(ye.soldEffortMinutes??0)/60*wt;}}else {let He=F(ye);se+=(ye.timeLoggedMinutes??0)/60*He,xe+=(ye.effortMinutes??0)/60*He,Fe+=(ye.soldEffortMinutes??0)/60*He;}};return M.subtasks&&Ke(M.subtasks),{dollarSpent:se,dollarAllocated:xe,dollarQuoted:Fe}},Z=useCallback(()=>{if(!N||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let M=localStorage.getItem(N);if(M){let se=JSON.parse(M);return {statusFilter:se.statusFilter||"all",hideCompleted:se.hideCompleted||!1}}}catch(M){console.error("Error loading persisted filter:",M);}return {statusFilter:"all",hideCompleted:false}},[N]),Se=useMemo(()=>{function M(se){let xe=0,Fe=0,Ke=0,Qe=0,ye=0,He=0;for(let lt of se)if(lt.subtasks&<.subtasks.length>0){let wt=M(lt.subtasks);if(wt.spent+wt.allocated+wt.quoted>0)xe+=wt.spent,Fe+=wt.allocated,Ke+=wt.quoted,Qe+=wt.dollarSpent,ye+=wt.dollarAllocated,He+=wt.dollarQuoted;else {let St=lt.timeLoggedMinutes??0,Et=lt.effortMinutes??0,ma=lt.soldEffortMinutes??0;xe+=St,Fe+=Et,Ke+=ma;let na=F(lt);Qe+=St/60*na,ye+=Et/60*na,He+=ma/60*na;}}else {let wt=lt.timeLoggedMinutes??0,Ot=lt.effortMinutes??0,St=lt.soldEffortMinutes??0;xe+=wt,Fe+=Ot,Ke+=St;let Et=F(lt);Qe+=wt/60*Et,ye+=Ot/60*Et,He+=St/60*Et;}return {spent:xe,allocated:Fe,quoted:Ke,dollarSpent:Qe,dollarAllocated:ye,dollarQuoted:He}}return M(e)},[e]),R=useMemo(()=>{let M=new Map;function se(xe){let Fe=0;for(let Ke of xe)if(Ke.subtasks&&Ke.subtasks.length>0){let Qe=se(Ke.subtasks);M.set(Ke.id,Qe),Fe+=Qe;}else Fe+=Ke.weight||0;return Fe}return se(e),M},[e]),_=useMemo(()=>!k?.enabled||!k.data?k:{...k,data:{...k.data,totalHoursSpentMinutes:Se.spent,totalHoursAllocatedMinutes:Se.allocated}},[k,Se]),[he,Je]=useState(true),[z,re]=useState("position"),[J,Pe]=useState("asc"),[ve,We]=useState(""),[Re,st]=useState(()=>Z().statusFilter),[ee,it]=useState(()=>Z().hideCompleted),[le,ot]=useState(x||rw),[yt,Pt]=useState(false),[ke,xt]=useState(false),[ct,rt]=useState({isOpen:false,x:0,y:0,type:"task"}),[$,de]=useState(null),[S,q]=useState(false),[ce,Ce]=useState(null),[W,te]=useState(null),[Ge,Te]=useState(null),Ue=useRef(0),Ne=useRef(false),Ve=!!(a.onTaskMove||a.onTaskReparent),Tt=useCallback((M,se)=>{Ve&&(se.preventDefault(),Ue.current=se.clientY,de(M),Ne.current=false,q(false),Te({x:se.clientX,y:se.clientY}));},[Ve]),gt=useCallback(M=>{if(!$||(Math.abs(M.clientY-Ue.current)>5&&!Ne.current&&(Ne.current=true,q(true)),Te({x:M.clientX,y:M.clientY}),!Ne.current))return;let xe=document.querySelectorAll("[data-listview-row]"),Fe=null,Ke=null;xe.forEach(Qe=>{let ye=Qe.getBoundingClientRect(),He=Qe.getAttribute("data-listview-row");if(He&&He!==$&&M.clientY>=ye.top&&M.clientY<=ye.bottom){Fe=He;let lt=M.clientY-ye.top,wt=ye.height;Ke=lt<wt*.25?"above":lt>wt*.75?"below":"child";}}),Ce(Fe),te(Ke);},[$]),nt=useCallback(()=>{if(Ne.current&&$&&ce&&W){if(W==="child"&&a.onTaskReparent)a.onTaskReparent($,ce);else if(W==="above"||W==="below"){let M=(Fe,Ke,Qe=null)=>{for(let ye of Fe){if(ye.id===Ke)return Qe;if(ye.subtasks){let He=M(ye.subtasks,Ke,ye.id);if(He!==void 0)return He}}},se=M(e,$,null),xe=M(e,ce,null);if(a.onTaskReparent){let Fe=(wt,Ot)=>{if(Ot===null)return wt;for(let St of wt){if(St.id===Ot)return St.subtasks||[];if(St.subtasks){let Et=Fe(St.subtasks,Ot);if(Et.length>0||St.subtasks.some(ma=>ma.id===Ot))return Et}}return []},Ke=Fe(e,xe??null),Qe=Ke.findIndex(wt=>wt.id===ce),ye=se===xe,He=ye?Ke.findIndex(wt=>wt.id===$):-1,lt=W==="below"?Qe+1:Qe;ye&&He!==-1&&He<Qe&&(lt-=1),a.onTaskReparent($,xe??null,Math.max(0,lt));}}}de(null),Ce(null),te(null),Te(null),Ne.current=false,q(false);},[$,ce,W,e,a]);useEffect(()=>{if($)return document.addEventListener("mousemove",gt),document.addEventListener("mouseup",nt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",gt),document.removeEventListener("mouseup",nt),document.body.style.cursor="",document.body.style.userSelect="";}},[$,gt,nt]);let[et,qt]=useState("all"),[At,vt]=useState(false),Dt=useRef(null),ft=useRef(null),Wt=useMemo(()=>{let M=0;function se(xe,Fe){for(let Ke of xe)Fe>M&&(M=Fe),Ke.subtasks?.length&&se(Ke.subtasks,Fe+1);}return se(e,1),M},[e]);useEffect(()=>{if(!At)return;let M=se=>{Dt.current?.contains(se.target)||ft.current?.contains(se.target)||vt(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[At]),useEffect(()=>{if(et==="all"){let xe=function(Fe){for(let Ke of Fe)Ke.subtasks?.length&&(Ke.isExpanded===false&&a.onTaskToggleExpand?.(Ke.id),xe(Ke.subtasks));};xe(e);}else {let xe=function(Fe,Ke){for(let Qe of Fe)if(Qe.subtasks?.length){let ye=Ke<et,He=Qe.isExpanded!==false;ye!==He&&a.onTaskToggleExpand?.(Qe.id),xe(Qe.subtasks,Ke+1);}};xe(e,1);}},[et]);let[Oe,Le]=useState(null),[ut,ne]=useState(0),[fe,L]=useState(0),j=useRef(null),[K,me]=useState(null),[Me,qe]=useState(null);useEffect(()=>{x&&ot(M=>{if(M.length===x.length){let se=true;for(let xe=0;xe<M.length;xe++){let Fe=M[xe],Ke=x[xe];if(!Fe||!Ke||Fe.id!==Ke.id||Fe.visible!==Ke.visible||Fe.width!==Ke.width||Fe.label!==Ke.label){se=false;break}}if(se)return M}return x});},[x]),useEffect(()=>{if(!(!N||typeof window>"u"))try{localStorage.setItem(N,JSON.stringify({statusFilter:Re,hideCompleted:ee}));}catch(M){console.error("Error persisting filter state:",M);}},[N,Re,ee]);let _e=useMemo(()=>{let M=new Set;function se(xe){for(let Fe of xe)Fe.subtasks?.length&&(Fe.isExpanded!==false&&M.add(Fe.id),se(Fe.subtasks));}return se(e),M},[e]),Ie=useMemo(()=>le.filter(M=>M.visible),[le]),bt=useCallback(M=>{a.onTaskToggleExpand?.(M);},[a]),Nt=useCallback(M=>{z===M?Pe(se=>se==="asc"?"desc":"asc"):(re(M),Pe("asc")),a.onSortChange?.({column:M,direction:J==="asc"?"desc":"asc"});},[z,J,a]),Ut=useCallback(M=>{ot(M),a.onColumnsChange?.(M);},[a]),Ta=useCallback(M=>{let se=le.map(xe=>xe.id===M?{...xe,visible:false}:xe);Ut(se);},[le,Ut]),ta=useCallback((M,se)=>{re(M),Pe(se);},[]),U=useCallback((M,se,xe)=>{b&&(M.preventDefault(),rt({isOpen:true,x:M.clientX,y:M.clientY,type:se?"task":"header",task:se,columnId:xe}));},[b]),oe=useCallback(()=>{rt(M=>({...M,isOpen:false}));},[]),$e=useCallback((M,se)=>{if(!f)return;M.preventDefault(),M.stopPropagation();let xe=le.find(Fe=>Fe.id===se);xe&&(Le(se),ne(M.clientX),L(xe.width));},[le,f]);useEffect(()=>{if(!Oe)return;let M=le,se=Fe=>{let Ke=Fe.clientX-ut,Qe=Math.max(50,fe+Ke);M=M.map(ye=>ye.id===Oe?{...ye,width:Qe}:ye),ot(M);},xe=()=>{a.onColumnsChange?.(M),Le(null);};return document.addEventListener("mousemove",se),document.addEventListener("mouseup",xe),()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",xe);}},[Oe,ut,fe,a]);let A=useCallback((M,se)=>{if(se==="name"){M.preventDefault();return}me(se),M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",se),M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="0.5");},[]),ge=useCallback(M=>{M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="1"),me(null),qe(null);},[]),je=useCallback((M,se)=>{M.preventDefault(),se!=="name"&&(M.dataTransfer.dropEffect="move",qe(se));},[]),tt=useCallback(()=>{qe(null);},[]),oa=useCallback((M,se)=>{if(M.preventDefault(),!K||K===se||se==="name")return;let xe=[...le],Fe=xe.findIndex(ye=>ye.id===K),Ke=xe.findIndex(ye=>ye.id===se);if(Fe===-1||Ke===-1)return;let Qe=xe.splice(Fe,1);Qe[0]&&(xe.splice(Ke,0,Qe[0]),Ut(xe),me(null),qe(null));},[K,le,Ut]),Gt=useCallback(async M=>{if(a.onCreateCustomField){let se={...M,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(se);}xt(false);},[a]),Na=useCallback(M=>M.progress===100||M.status==="completed"?"completed":M.progress&&M.progress>0||M.status==="in-progress"?"in-progress":"todo",[]),Ma=useMemo(()=>{let M=Yg(e);if(ve.trim()){let se=ve.toLowerCase();M=M.filter(xe=>xe.name.toLowerCase().includes(se));}return Re!=="all"&&(M=M.filter(se=>Na(se)===Re)),ee&&(M=M.filter(se=>Na(se)!=="completed")),M.sort((se,xe)=>{let Fe,Ke;switch(z){case "name":Fe=se.name.toLowerCase(),Ke=xe.name.toLowerCase();break;case "startDate":Fe=se.startDate?.getTime()||0,Ke=xe.startDate?.getTime()||0;break;case "endDate":Fe=se.endDate?.getTime()||0,Ke=xe.endDate?.getTime()||0;break;case "progress":Fe=se.progress||0,Ke=xe.progress||0;break;case "status":Fe=se.status||"todo",Ke=xe.status||"todo";break;case "priority":let Qe={urgent:0,high:1,medium:2,low:3,none:4};Fe=Qe[se.priority]??4,Ke=Qe[xe.priority]??4;break;case "position":return 0;default:return 0}return Fe<Ke?J==="asc"?-1:1:Fe>Ke?J==="asc"?1:-1:0}),M},[e,ve,Re,ee,z,J,Na]),Ga=useCallback((M,se)=>{let xe=Qe=>{a.onTaskUpdate?.({...M,...Qe});},Fe=Qe=>Qe?M.customFields?.find(He=>He.fieldId===Qe)?.value:void 0,Ke=(Qe,ye)=>{if(!Qe)return;let lt=[...M.customFields||[]],wt=lt.findIndex(Ot=>Ot.fieldId===Qe);wt>=0?lt[wt]={fieldId:Qe,value:ye}:lt.push({fieldId:Qe,value:ye}),xe({customFields:lt});};switch(se.type){case "name":return null;case "status":return jsx(Hm,{value:M.status||(M.progress===100?"completed":M.progress&&M.progress>0?"in-progress":"todo"),onChange:ye=>{xe({status:ye,progress:ye==="completed"?100:ye==="in-progress"?50:0});},isDark:H,locale:d,translations:O.status});case "priority":return jsx(Um,{value:M.priority,onChange:ye=>xe({priority:ye}),isDark:H,locale:d});case "assignees":{let ye=M.hasChildren,He=M.assignees||[];if(ye&&M.subtasks?.length){let lt=new Map;(M.assignees||[]).forEach(Ot=>lt.set(Ot.name,Ot));let wt=Ot=>{(Ot||[]).forEach(St=>{(St.assignees||[]).forEach(Et=>{lt.has(Et.name)||lt.set(Et.name,Et);}),St.subtasks?.length&&wt(St.subtasks);});};wt(M.subtasks),He=Array.from(lt.values());}return jsx(Vd,{value:He,availableUsers:i,onChange:lt=>xe({assignees:lt}),isDark:H,locale:d,disabled:ye})}case "startDate":return jsx(zi,{value:M.startDate,onChange:ye=>xe({startDate:ye}),isDark:H,locale:d,dateField:"start",startDate:M.startDate,endDate:M.endDate});case "endDate":return jsx(zi,{value:M.endDate,onChange:ye=>xe({endDate:ye}),isDark:H,locale:d,dateField:"end",startDate:M.startDate,endDate:M.endDate});case "progress":{let ye=!!(M.subtasks&&M.subtasks.length>0);return jsx(Xm,{value:M.progress||0,onChange:ye?void 0:He=>{let lt=He===100?"completed":He>0?"in-progress":"todo";xe({progress:He,status:lt});},isDark:H,disabled:ye})}case "tags":return jsx(lg,{value:M.tags||[],isDark:H});case "text":return jsx(Zm,{value:Fe(se.customFieldId)||"",onChange:ye=>Ke(se.customFieldId,ye),isDark:H});case "number":return jsx(ag,{value:Fe(se.customFieldId)||0,onChange:ye=>Ke(se.customFieldId,ye),isDark:H});case "date":let Qe=Fe(se.customFieldId);return jsx(zi,{value:Qe?new Date(Qe):void 0,onChange:ye=>Ke(se.customFieldId,ye),isDark:H,locale:d});case "dropdown":return jsx(rg,{value:Fe(se.customFieldId)||"",options:se.options||[],onChange:ye=>Ke(se.customFieldId,ye),isDark:H});case "checkbox":return jsx(ng,{value:Fe(se.customFieldId)||false,onChange:ye=>Ke(se.customFieldId,ye),isDark:H});case "estimatedTime":{let ye=M.status==="completed"||M.progress===100;return jsx(Dr,{value:M.estimatedTime,onChange:He=>xe({estimatedTime:He}),isDark:H,locale:d,disabled:ye,lens:v,hourlyRate:F(M)})}case "quotedTime":{let ye=M.status==="completed"||M.progress===100,He=T?.enabled&&(!T.columns||T.columns.includes("quotedTime"));return jsx(Dr,{value:M.quotedTime,onChange:lt=>xe({quotedTime:lt}),isDark:H,locale:d,disabled:ye,isBlurred:He,lens:v,hourlyRate:F(M)})}case "elapsedTime":{let ye=M.status==="completed"||M.progress===100;return jsx(Dr,{value:M.elapsedTime,onChange:He=>xe({elapsedTime:He}),isDark:H,locale:d,disabled:ye,lens:v,hourlyRate:F(M)})}case "effortMinutes":{if(D&&M.subtasks&&M.subtasks.length>0){let{allocated:Ot}=Gn(M);if(v==="financial"){let St=Y(M),Et=Math.round(St.dollarAllocated),ma=Math.round(St.dollarQuoted),na=ma-Et;return jsxs("div",{className:"flex flex-col",children:[Et>0?jsxs("span",{className:u("text-sm font-mono",H?"text-white/60":"text-gray-500"),children:["$",Et.toLocaleString("es-CO")]}):null,na!==0&&Et>0&&ma>0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",na>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[na>0?"+":"",Math.abs(na)>=1e3?`$${(na/1e3).toFixed(1)}K`:`$${na}`]})]})}return jsx(Dr,{value:Ot>0?Ot:void 0,isDark:H,locale:d,disabled:true,lens:v,hourlyRate:E})}let ye=M.status==="completed"||M.progress===100,He=M.effortMinutes||0,lt=M.soldEffortMinutes||0,wt=F(M);if(v==="financial"&&wt&&He>0&<>0){let Ot=Math.round(He/60*wt),Et=Math.round(lt/60*wt)-Ot;return jsxs("div",{className:"flex flex-col",children:[jsx(Dr,{value:He,onChange:ma=>xe({effortMinutes:ma}),isDark:H,locale:d,disabled:ye,lens:v,hourlyRate:F(M)}),Et!==0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Et>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Et>0?"+":"",Math.abs(Et)>=1e3?`$${(Et/1e3).toFixed(1)}K`:`$${Et}`]})]})}return jsx(Dr,{value:He,onChange:Ot=>xe({effortMinutes:Ot}),isDark:H,locale:d,disabled:ye,lens:v,hourlyRate:F(M)})}case "timeLoggedMinutes":{if(D&&M.subtasks&&M.subtasks.length>0){let{spent:He}=Gn(M);return jsx(Dr,{value:He>0?He:void 0,isDark:H,locale:d,disabled:true,lens:v,hourlyRate:F(M)})}let ye=M.status==="completed"||M.progress===100;return jsx(Dr,{value:M.timeLoggedMinutes,onChange:a.onLogTime?He=>{a.onLogTime?.(M,He);}:void 0,isDark:H,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:ye,lens:v,hourlyRate:F(M)})}case "soldEffortMinutes":{if(D&&M.subtasks&&M.subtasks.length>0){let{quoted:lt}=Gn(M),wt=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx(Dr,{value:lt>0?lt:void 0,isDark:H,locale:d,disabled:true,isBlurred:wt,lens:v,hourlyRate:F(M)})}let ye=M.status==="completed"||M.progress===100,He=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx(Dr,{value:M.soldEffortMinutes,onChange:lt=>xe({soldEffortMinutes:lt}),isDark:H,locale:d,disabled:ye,isBlurred:He,lens:v,hourlyRate:F(M)})}case "scheduleVariance":{let ye=M.effortMinutes||0,He=M.soldEffortMinutes||0,lt=M.timeLoggedMinutes||0,wt=ye>0||He>0||lt>0;return jsx(pg,{startDate:M.startDate,endDate:M.endDate,scheduleVariance:M.scheduleVariance,isDark:H,locale:d,hasTimeAllocated:wt})}case "hoursBar":{if(D&&M.hasChildren){let{spent:ye,allocated:He,quoted:lt}=Gn(M),wt=ye>He&&He>0;return jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",H?"text-white/50":"text-gray-500"),children:[jsx("span",{className:u("font-bold",wt?"text-[#FF453A]":H?"text-white/80":"text-gray-800"),children:Wn(ye)}),He>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:H?"text-white/60":"text-gray-600",children:Wn(He)})]}),lt>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:H?"text-amber-400/70":"text-amber-600",children:Wn(lt)})]})]})}return jsx(gg,{task:M,isDark:H,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:v,hourlyRate:F(M)})}case "teamLoad":return M.hasChildren||M.subtasks&&M.subtasks.length>0?jsx(bg,{task:M,isDark:H,locale:d}):jsx(Vd,{value:M.assignees||[],availableUsers:i,onChange:He=>{a.onTaskUpdate?.({...M,assignees:He});},isDark:H,locale:d});case "blockers":return jsx(yg,{blockers:M.blockers,isDark:H,locale:d});case "weight":{let ye=R.get(M.id);if(ye!==void 0)return jsx("span",{className:u("text-xs font-mono",ye>0?H?"text-white/50":"text-gray-400":H?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:ye>0?`${Number(ye.toFixed(2))}%`:"\u2014"});let He=M.weight||0;return jsx(nw,{value:He,onChange:lt=>xe({weight:lt}),isDark:H})}default:return jsx("span",{className:u("text-sm",H?"text-white/60":"text-gray-500"),children:"-"})}},[a,H,d,i,O,D,R]),ha=useCallback(M=>{let xe={name:O.columns.name,status:O.columns.status,priority:O.columns.priority,assignees:O.columns.assignees,startDate:O.columns.startDate,endDate:O.columns.endDate,progress:O.columns.progress,tags:O.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:O.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:O.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:O.columns.elapsedTime||(d==="es"?"Ejecutado":"Executed"),soldEffortMinutes:O.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),effortMinutes:O.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:O.columns.timeLoggedMinutes||(d==="es"?"Ejecutado":"Executed"),scheduleVariance:O.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:O.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:O.columns.teamLoad||(d==="es"?"Equipo":"Team"),blockers:O.columns.blockers||(d==="es"?"Bloqueantes":"Blockers"),weight:O.columns.weight||(d==="es"?"Peso":"Weight")}[M.type]||M.label;return typeof xe=="string"?xe:String(xe||M.type)},[O,d]),nr=useMemo(()=>{let xe=Ie.reduce((Ke,Qe)=>Ke+Qe.width,0)+(h?48:0),Fe={};for(let Ke of Ie)Fe[Ke.id]=`${Ke.width/xe*100}%`;return Fe},[Ie,h]);return r?jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007BFF]"}),jsxs("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:[O.empty.noTasks,"..."]})]})}):o?jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",H?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",H?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#007BFF]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#007BFF]"})}),jsx("h3",{className:u("text-lg font-semibold mb-2",H?"text-white":"text-gray-900"),children:O.empty.noTasks}),jsx("p",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:O.empty.addFirstTask})]})}):jsxs("div",{ref:j,className:u(H?"bg-[#0D0D0D]":"bg-white",Oe&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",H?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:u("text-sm",H?"text-white/60":"text-gray-600"),children:[Ma.length," ",O.pagination.tasks]}),g&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",H?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:ve,onChange:M=>We(M.target.value),placeholder:O.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",H?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),l&&jsx("div",{className:"flex items-center gap-2",children:l}),y&&Wt>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:Dt,onClick:()=>vt(!At),className:u("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",H?At?"bg-blue-500/10 border-blue-500/40 text-blue-400":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":At?"bg-blue-50 border-blue-300 text-blue-600":"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"}),et==="all"?d==="es"?"Todos":"All":`L${et}`]}),At&&jsx("div",{ref:ft,className:u("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",H?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:d==="es"?"Todos":"All"},...Array.from({length:Math.min(Wt,5)},(M,se)=>({value:se+1,label:`L${se+1}`}))].map(M=>jsxs("button",{onClick:()=>{qt(M.value),vt(false);},className:u("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",H?et===M.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":et===M.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:M.label}),et===M.value&&jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(M.value)))})]}),jsx(Ug,{value:Re,hideCompleted:ee,onChange:st,onHideCompletedChange:it,isDark:H,locale:d}),_?.enabled&&_.data&&!he&&jsx("button",{onClick:()=>Je(true),className:u("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",H?"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:d==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,w&&C&&jsxs(motion.button,{onClick:C,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 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:O.toolbar.newTask})]})]})}),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",H?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[Ve&&jsx("div",{className:"w-5 flex-shrink-0"}),Ie.map(M=>{let se=M.id!=="name",xe=Me===M.id&&K!==M.id;return jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",H?"text-white/60":"text-gray-500",se&&"cursor-grab",K===M.id&&"opacity-50",xe&&(H?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:nr[M.id],minWidth:M.minWidth},draggable:se,onDragStart:se?Fe=>A(Fe,M.id):void 0,onDragEnd:se?ge:void 0,onDragOver:se?Fe=>je(Fe,M.id):void 0,onDragLeave:se?tt:void 0,onDrop:se?Fe=>oa(Fe,M.id):void 0,onContextMenu:Fe=>U(Fe,void 0,M.id),children:[se&&jsx(GripVertical,{className:u("w-3 h-3 flex-shrink-0 transition-opacity",H?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),M.sortable?jsxs("button",{draggable:false,onClick:()=>Nt(M.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[ha(M),jsx(ArrowUpDown,{className:u("w-3 h-3",z===M.id&&"text-[#007BFF]")})]}):jsx("span",{draggable:false,children:ha(M)}),f&&M.resizable&&jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",Oe===M.id&&"bg-[#007BFF]"),onMouseDown:Fe=>$e(Fe,M.id)})]},M.id)}),h&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:M=>{M.stopPropagation(),Pt(se=>!se);},className:u("p-0.5 rounded transition-colors",H?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",yt&&(H?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(Ig,{isOpen:yt,onClose:()=>Pt(false),columns:le,customFields:c,onColumnsChange:Ut,onCreateCustomField:()=>{Pt(false),xt(true);},isDark:H,locale:d})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Ma.map((M,se)=>{let xe=_e.has(M.id),Fe=Math.min(se*.01,.2),Ke=M.hasChildren&&M.level===0,Qe=M.subtasks?.length||0;if(Ke){let{spent:St,allocated:Et,quoted:ma}=Gn(M),na=ow(M);return jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Fe},className:u("flex items-center border-y cursor-pointer",H?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100"),onClick:()=>a.onTaskClick?.(M),children:[Ve&&jsx("div",{className:"w-5 flex-shrink-0"}),Ie.map(Ya=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:nr[Ya.id],minWidth:Ya.minWidth},children:Ya.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{onClick:fa=>{fa.stopPropagation(),bt(M.id);},className:u("p-0.5 rounded flex-shrink-0 mt-0.5",H?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:xe?jsx(ChevronDown,{className:u("w-4 h-4",H?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:u("w-4 h-4",H?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:fa=>{fa.stopPropagation(),bt(M.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:xe?jsx(FolderOpen,{className:"w-4 h-4",style:{color:H?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:H?"#FFD60A":"#B45309"}})}),M.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:H?"#FFD60A":"#B45309"},children:M.wbsCode}),jsxs("div",{className:"flex flex-col min-w-0",children:[jsx("span",{className:u("text-[13px] font-bold uppercase tracking-wide",H?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:M.name}),jsxs("span",{className:u("text-[10px] font-mono",H?"text-white/30":"text-gray-500"),children:["(",Qe," ",d==="es"?Qe===1?"Tarea":"Tareas":Qe===1?"Item":"Items",")"]}),na!==null&&jsxs("span",{className:u("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",na>=1?"text-[#32D74B] bg-[#32D74B]/10":na>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",na.toFixed(2)]})]})]}):Ya.type==="timeLoggedMinutes"?v==="financial"?(()=>{let fa=Y(M),ya=Math.round(fa.dollarSpent);return ya>0?jsxs("span",{className:u("text-sm font-mono",H?"text-white/60":"text-gray-500"),children:["$",ya.toLocaleString("en-US")]}):null})():jsx(Dr,{value:St>0?St:void 0,isDark:H,locale:d,disabled:true,lens:v,hourlyRate:F(M)}):Ya.type==="soldEffortMinutes"?v==="financial"?(()=>{let fa=Y(M),ya=Math.round(fa.dollarQuoted);return ya>0?jsxs("span",{className:u("text-sm font-mono",H?"text-white/60":"text-gray-500"),children:["$",ya.toLocaleString("en-US")]}):null})():jsx(Dr,{value:ma>0?ma:void 0,isDark:H,locale:d,disabled:true,lens:v,hourlyRate:F(M)}):Ya.type==="effortMinutes"?v==="financial"?(()=>{let fa=Y(M),ya=Math.round(fa.dollarAllocated),Lt=Math.round(fa.dollarQuoted),xr=Lt-ya;return jsxs("div",{className:"flex flex-col",children:[ya>0?jsxs("span",{className:u("text-sm font-mono",H?"text-white/60":"text-gray-500"),children:["$",ya.toLocaleString("es-CO")]}):null,xr!==0&&ya>0&&Lt>0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",xr>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[xr>0?"+":"",Math.abs(xr)>=1e3?`$${(xr/1e3).toFixed(1)}K`:`$${xr}`]})]})})():jsx(Dr,{value:Et>0?Et:void 0,isDark:H,locale:d,disabled:true,lens:v,hourlyRate:F(M)}):Ga(M,Ya)},Ya.id)),h&&jsx("div",{className:"w-12 flex-shrink-0"})]},M.id)}let ye=$===M.id,He=ce===M.id,lt=He&&W==="above",wt=He&&W==="below",Ot=He&&W==="child";return jsxs(motion.div,{"data-listview-row":M.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Fe},className:u("flex items-center border-b transition-colors relative group",H?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50"),style:{opacity:ye?.4:1,backgroundColor:Ot?H?"rgba(46,148,255,0.08)":"rgba(46,148,255,0.05)":void 0,boxShadow:Ot?"inset 0 0 0 2px #2E94FF":void 0},onClick:()=>a.onTaskClick?.(M),onDoubleClick:()=>a.onTaskDoubleClick?.(M),onContextMenu:St=>U(St,M),children:[lt&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),wt&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),Ve&&jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:St=>Tt(M.id,St),style:{color:H?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),Ie.map(St=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[56px]",style:{width:nr[St.id],minWidth:St.minWidth},children:St.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&M.level>0&&jsx("div",{style:{width:`${M.level*24}px`},className:"flex-shrink-0"}),y&&M.hasChildren&&jsx("button",{onClick:Et=>{Et.stopPropagation(),bt(M.id);},className:u("p-0.5 rounded flex-shrink-0",H?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:xe?jsx(ChevronDown,{className:u("w-4 h-4",H?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:u("w-4 h-4",H?"text-white/60":"text-gray-400")})}),y&&!M.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(M.wbsCode||M.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[M.wbsCode&&jsx("span",{className:u("text-[10px] font-mono",H?"text-[#007BFF]":"text-blue-600"),children:M.wbsCode}),M.taskCode&&jsx("span",{className:u("text-[10px] font-mono",H?"text-white/40":"text-gray-400"),children:M.taskCode})]}),jsx("span",{className:u("truncate text-[13px]",M.hasChildren?"font-semibold":"font-medium",M.progress===100?H?"line-through text-white/50":"line-through text-gray-400":H?"text-white":"text-gray-900"),children:M.name}),M.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${M.tags[0].color}20`,color:M.tags[0].color},children:M.tags[0].name})]})]}):Ga(M,St)},St.id)),h&&jsx("div",{className:"w-12 flex-shrink-0"})]},M.id)})}),X&&Ma.length>0&&(()=>{let{spent:M,allocated:se,quoted:xe}=Se,Fe=se-M,Ke=Fe<0,Qe=Ke?`+${Wn(Math.abs(Fe))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${Wn(Fe)} ${d==="es"?"AHORRADO":"SAVED"}`,ye=v==="financial"&&E>0,He=(Ot,St)=>{if(ye){let Et=St??Ot/60*E;return `$${Math.round(Et).toLocaleString("es-CO")}`}return Wn(Ot)},lt=ye?Math.abs(Se.dollarAllocated-Se.dollarSpent):0,wt=ye?`${Ke?"+":"-"}$${lt.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Ke?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:Qe;return jsxs("div",{className:u("flex items-center sticky bottom-0 z-[5]",H?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:H?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Ve&&jsx("div",{className:"w-5 flex-shrink-0"}),Ie.map(Ot=>jsx("div",{className:"flex items-center px-4 py-3",style:{width:nr[Ot.id],minWidth:Ot.minWidth},children:Ot.type==="name"?jsx("span",{className:u("text-[11px] font-black uppercase tracking-widest",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):Ot.type==="hoursBar"?jsxs("div",{className:"flex flex-col w-full",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:He(M,ye?Se.dollarSpent:void 0)}),jsx("span",{className:u("text-[11px]",H?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:u("text-[11px]",H?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:He(se,ye?Se.dollarAllocated:void 0)})]}),se>0&&jsx("span",{className:u("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Ke?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:ye?wt:Qe})]}):Ot.type==="soldEffortMinutes"?jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:xe>0?He(xe,ye?Se.dollarQuoted:void 0):"\u2013"}):Ot.type==="effortMinutes"?(()=>{if(ye&&xe>0&&se>0){let St=Math.round(Se.dollarQuoted),Et=Math.round(Se.dollarAllocated),ma=St-Et,na=St>0?Math.round(ma/St*100):0;return jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:He(se,Se.dollarAllocated)}),jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",ma>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[ma>=0?"+":"",Math.abs(ma)>=1e3?`$${(ma/1e3).toFixed(1)}K`:`$${ma}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",na,"%)"]})]})]})}return jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:se>0?He(se,ye?Se.dollarAllocated:void 0):"\u2013"})})():Ot.type==="timeLoggedMinutes"?jsx("span",{className:u("text-[12px] font-bold",H?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:M>0?He(M,ye?Se.dollarSpent:void 0):"\u2013"}):Ot.type==="progress"?(()=>{let St=e||[],Et=[],ma=Lt=>{for(let xr of Lt)xr.subtasks&&xr.subtasks.length>0?ma(xr.subtasks):Et.push({progress:xr.progress||0,weight:xr.weight||0});};ma(St);let na=0,Ya=0,fa=0;for(let Lt of Et)Lt.weight>0&&(na+=Lt.progress*Lt.weight,Ya+=Lt.weight),fa+=Lt.progress;let ya=Ya>0?Math.round(na/Ya*10)/10:Et.length>0?Math.round(fa/Et.length):0;return jsxs("span",{className:u("text-[12px] font-bold font-mono",H?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[ya,"%"]})})():Ot.type==="weight"?(()=>{let St=e||[],Et=[],ma=ya=>{for(let Lt of ya)Et.push(Lt),Lt.subtasks?.length&&ma(Lt.subtasks);};ma(St);let Ya=Et.filter(ya=>!ya.subtasks?.length||ya.subtasks.length===0).reduce((ya,Lt)=>ya+(Lt.weight||0),0),fa=Math.abs(Ya-100)<.1;return jsxs("span",{className:u("text-[12px] font-bold font-mono",fa?H?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(Ya.toFixed(1)),"%"]})})():jsx("span",{className:u("text-[11px]",H?"text-white/30":"text-gray-300"),children:"\u2013"})},Ot.id)),h&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ma.length===0&&ve&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:u("w-12 h-12 mx-auto mb-4",H?"text-white/30":"text-gray-400")}),jsx("p",{className:u(H?"text-white/60":"text-gray-600"),children:O.empty.noResults})]})})]})}),_?.enabled&&_.data&&he&&jsx(Gg,{data:_.data,isDark:H,locale:d,onClose:()=>Je(false),lens:t?.lens})]}),jsx(Tg,{state:ct,onClose:oe,isDark:H,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Ta,onColumnSort:ta,availableUsers:i,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),S&&Ge&&$&&createPortal(jsx("div",{style:{position:"fixed",left:Ge.x+12,top:Ge.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let se=De.flattenTasks(e).find(xe=>xe.id===$);return se?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:H?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${H?"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:"#2E94FF"}}),jsx("span",{className:"text-xs font-medium",style:{color:H?"#e6edf3":"#111827"},children:se.name})]}):null})()}),document.body),jsx(Og,{isOpen:ke,onClose:()=>xt(false),onSave:Gt,isDark:H,locale:d})]})}var Jg=[{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}],Qg=[{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"}],Zg=[{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 ic={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:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},lc={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:"#2E94FF"},dc={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"},qi={dark:ic,light:lc,neutral:dc};function e0(e){return qi[e]||qi.dark}var cc={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},uc={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Yi={en:cc,es:uc};function Ns(e){return Yi[e]||Yi.en}function Xi(e,t){let a=Ns(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function t0(e){let t=Ns(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function a0(e,t=0,a=true){let r=Ns(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function Ss(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function mc(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function n0({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsx(Circle,{className:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var l0=26,mw=22,gw=10;function s0(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function gc(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function d0(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let o=r<0,s;if(t==="financial"&&a>0){let n=Math.round(Math.abs(r/60)*a);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}else {let n=Math.round(Math.abs(r)/60);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}return {text:`${o?"-":"+"}${s}`,isNegative:o}}function i0(e,t="hours",a=0){if(t==="financial"&&a>0){let o=Math.round(Math.abs(e/60)*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function fw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:i=0}){let{task:c,spanCols:l,lane:m,isStart:d,isEnd:p}=e,g=c.progress===100||c.status==="completed",y=c.isCriticalPath,x=d&&p?"rounded":d?"rounded-l":p?"rounded-r":"",h=p?gc(c.effortMinutes,n,i):null,f=p?d0(c,n,i):null,b=p?c.blockers?.find(w=>w.severity==="critical"):null;return jsxs(motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:u("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",x,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":y?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${m*l0}px`,left:"1px",width:`calc(${l*100}% - 2px)`,height:`${mw}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:y?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:d?"3px":void 0,borderLeftColor:d?y?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[y&&d&&jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),p&&(h||f)&&jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[h&&jsxs("span",{children:[s.labels.estimate,": ",h]}),f&&jsxs(Fragment,{children:[jsx("span",{className:"text-white/15",children:"|"}),jsx("span",{className:u(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),b&&jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",b.type]}),c.progress>0&&c.progress<100&&jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function c0({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:i,availableTags:c=[],onCreateTag:l,attachmentsByTask:m,comments:d,onAddComment:p,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,onTaskOpen:h,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:w,timerState:C,onLogTime:N,onUpdateEstimate:T,onUpdateSoldEffort:k,onStartTimer:v,onStopTimer:E,onDiscardTimer:I,blurFinancials:D=false,suppressDetailModal:X$1=false,lens:O="hours",hourlyRate:H=0}){let{theme:F="dark",locale:Y="en",customTranslations:Z,showBacklog:Se=true}=t,R=Xi(Y,Z),_=F==="dark"||F==="neutral",[he,Je]=useState(r||new Date),[z,re]=useState(null),[J,Pe]=useState(null),[ve,We]=useState(null),[Re,st]=useState({}),ee=3,it=3,le=useCallback(W=>{Pe(W.id),X$1||re(W),h?.(W.id);},[X$1,h]),[ot,yt]=useState(null),Pt=useCallback(()=>{Je(new Date(he.getFullYear(),he.getMonth()-1,1));},[he]),ke=useCallback(()=>{Je(new Date(he.getFullYear(),he.getMonth()+1,1));},[he]),xt=useCallback(()=>{Je(new Date);},[]),ct=useMemo(()=>{let W=he.getFullYear(),te=he.getMonth(),Ge=new Date(W,te,1),Te=new Date(W,te+1,0),Ue=Ge.getDay(),Ne=Te.getDate(),Ve=Ss(e),Tt=new Date;Tt.setHours(0,0,0,0);let gt=[],nt=Ue,et=new Date(W,te,0).getDate();for(let At=nt-1;At>=0;At--){let vt=new Date(W,te-1,et-At);gt.push({date:vt,isCurrentMonth:false,isToday:false,isWeekend:vt.getDay()===0||vt.getDay()===6,events:Ve.filter(Dt=>mc(vt,Dt)).map(Dt=>({id:Dt.id,title:Dt.name,start:Dt.startDate,end:Dt.endDate,task:Dt}))});}for(let At=1;At<=Ne;At++){let vt=new Date(W,te,At),Dt=vt.getTime()===Tt.getTime();gt.push({date:vt,isCurrentMonth:true,isToday:Dt,isWeekend:vt.getDay()===0||vt.getDay()===6,events:Ve.filter(ft=>mc(vt,ft)).map(ft=>({id:ft.id,title:ft.name,start:ft.startDate,end:ft.endDate,task:ft}))});}let qt=42-gt.length;for(let At=1;At<=qt;At++){let vt=new Date(W,te+1,At);gt.push({date:vt,isCurrentMonth:false,isToday:false,isWeekend:vt.getDay()===0||vt.getDay()===6,events:Ve.filter(Dt=>mc(vt,Dt)).map(Dt=>({id:Dt.id,title:Dt.name,start:Dt.startDate,end:Dt.endDate,task:Dt}))});}return gt},[he,e]),rt=useMemo(()=>Ss(e).filter(W=>!W.startDate||!W.endDate),[e]),$=useMemo(()=>{let W=Ss(e),te=0,Ge=0,Te=0,Ue=0,Ne=0;W.forEach(et=>{et.effortMinutes&&(te+=et.effortMinutes),et.soldEffortMinutes&&(Ge+=et.soldEffortMinutes),et.scheduleVariance!=null&&(Te+=et.scheduleVariance,Ue++),et.soldEffortMinutes&&et.effortMinutes&&(Ne+=et.soldEffortMinutes-et.effortMinutes);});let Ve=Ge>0?Math.min(100,Math.round(te/Ge*100)):0,Tt=Ue>0?Math.round(Te/Ue):0,nt=`${Ne<0?"-":"+"}${i0(Ne,O,H)}`;return {budgetUtil:Ve,avgVariance:Tt,costDisplay:nt,hasCostData:Ge>0}},[e,O,H]),de=useMemo(()=>{let W=[0,0,0,0,0,0];return ct.forEach((te,Ge)=>{let Te=Math.floor(Ge/7);te.events.forEach(Ue=>{if(Ue.task.startDate&&Ue.task.soldEffortMinutes){let Ne=new Date(Ue.task.startDate),Ve=te.date;Ne.getFullYear()===Ve.getFullYear()&&Ne.getMonth()===Ve.getMonth()&&Ne.getDate()===Ve.getDate()&&Te<W.length&&(W[Te]-=Ue.task.soldEffortMinutes);}});}),W},[ct]),S=useMemo(()=>{let W=Ss(e),te=new Map,Ge=new Set,Te=[0,0,0,0,0,0];if(ct.length===0)return {segmentsByCell:te,multiDayTaskIds:Ge,maxLanesPerRow:Te};let Ue=nt=>new Date(nt.getFullYear(),nt.getMonth(),nt.getDate()),Ne=Ue(ct[0].date),Ve=Ue(ct[ct.length-1].date),Tt=[];for(let nt of W){if(!nt.startDate||!nt.endDate)continue;let et=Ue(nt.startDate),qt=Ue(nt.endDate);if(et.getTime()===qt.getTime()||qt<Ne||et>Ve)continue;let At=et<Ne?Ne:et,vt=qt>Ve?Ve:qt,Dt=s0(At,Ne),ft=s0(vt,Ne);Dt<0||Dt>41||ft<0||ft>41||Dt!==ft&&(Ge.add(nt.id),Tt.push({task:nt,startIdx:Dt,endIdx:ft}));}Tt.sort((nt,et)=>nt.startIdx!==et.startIdx?nt.startIdx-et.startIdx:et.endIdx-et.startIdx-(nt.endIdx-nt.startIdx));let gt=[[],[],[],[],[],[]];for(let{task:nt,startIdx:et,endIdx:qt}of Tt){let At=Math.floor(et/7),vt=Math.floor(qt/7),Dt=Ue(nt.startDate),ft=Ue(nt.endDate),Wt=false;for(let Oe=At;Oe<=vt;Oe++){let Le=Oe===At?et%7:0,ut=Oe===vt?qt%7:6,ne=ut-Le+1,fe=0,L=gt[Oe]??[];for(gt[Oe]||(gt[Oe]=L);fe<L.length&&(L[fe]??-1)>=Le;)fe++;if(fe>=gw){Wt=true;break}fe>=L.length?L.push(ut):L[fe]=ut,Te[Oe]=Math.max(Te[Oe]??0,fe+1);let j=Oe===At&&Dt>=Ne,K=Oe===vt&&ft<=Ve,me=Oe*7+Le,Me={taskId:nt.id,task:nt,rowIndex:Oe,startCol:Le,endCol:ut,spanCols:ne,lane:fe,isStart:j,isEnd:K};te.has(me)||te.set(me,[]),te.get(me).push(Me);}Wt&&(Ge.delete(nt.id),te.forEach((Oe,Le)=>{let ut=Oe.filter(ne=>ne.taskId!==nt.id);ut.length===0?te.delete(Le):te.set(Le,ut);}));}return {segmentsByCell:te,multiDayTaskIds:Ge,maxLanesPerRow:Te}},[ct,e]),q=Y==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ce=he.toLocaleDateString(Y==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Ce=ce.charAt(0).toUpperCase()+ce.slice(1);return o?jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxs("p",{className:u("text-sm font-mono",_?"text-white/30":"text-gray-600"),children:[R.labels.noEvents,"..."]})]})}):s?jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",_?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",_?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",_?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#050505]":"bg-white",n),style:i,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",_?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsx(Calendar,{className:u("w-8 h-8",_?"text-[#007FFF]":"text-blue-500")})}),jsx("h3",{className:u("text-lg font-semibold mb-2",_?"text-white/90":"text-gray-900"),children:R.labels.noEvents}),jsx("p",{className:u("text-sm",_?"text-white/30":"text-gray-600"),children:R.labels.newTask})]})}):jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",_?"bg-[#050505]":"bg-white",n),style:i,children:[jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",_?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxs("div",{className:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",_?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsx(Calendar,{className:u("w-3.5 h-3.5",_?"text-[#007FFF]":"text-blue-500")}),jsx("span",{className:u("font-medium",_?"text-white":"text-gray-900"),children:Y==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:u("h-4 w-px",_?"bg-white/10":"bg-gray-200")}),jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsx("button",{onClick:Pt,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",_?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("span",{className:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",_?"text-white":"text-gray-900"),children:Ce}),jsx("button",{onClick:ke,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",_?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxs(Fragment,{children:[t.toolbarRightContent,jsx("div",{className:u("h-4 w-px",_?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:xt,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",_?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:R.navigation.today})]})]}),jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",_?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:q.map(W=>jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",_?"text-white/60 font-mono":"text-gray-500"),children:W},W))}),jsx("div",{className:"flex-1 overflow-y-auto",children:jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",_?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Pe(null),children:ct.map((W,te)=>{let Ge=te%7===6,Te=te>=35;return jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Ge&&(_?"border-r border-[#222]":"border-r border-gray-200"),!Te&&(_?"border-b border-[#222]":"border-b border-gray-200"),_?W.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":W.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",W.isToday&&_&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",W.isToday&&!_&&"ring-2 ring-blue-500 ring-inset"),children:[jsx("span",{className:u("text-xs font-mono select-none relative z-20",W.isToday?_?"text-[#007FFF] font-bold":"text-blue-600 font-bold":W.isCurrentMonth?_?"text-white/60":"text-gray-900":_?"text-white/20":"text-gray-400"),children:String(W.date.getDate()).padStart(2,"0")}),(()=>{let Ue=Math.floor(te/7),Ne=(S.maxLanesPerRow[Ue]??0)*l0,Ve=S.segmentsByCell.get(te);return Ne===0&&!Ve?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Ne}px`,zIndex:5},children:Ve?.map(Tt=>jsx(fw,{segment:Tt,isDark:_,blurFinancials:D,isSelected:J===Tt.taskId,t:R,lens:O,hourlyRate:H,onClick:()=>{le(Tt.task),a.onEventClick?.({id:Tt.task.id,title:Tt.task.name,start:Tt.task.startDate,end:Tt.task.endDate,task:Tt.task});}},Tt.taskId))})})(),(()=>{let Ue=W.events.filter(Ne=>Ne.task.isMilestone&&!S.multiDayTaskIds.has(Ne.id));return Ue.length===0?null:jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[Ue.slice(0,4).map(Ne=>jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Ne.title,onClick:Ve=>{Ve.stopPropagation(),le(Ne.task);}},Ne.id)),Ue.length>4&&jsxs("span",{className:u("text-[8px] font-mono",_?"text-white/30":"text-gray-400"),children:["+",Ue.length-4]})]})})(),(()=>{let Ue=[];W.events.forEach(Ve=>{Ve.task.blockers?.forEach(Tt=>{(Tt.severity==="warning"||Tt.severity==="critical")&&Ue.push({taskId:Ve.id,type:Tt.type,severity:Tt.severity,variance:Ve.task.scheduleVariance});});});let Ne=Ue[0];return Ne?jsx("div",{className:"mt-0.5 px-0.5",children:jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Ne.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsx("span",{children:"\u26A0"}),jsxs("span",{className:"truncate",children:[R.labels.risk,": ",Ne.type,Ne.variance?` (+${Math.abs(Ne.variance)}d ${R.labels.delay})`:""]})]})}):null})(),(()=>{let Ue=W.events.filter(gt=>!S.multiDayTaskIds.has(gt.id)),Ne=Re[te]||ee,Ve=Ue.slice(0,Ne),Tt=Ue.length-Ne;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Ve.map(gt=>jsxs(motion.button,{onClick:()=>{le(gt.task),a.onEventClick?.(gt);},whileHover:{scale:1.01},className:u("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",gt.task.progress===100||gt.task.status==="completed"?_?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":_?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:_?gt.task.progress===100||gt.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:gt.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsx("span",{className:u("flex-shrink-0 text-[9px]",gt.task.isMilestone?_?"text-amber-400":"text-amber-600":gt.task.isCriticalPath?"text-red-400":_?"text-[#1264FF]":"text-gray-400"),children:gt.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:gt.title})]},gt.id)),Tt>0&&jsxs("button",{onClick:gt=>{gt.stopPropagation(),st(nt=>({...nt,[te]:Ne+it}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",_?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",Tt," ",Y==="es"?"m\xE1s":"more"]}),Ne>ee&&Ue.length>ee&&jsx("button",{onClick:gt=>{gt.stopPropagation(),st(nt=>({...nt,[te]:ee}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",_?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:Y==="es"?"menos":"less"})]})})(),W.isCurrentMonth&&a.onTaskCreate&&jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let Ue=te>=28,Ne=te%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:Ve=>{Ve.stopPropagation(),yt(ot===te?null:te);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",ot===te?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",_?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsx(Plus,{className:u("w-3.5 h-3.5 transition-transform",ot===te&&"rotate-45")})}),jsx(AnimatePresence,{children:ot===te&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>yt(null)}),jsx(motion.div,{initial:{opacity:0,y:Ue?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ue?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",Ue?"bottom-full mb-1":"top-full mt-1",Ne?"right-0":"left-0",_?"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(Xo,{onSubmit:Ve=>{a.onTaskCreate?.({name:Ve.name,startDate:Ve.startDate||W.date,endDate:Ve.endDate||W.date,priority:Ve.priority,assignees:Ve.assignee?[Ve.assignee]:void 0}),yt(null);},onCancel:()=>yt(null),availableUsers:t.availableUsers,isDark:_,locale:Y==="es"?"es":"en",defaultDate:W.date,dropdownDirection:Ue?"up":"down"})})]})})]})})()}),te%7===6&&(()=>{let Ue=Math.floor(te/7),Ne=de[Ue];if(!Ne||Ne===0)return null;let Ve=i0(Ne,O,H);return jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Ne<0?"text-red-400":"text-emerald-400",D&&"blur-sm select-none"),children:[R.labels.cashOut,": ",Ne<0?"-":"+",Ve]})})()]},te)})})})]}),Se&&jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",_?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",_?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",_?"text-white/40":"text-gray-500"),children:R.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:u("text-[10px] font-mono tabular-nums",_?"text-white/20":"text-gray-400"),children:rt.length})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:rt.length===0?jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",_?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:u("w-5 h-5",_?"text-white/20":"text-gray-400")})}),jsx("p",{className:u("text-xs font-mono",_?"text-white/20":"text-gray-400"),children:Y==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):rt.map(W=>jsxs("button",{onClick:()=>{le(W);},className:u("w-full text-left rounded-md p-3 transition-all group/card",_?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsx("div",{className:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",_?"bg-white/20":"bg-gray-300")}),jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",_?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:W.name})]}),W.tags&&W.tags.length>0&&jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[W.tags.slice(0,3).map(te=>jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${te.color}15`,color:te.color,border:`1px solid ${te.color}30`},children:te.name},te.id)),W.tags.length>3&&jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",_?"text-white/20":"text-gray-400"),children:["+",W.tags.length-3]})]}),(W.effortMinutes||W.soldEffortMinutes)&&jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",_?"text-white/25":"text-gray-400",D&&"blur-sm select-none"),children:[gc(W.effortMinutes,O,H)&&jsxs("span",{children:[R.labels.estimate,": ",gc(W.effortMinutes,O,H)]}),(()=>{let te=d0(W,O,H);return te?jsx("span",{className:te.isNegative?"text-red-400":"text-emerald-400",children:te.text}):null})()]}),jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[W.priority&&jsx(Flag,{className:u("w-3 h-3",W.priority==="urgent"||W.priority==="high"?"text-red-400":W.priority==="medium"?"text-yellow-400":"text-green-400")}),jsx(n0,{task:W,isDark:_})]}),W.assignees&&W.assignees.length>0&&jsx("div",{className:"flex -space-x-1",children:W.assignees.slice(0,2).map((te,Ge)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:te.color||"#007FFF"},title:te.name,children:te.initials||te.name?.slice(0,2).toUpperCase()},Ge))})]})]},W.id))}),a.onTaskCreate&&jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",_?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsx("input",{type:"text",placeholder:R.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",_?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:W=>{W.key==="Enter"&&W.target.value.trim()&&(a.onTaskCreate?.({name:W.target.value.trim()}),W.target.value="");}})}),$.hasCostData&&jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",_?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",_?"text-white/40":"text-gray-500"),children:["\u25C8 ",R.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-[10px] font-mono",_?"text-white/40":"text-gray-500"),children:R.labels.budgetUtil}),jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",_?"text-white/60":"text-gray-700",D&&"blur-sm select-none"),children:[$.budgetUtil,"%"]})]}),jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",_?"bg-white/5":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${$.budgetUtil}%`,background:$.budgetUtil>90?"#EF4444":$.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",_?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",_?"text-white/25":"text-gray-400"),children:R.labels.variance}),jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",$.avgVariance>0?"text-emerald-400":$.avgVariance<0?"text-red-400":_?"text-white/50":"text-gray-600"),children:[$.avgVariance>0?"+":"",$.avgVariance," ",R.labels.days]})]}),jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",_?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",_?"text-white/25":"text-gray-400"),children:R.labels.cost}),jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",$.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",D&&"blur-sm select-none"),children:$.costDisplay})]})]})]})]})]}),!X$1&&jsx(fo,{task:z,isOpen:!!z,onClose:()=>re(null),onTaskUpdate:W=>{a.onTaskUpdate?.(W),re(W);},theme:F==="dark"?"dark":"light",locale:Y,availableUsers:t.availableUsers?.map(W=>({id:W.id,name:W.name,avatar:W.avatar,initials:W.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:l,attachments:z?m?.get(z.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:Ss(e).filter(W=>W.id!==z?.id),comments:d?.filter(W=>W.taskId===z?.id).map(W=>({...W,createdAt:W.createdAt instanceof Date?W.createdAt:new Date(W.createdAt),updatedAt:W.updatedAt instanceof Date?W.updatedAt:W.updatedAt?new Date(W.updatedAt):void 0})),onAddComment:p,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:w,isTimerRunning:C?.isRunning,timerElapsedSeconds:C?.elapsedSeconds,onTimeLog:N,onEstimateUpdate:T,onSoldEffortUpdate:k,onTimerStart:v,onTimerStop:E,onTimerDiscard:I,blurFinancials:D}),jsx(AnimatePresence,{children:ve&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>We(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:u("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",_?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",_?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsx("span",{className:u("font-medium text-sm",_?"text-white/90":"text-gray-900"),children:ve.date.toLocaleDateString(Y==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>We(null),className:u("p-1 rounded",_?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}),jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:ve.events.map(W=>jsxs("button",{onClick:()=>{We(null),le(W.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",_?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsx(n0,{task:W.task,isDark:_}),jsx("span",{className:u("text-sm truncate flex-1",_?"text-white/80":"text-gray-900"),children:W.title}),(W.task.priority==="high"||W.task.priority==="urgent")&&jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"})]},W.id))})]})]})})]})}var fc={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},bc={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},hc={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},Zi={dark:fc,light:bc,neutral:hc};function u0(e){return Zi[e]||Zi.dark}function hw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:i}){let[c,l]=useState(false),m=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=useMemo(()=>{let g=m.length,y=new Set(m.flatMap(f=>f.assignedUserIds||[])).size,x=m.map(f=>f.priority).filter(Boolean),h=new Set(m.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:y,priorities:x,labels:h}},[m]),p=()=>{o?.(e.id);};return jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",i),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:p,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:m.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:m.map(g=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsx("h4",{children:g.title}),g.description&&jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var m0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Ms(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 Fs(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 g0(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function f0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:i}){let c=useMemo(()=>({...m0,...n}),[n]),[l,m]=useState(new Set),d=useRef(null),p=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(w=>{let C=w.timestamp.toISOString().split("T")[0],N=b.get(C);N?N.push(w):b.set(C,[w]);}),Array.from(b.entries()).sort((w,C)=>C[0].localeCompare(w[0])).map(([w,C])=>({date:new Date(w),events:C.sort((N,T)=>T.timestamp.getTime()-N.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:y}=useMemo(()=>{let b=new Set,w=new Set;return e.forEach(C=>{b.add(C.userId),w.add(C.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(w)}},[e]),x=b=>{m(w=>{let C=new Set(w);return C.has(b)?C.delete(b):C.add(b),C});},h=b=>{let C=new Date().getTime()-b.getTime(),N=Math.floor(C/6e4),T=Math.floor(C/36e5),k=Math.floor(C/864e5);return N<1?"just now":N<60?`${N}m ago`:T<24?`${T}h ago`:k<7?`${k}d ago`:b.toLocaleDateString()},f=useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return useEffect(()=>{if(s&&d.current){let b=d.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:u("history-timeline-empty",i),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:u("history-timeline",c.compact&&"compact",i),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let w=b.target.value;a({...t,types:w?[w]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),y.map(b=>jsxs("option",{value:b,children:[Fs(b)," ",b.replace("_"," ")]},b))]}),g.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let w=b.target.value;a({...t,users:w?[w]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),g.map(b=>jsx("option",{value:b,children:b},b))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),f>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:p.map(b=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&b.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:b.events.map((w,C)=>{let N=l.has(w.id),T=s===w.id,k=g0(w.type);return jsxs("div",{"data-event-id":w.id,className:u("history-timeline-event",N&&"expanded",T&&"selected"),onClick:()=>o?.(w),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:k},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:Fs(w.type)})}),C<b.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:k}})]}),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&&w.userAvatar&&jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsx("span",{className:"history-timeline-event-action",children:Ms(w)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:v=>{v.stopPropagation(),x(w.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([v,E])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[v,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(E.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(E.to)})]})]},v)),w.metadata&&Object.keys(w.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(w.metadata).map(([v,E])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[v,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(E)})]},v))]})]})]})]},w.id)})})]},b.date?.toISOString()||"all"))})]})}function h0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:i,onSpeedChange:c,className:l}){let m=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:u("history-replay-empty",l),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:u("history-replay",l),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&Fs(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&Ms(d)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>i(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,y)=>jsx("div",{className:u("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>i(y),title:Ms(g)},g.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:m.map(g=>jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxs("div",{className:u("history-replay-start",l),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function yc(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function xc(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 y0(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 x0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Cw(e,t,a,r,o,s=100){let n=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),i=new Map(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let l=1-c/s;n.forEach(m=>{let d=a/2,p=r/2;m.vx+=(d-m.x)*o.centerForce*l,m.vy+=(p-m.y)*o.centerForce*l,n.forEach(g=>{if(m.id===g.id)return;let y=m.x-g.x,x=m.y-g.y,h=Math.sqrt(y*y+x*x)||1,f=o.chargeStrength*l/(h*h);m.vx+=y/h*f,m.vy+=x/h*f;});}),t.forEach(m=>{let d=i.get(typeof m.source=="string"?m.source:m.source.id),p=i.get(typeof m.target=="string"?m.target:m.target.id);if(!d||!p)return;let g=p.x-d.x,y=p.y-d.y,x=Math.sqrt(g*g+y*y)||1,h=(x-o.linkDistance)/x*o.forceStrength*l;d.vx+=g*h,d.vy+=y*h,p.vx-=g*h,p.vy-=y*h;}),n.forEach(m=>{m.fx!==null&&m.fx!==void 0?(m.x=m.fx,m.vx=0):m.x+=m.vx,m.fy!==null&&m.fy!==void 0?(m.y=m.fy,m.vy=0):m.y+=m.vy,m.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,m.x)),m.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,m.y)),m.vx*=.9,m.vy*=.9;});}return n}function v0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:i,className:c}){let l=useRef(null),[m,d]=useState([]),[p,g]=useState(null),[y,x]=useState(null),[h,f]=useState(null),[b,w]=useState(1),[C,N]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let O=Cw(e,t,a.width,a.height,a,150);d(O);},[e,t,a]);let T=useCallback((O,H)=>{a.enableDragging&&(H.stopPropagation(),g(O));},[a.enableDragging]),k=useCallback(O=>{if(!p||!l.current)return;let F=l.current.getBoundingClientRect(),Y=(O.clientX-F.left-C.x)/b,Z=(O.clientY-F.top-C.y)/b;d(Se=>Se.map(R=>R.id===p?{...R,x:Y,y:Z,fx:Y,fy:Z}:R));},[p,b,C]),v=useCallback(()=>{g(null);},[]),E=useCallback((O,H)=>{H.stopPropagation(),i?.({type:"node-click",node:O,position:{x:H.clientX,y:H.clientY}});},[i]),I=useCallback((O,H)=>{H.stopPropagation(),i?.({type:"edge-click",edge:O,position:{x:H.clientX,y:H.clientY}});},[i]),D=useCallback(O=>{let H=m.find(F=>F.id===O);return H?{x:H.x,y:H.y}:{x:0,y:0}},[m]),X=useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let H=O.card.priority;return H==="URGENT"?"#ef4444":H==="HIGH"?"#f59e0b":H==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:u("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:u("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:n.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.min(O+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),N({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:yc(O)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[y0(O)," ",xc(O)]})]},O))}),jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:k,onMouseUp:v,onMouseLeave:v,children:[jsxs("g",{transform:`translate(${C.x}, ${C.y}) scale(${b})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let H=D(typeof O.source=="string"?O.source:O.source.id),F=D(typeof O.target=="string"?O.target:O.target.id),Y=x0(O.type),Z=h===O.id,Se=O.onCriticalPath;return jsxs("g",{className:u("relationships-graph-edge",Z&&"hovered",Se&&"critical"),onMouseEnter:()=>f(O.id),onMouseLeave:()=>f(null),onClick:R=>I(O,R),children:[jsx("line",{x1:H.x,y1:H.y,x2:F.x,y2:F.y,stroke:yc(O.type),strokeWidth:Se?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Z?1:.6,markerEnd:Y?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Z&&jsx("text",{x:(H.x+F.x)/2,y:(H.y+F.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:xc(O.type)})]},O.id)})}),jsx("g",{className:"relationships-graph-nodes",children:m.map(O=>{let H=y===O.id,F=O.onCriticalPath;return jsxs("g",{className:u("relationships-graph-node",H&&"hovered",F&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:Y=>T(O.id,Y),onMouseEnter:()=>x(O.id),onMouseLeave:()=>x(null),onClick:Y=>E(O,Y),children:[jsx("circle",{r:F?a.nodeSize*1.2:a.nodeSize,fill:X(O),stroke:F?"#fbbf24":"#ffffff",strokeWidth:F?3:2,opacity:H?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 C0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[i,c]=useState(false),[l,m]=useState(null),[d,p]=useState(null),g=useRef(null),y=i||o;useEffect(()=>{e&&g.current&&g.current.focus();},[e]),useEffect(()=>{let b=w=>{w.key==="Escape"&&!y&&x();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,y]);let x=()=>{y||(n(""),m(null),p(null),t());},h=async()=>{if(!(!s.trim()||y)){c(true),m(null),p(null);try{let b=await r(s.trim());p(b);}catch(b){m(b instanceof Error?b.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{d&&(a(d),x());};return e?jsxs(Xt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:b=>b.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:x,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((b,w)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},w))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((b,w)=>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:b.title}),b.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},w)),d.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:g,value:s,onChange:b=>n(b.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((b,w)=>jsx("button",{onClick:()=>n(b),disabled:y,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:b},w))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:y&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:x,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsx("button",{onClick:f,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()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var vc={"gpt-4-turbo":{provider:"openai",name:"GPT-4 Turbo",contextWindow:128e3,costPer1kInput:.01,costPer1kOutput:.03,supportsVision:true,supportsJSON:true},"gpt-4":{provider:"openai",name:"GPT-4",contextWindow:8192,costPer1kInput:.03,costPer1kOutput:.06,supportsVision:false,supportsJSON:true},"gpt-3.5-turbo":{provider:"openai",name:"GPT-3.5 Turbo",contextWindow:16385,costPer1kInput:5e-4,costPer1kOutput:.0015,supportsVision:false,supportsJSON:true},"claude-3-5-sonnet-20241022":{provider:"anthropic",name:"Claude 3.5 Sonnet",contextWindow:2e5,costPer1kInput:.003,costPer1kOutput:.015,supportsVision:true,supportsJSON:true},"claude-3-opus-20240229":{provider:"anthropic",name:"Claude 3 Opus",contextWindow:2e5,costPer1kInput:.015,costPer1kOutput:.075,supportsVision:true,supportsJSON:true},"claude-3-haiku-20240307":{provider:"anthropic",name:"Claude 3 Haiku",contextWindow:2e5,costPer1kInput:25e-5,costPer1kOutput:.00125,supportsVision:true,supportsJSON:true}};var Nw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Dw={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 Sw(e,t,a){let r=vc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Ps(e){return `$${e.toFixed(4)}`}var wc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Sw(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,p)=>d+p.cost,0),s=a.reduce((d,p)=>d+p.inputTokens,0),n=a.reduce((d,p)=>d+p.outputTokens,0),i=a.filter(d=>d.success),c=a.reduce((d,p)=>d+p.duration,0),l={},m={};return a.forEach(d=>{l[d.feature]=(l[d.feature]||0)+1,m[d.feature]=(m[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:l,costsByFeature:m,averageDuration:r>0?c/r:0,successRate:r>0?i.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let i=this.operations.filter(m=>m.timestamp>=n).length,c=Math.max(0,o-i),l=i/o*100;return {used:i,limit:o,remaining:c,percentUsed:l,isExceeded:i>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},sn=new wc;function D0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(sn.getStats()),[s,n]=useState(sn.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(sn.getStats()),n(sn.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),useEffect(()=>{let c=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let i=sn.getRecentOperations(5);return jsxs(Xt,{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-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Ps(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,l])=>{let m=r.costsByFeature[c]||0,d=r.totalOperations>0?l/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[l," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Ps(m)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},c)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),i.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:i.map(c=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Ps(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 M0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,i]=useState(""),[c,l]=useState(""),[m,d]=useState(""),[p,g]=useState(false),[y,x]=useState(null),[h,f]=useState(null),[b,w]=useState(null),C=useRef(null),N=p||o;useEffect(()=>{e&&C.current&&C.current.focus();},[e]),useEffect(()=>{let I=D=>{D.key==="Escape"&&!N&&T();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,N]);let T=()=>{N||(i(""),l(""),d(""),x(null),f(null),w(null),t());},k=async()=>{if(!(!n.trim()||N)){g(true),x(null),f(null),w(null);try{let I=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:m||void 0});f(I.tasks.tasks),w({from_cache:I.from_cache,tokens_used:I.tokens_used,mock_mode:I.mock_mode,similarity:I.similarity,tokens_saved:I.tokens_saved});}catch(I){x(I instanceof Error?I.message:"Failed to generate tasks");}finally{g(false);}}},v=()=>{h&&(a(h),T());};if(!e)return null;let E=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxs(Xt,{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:I=>I.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:T,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children: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:[b?.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"}),b?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",E,"% similar)"]}):jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[b?.tokens_used||0," tokens"]}),b?.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:[b.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((I,D)=>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:["#",D+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:I.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"})]}),I.start," \u2192 ",I.end]}),jsxs("span",{children:[I.duration," days"]}),I.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",I.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${I.priority==="high"?"bg-red-500/20 text-red-400":I.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:I.priority})]})},I.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:C,value:n,onChange:I=>i(I.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:N}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:I=>l(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:m,onChange:I=>d(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]})]}),y&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),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((I,D)=>jsx("button",{onClick:()=>i(I),disabled:N,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:I},D))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:N&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:T,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsx("button",{onClick:v,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:k,disabled:!n.trim()||N,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function al({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(h=>{t&&Ws(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,b,w)=>{console.warn(`Retry attempt ${b} after ${w}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=useCallback(async(h,f,b)=>{r(w=>{let C=w.cards.find(I=>I.id===h);if(!C)return w;let N=C.columnId,T={...C,columnId:f,position:b},k=w.cards.map(I=>I.id===h?T:I),v=w.columns.map(I=>{if(I.id===N)return {...I,cardIds:I.cardIds.filter(D=>D!==h)};if(I.id===f){let D=k.filter(X=>X.columnId===f).sort((X,O)=>X.position-O.position);return {...I,cardIds:D.map(X=>X.id)}}return I}),E={...w,cards:k,columns:v};return o(E),E});},[o]),n=useCallback(async(h,f)=>{r(b=>{let w=b.cards.map(N=>N.id===h?{...N,...f}:N),C={...b,cards:w};return o(C),C});},[o]),i=useCallback(async h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let w={...h,id:f},C=b.columns.map(T=>T.id===h.columnId?{...T,cardIds:[...T.cardIds,f]}:T),N={...b,cards:[...b.cards,w],columns:C};return o(N),N});},[o]),c=useCallback(async h=>{r(f=>{let b=f.cards.find(T=>T.id===h);if(!b)return f;let w=f.cards.filter(T=>T.id!==h),C=f.columns.map(T=>T.id===b.columnId?{...T,cardIds:T.cardIds.filter(k=>k!==h)}:T),N={...f,cards:w,columns:C};return o(N),N});},[o]),l=useCallback(async h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let w={...h,id:f,cardIds:[]},C={...b,columns:[...b.columns,w]};return o(C),C});},[o]),m=useCallback(async(h,f)=>{r(b=>{let w=b.columns.map(N=>N.id===h?{...N,...f}:N),C={...b,columns:w};return o(C),C});},[o]),d=useCallback(async h=>{r(f=>{let b=f.cards.filter(N=>N.columnId!==h),w=f.columns.filter(N=>N.id!==h),C={...f,cards:b,columns:w};return o(C),C});},[o]),p=useCallback(h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),f},[i]),g=useCallback(h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),f},[l]),y=useCallback(()=>{r(h=>{let f={...h,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:i,onCardDelete:c,onColumnCreate:l,onColumnUpdate:m,onColumnDelete:d},setBoard:r,helpers:{addCard:p,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:y}}}function P0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=al({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(c,l,m={})=>{s.addCard({title:l,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...m});},addColumn:(c,l)=>{let m=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:l??m+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var As={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},L0={by:"none",order:"asc"};function I0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...As,...e}),[s,n]=useState({...L0,...t}),i=useCallback(x=>{o(h=>({...h,...x}));},[]),c=useCallback(x=>{n(h=>({...h,...x}));},[]),l=useCallback(()=>{o(As),n(L0);},[]),m=useCallback(()=>{a&&o({...As,assignees:[a]});},[a]),d=useCallback(()=>{o({...As,dateFilter:"overdue"});},[]),p=useCallback(()=>{o({...As,priorities:["HIGH","URGENT"]});},[]),g=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=useCallback(x=>{let h=[...x];if(r.search){let f=r.search.toLowerCase();h=h.filter(b=>b.title.toLowerCase().includes(f)||b.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,b=f.getFullYear(),w=String(f.getMonth()+1).padStart(2,"0"),C=String(f.getDate()).padStart(2,"0"),N=`${b}-${w}-${C}`;h=h.filter(T=>{if(!T.endDate&&!T.dueDate)return false;let k=T.endDate||T.dueDate;if(!k)return false;let v;if(typeof k=="string")v=k.split("T")[0]||k;else {let E=k.getUTCFullYear(),I=String(k.getUTCMonth()+1).padStart(2,"0"),D=String(k.getUTCDate()).padStart(2,"0");v=`${E}-${I}-${D}`;}switch(r.dateFilter){case "overdue":return v<N;case "today":return v===N;case "this-week":let E=new Date(N+"T00:00:00"),I=new Date(v+"T00:00:00"),D=new Date(E);return D.setDate(D.getDate()+7),I>=E&&I<=D;case "custom":if(r.dateRange){let X=typeof k=="string"?new Date(k):k;return X>=r.dateRange.start&&X<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(h=h.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(h=h.filter(f=>f.labels&&f.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(h=h.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&h.sort((f,b)=>{let w=0;switch(s.by){case "created":let C=f.createdAt?new Date(f.createdAt).getTime():0,N=b.createdAt?new Date(b.createdAt).getTime():0;w=C-N;break;case "priority":let T={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},k=T[f.priority||"LOW"],v=T[b.priority||"LOW"];w=k-v;break;case "dueDate":let E=f.endDate||f.dueDate,I=b.endDate||b.dueDate;if(!E)return 1;if(!I)return -1;let D=typeof E=="string"?new Date(E).getTime():E.getTime(),X=typeof I=="string"?new Date(I).getTime():I.getTime();w=D-X;break;case "title":w=f.title.localeCompare(b.title);break;case "estimate":let O=f.estimatedTime||0,H=b.estimatedTime||0;w=O-H;break;default:w=0;}return s.order==="asc"?w:-w}),h},[r,s]);return {filters:r,sort:s,setFilters:i,setSort:c,resetFilters:l,filterMyTasks:m,filterOverdue:d,filterHighPriority:p,applyFilters:y,hasActiveFilters:g}}var R0,O0;if(typeof window<"u")try{let e=Hs("ai");R0=e.generateObject,O0=e.generateText;}catch{}function $0(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(R0&&O0&&e.apiKey),n=useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let g=p instanceof Error?p:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),i=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let g=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(p){let g=p instanceof Error?p:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),l=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(p){let g=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),m=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(p){let g=p instanceof Error?p:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:i,onPredictRisks:c,onGenerateSubtasks:l,onEstimateEffort:m,isAvailable:s,isLoading:t,error:r}}function Cc(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function H0(e){let{cards:t}=e,[a,r]=Cc(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=useCallback((d,p)=>{if(!p){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=p.ctrlKey||p.metaKey,y=p.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(x=>x!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(y&&a.lastSelectedCardId){let x=t.find(f=>f.id===d),h=t.find(f=>f.id===a.lastSelectedCardId);if(x&&h&&x.columnId===h.columnId){let f=t.filter(v=>v.columnId===x.columnId).sort((v,E)=>v.position-E.position),b=f.findIndex(v=>v.id===a.lastSelectedCardId),w=f.findIndex(v=>v.id===d),[C,N]=b<w?[b,w]:[w,b],T=f.slice(C,N+1).map(v=>v.id),k=Array.from(new Set([...a.selectedCardIds,...T]));r({selectedCardIds:k,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),i=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),m=useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:i,selectAll:c,toggleCard:l,getSelectedCards:m}}var z0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function U0(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...z0,...a}),[a]),[s,n]=useState([]),i=useCallback((x,h,f,b,w)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let C={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:h,columnId:f,strategy:b,color:w,isExpanded:true,position:s.filter(N=>N.columnId===f).length,createdAt:new Date};n(N=>[...N,C]);},[o.minCardsPerStack,s]),c=useCallback(x=>{n(h=>h.filter(f=>f.id!==x));},[]),l=useCallback(x=>{n(h=>h.map(f=>f.id===x?{...f,isExpanded:!f.isExpanded}:f));},[]),m=useCallback((x,h)=>{n(f=>f.map(b=>b.id===x&&!b.cardIds.includes(h)?{...b,cardIds:[...b.cardIds,h]}:b));},[]),d=useCallback((x,h)=>{n(f=>f.map(b=>{if(b.id===x){let w=b.cardIds.filter(C=>C!==h);return w.length<o.minCardsPerStack?null:{...b,cardIds:w}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),p=useCallback(x=>s.filter(h=>h.columnId===x).sort((h,f)=>h.position-f.position),[s]),g=useCallback(async x=>{let h=t.filter(N=>N.columnId===x);if(h.length<o.minCardsPerStack*2)return [];let f=[],b=new Map;h.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(T=>{b.has(T)||b.set(T,[]),b.get(T).push(N);});}),b.forEach((N,T)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${T}`,cardIds:N.map(k=>k.id),columnId:x,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${T}"`,confidence:.85});});let w=new Map;h.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(T=>{w.has(T)||w.set(T,[]),w.get(T).push(N);});}),w.forEach((N,T)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${T.slice(-4)}`,cardIds:N.map(k=>k.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let C=new Map;if(h.forEach(N=>{N.priority&&(C.has(N.priority)||C.set(N.priority,[]),C.get(N.priority).push(N));}),C.forEach((N,T)=>{if(N.length>=o.minCardsPerStack){let k={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[T.toLowerCase()]||"\u26AA";f.push({stack:{title:`${k} ${T} Priority`,cardIds:N.map(v=>v.id),columnId:x,strategy:"priority",color:T==="high"||T==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${T} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of h){let k=(await r.findSimilar(N,h)).filter(v=>v.similarity>=o.autoStackConfidenceThreshold);if(k.length>=o.minCardsPerStack-1){let v=[N.id,...k.map(I=>I.card.id)],E=k.reduce((I,D)=>I+D.similarity,0)/k.length;f.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:v,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${k.length+1} similar tasks`,confidence:E});}}return f.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,T)=>T.confidence-N.confidence).slice(0,5)},[t,o,r]),y=useCallback(x=>{i(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[i]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let f=await g(h),b=f[0];f.length>0&&b&&b.confidence>=.9&&y(b);});},[]),{stacks:s,createStack:i,deleteStack:c,toggleStack:l,addToStack:m,removeFromStack:d,getStacksForColumn:p,getSuggestions:g,applySuggestion:y,config:o}}var W0=createContext(null);function G0({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:l}=Hs("@libxai/core");s.set(c.id,new l(c));}),t?.cards?.forEach(c=>{let{Card:l}=Hs("@libxai/core");n.set(c.id,new l(c));});let i=null;if(t?.board){let{Board:c}=Hs("@libxai/core");i=new c(t.board);}r.current=new BoardStore({board:i,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(W0.Provider,{value:{store:o},children:e})}function rl(){let e=useContext(W0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Is(){let e=rl(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let i=useCallback(b=>{e.updateBoard(b);},[e]),c=useCallback(b=>{e.addColumn(b);},[e]),l=useCallback((b,w)=>{e.updateColumn(b,w);},[e]),m=useCallback(b=>{e.deleteColumn(b);},[e]),d=useCallback(b=>e.getColumn(b),[e]),p=useCallback(b=>{e.addCard(b);},[e]),g=useCallback((b,w)=>{e.updateCard(b,w);},[e]),y=useCallback(b=>{e.deleteCard(b);},[e]),x=useCallback((b,w,C)=>{e.moveCard(b,w,C);},[e]),h=useCallback(b=>e.getCard(b),[e]),f=useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:i,addColumn:c,updateColumn:l,deleteColumn:m,getColumn:d,addCard:p,updateCard:g,deleteCard:y,moveCard:x,getCard:h,getCardsByColumn:f}}function j0(e){let{cards:t}=Is();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function _0(e="position",t="asc"){let{cards:a}=Is();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let i={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?i[o.priority]:0,l=s.priority?i[s.priority]:0;n=c-l;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var ol=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=nu.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let i=await Promise.resolve(n.apply(s,a));i!==void 0&&(o=i,a[0]=i);}catch(i){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,i,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Vw=new ol;function q0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:i=0,getItemKey:c}){let l=useRef(null),m=useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:i}),d=m.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:l,style:p,className:o,children:jsx("div",{style:g,children:d.map(y=>{let x=e[y.index];if(!x)return null;let h=c?c(x,y.index):y.index,f={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsx("div",{style:f,"data-index":y.index,children:r(x,y.index)},h)})})})}function Y0(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 J0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:i=16,getItemKey:c,horizontal:l=true}){let m=useRef(null),d=useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:n,gap:i}),p=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:m,style:g,className:s,children:jsx("div",{style:y,children:p.map(x=>{let h=e[x.index];if(!h)return null;let f=c?c(h,x.index):x.index,b={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsx("div",{style:b,"data-index":x.index,children:o(h,x.index)},f)})})})}function Q0(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 Z0(e,t=10){return e>t}var Sc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Ec={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Mc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Fc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Pc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Ac={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Lc={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Ic={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)"},Bc={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)"},Rc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Oc={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}},$c={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}},nl={spacing:Sc,borderRadius:Ec,fontSize:Mc,fontWeight:Fc,lineHeight:Pc,zIndex:Ac,duration:Lc,easing:Ic,shadows:Bc,opacity:Rc,kanban:Oc,gantt:$c};function ef(e,t,a){return e[t]??a}function Hc(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?Hc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Kw(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function zc(e="asakaa"){let t=Hc(nl),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Kw(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
413
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function Am(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function wo(e,t){let a=Am(e),r=t.toLowerCase().trim(),o=a.find(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let c=l.name.toLowerCase();return n.every(i=>c.includes(i))})}function Rd(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let p=new Date(r);return p.setDate(p.getDate()+1),p}if(a==="yesterday"||a==="ayer"){let p=new Date(r);return p.setDate(p.getDate()-1),p}if(a==="next week"||a==="la pr\xF3xima semana"){let p=new Date(r);return p.setDate(p.getDate()+7),p}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(g!==void 0){let y=new Date(r),x=y.getDay(),h=g-x;return h<=0&&(h+=7),y.setDate(y.getDate()+h),y}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let p=parseInt(s[1],10),g=s[2].toLowerCase(),y=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?y.setDate(y.getDate()+p):g==="week"||g==="semana"||g==="semanas"?y.setDate(y.getDate()+p*7):(g==="month"||g==="mes"||g==="meses")&&y.setMonth(y.getMonth()+p),y}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let p=parseInt(l[1],10),g=parseInt(l[2],10)-1,y=parseInt(l[3],10);return new Date(y,g,p)}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 p=parseInt(i[1],10),g=c[i[2].toLowerCase()],y=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(y,g,p)}let m={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let p=m[d[1].toLowerCase()],g=parseInt(d[2],10),y=d[3]?parseInt(d[3],10):r.getFullYear();if(p!==void 0)return new Date(y,p,g)}return null}function Od(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function $d(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 Lm(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 Im(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(),m=r[2].trim(),d=wo(t,i),p=Rd(m);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${m}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,y=new Date(p);return y.setDate(y.getDate()+g),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:p,endDate:y},message:`Moved "${d.name}" to ${p.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),m=o[2].trim(),d=wo(t,i),p=Od(m);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let g=new Date(d.endDate);return g.setDate(g.getDate()+p),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:g},message:`Extended "${d.name}" by ${p} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),m=s[2].trim(),d=wo(t,i),p=$d(m);return d?p===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:p},message:`Set "${d.name}" progress to ${p}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),m=n[2].trim(),d=wo(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:m},message:`Renamed "${d.name}" to "${m}".`,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(),m=l[2].trim(),d=wo(t,i),p=wo(t,m);return d?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:d.id,dependencyTo:p.id,message:`Linked "${d.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:m,message:`Could not find a task named "${m}".`,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(),m=wo(t,i);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.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 Bm(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 r2(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 o2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Oi(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let d=a.find(p=>p.id===m);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>Oi(m,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let n=m=>{if(m)return typeof m=="string"?new Date(m):m},l=n(e.startDate),c=n(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:r2(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function Rm(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:o2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Om(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Oi(r,e,t))}var Hd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},zd={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"}},$i={en:Hd,es:zd};function Ud(e){return $i[e]||$i.en}function Hi(e,t){let a=Ud(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 Wd=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function $m(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 Hm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&n(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let c=$m(e),i=Wd[0],m=Wd.find(g=>g.value===c)??i,d=m.icon,p=g=>{switch($m(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(d,{className:u("w-4 h-4 flex-shrink-0",m.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(d,{className:u("w-4 h-4 flex-shrink-0",m.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:u("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:Wd.map(g=>{let y=g.icon;return jsxs("button",{onClick:x=>{x.stopPropagation(),t(g.value),n(false);},className:u("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===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(y,{className:u("w-4 h-4",g.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p(g.value)})]},g.value)})})]})}var Gd=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#3B9EFF]",bg:"bg-[#3B9EFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function Um({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let m=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let c=Gd.find(m=>m.value===e)??Gd[4],i=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:u("w-4 h-4",c.color)}),jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:m=>{m.stopPropagation(),n(!s);},className:u("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:u("w-4 h-4",c.color)}),jsx("span",{className:u("text-sm",a?"text-white/60":"text-gray-500"),children:c.label[i]}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Gd.map(m=>jsxs("button",{onClick:d=>{d.stopPropagation(),t(m.value),n(false);},className:u("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===m.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:u("w-2 h-2 rounded-full",m.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:m.label[i]})]},m.value))})]})}function ws(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Vd(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function jd({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false}){let[n,l]=useState(false),[c,i]=useState(""),m=useRef(null),d=useRef(null);useEffect(()=>{let x=h=>{m.current&&!m.current.contains(h.target)&&(l(false),i(""));};return n&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),useEffect(()=>{n&&d.current&&d.current.focus();},[n]);let p=t.filter(x=>x.name.toLowerCase().includes(c.toLowerCase())),g=x=>e.some(h=>h.name===x),y=x=>{if(a){if(g(x.name))a(e.filter(h=>h.name!==x.name));else {let h={name:x.name,initials:ws(x.name),color:x.color||Vd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};a([...e,h]);}l(false),i("");}};return s||!a?e.length===0?jsx("span",{className:u("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,h)=>jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Vd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ws(x.name)},`${x.name}-${h}`)),e.length>3&&jsxs("div",{className:u("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:m,className:"relative",children:[jsx("button",{onClick:x=>{x.stopPropagation(),l(!n);},className:u("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:u("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:u("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,h)=>jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!x.avatar&&Vd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ws(x.name)},`${x.name}-${h}`)),e.length>2&&jsxs("span",{className:u("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),n&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:d,type:"text",value:c,onChange:x=>i(x.target.value),placeholder:o==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,h)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||ws(x.name)}),x.name.split(" ")[0],jsx("button",{onClick:f=>{f.stopPropagation(),a(e.filter(b=>b.name!==x.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsx(X,{style:{width:10,height:10}})})]},`${x.name}-${h}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:p.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:o==="es"?"No se encontraron miembros":"No members found"}):p.map(x=>{let h=g(x.name);return jsxs("button",{onClick:f=>{f.stopPropagation(),y(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:h?r?"rgba(0, 127, 255, 0.12)":"rgba(59, 130, 246, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:f=>{h||(f.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:f=>{h||(f.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#3B82F6",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):ws(x.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),h&&jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function Km({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:c}){let[i,m]=useState(false),[d,p]=useState(o),[g,y]=useState(()=>{let k=o==="start"?e:t;if(k){let v=k instanceof Date?k:new Date(k);return new Date(v.getFullYear(),v.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=useRef(null),h=e?e instanceof Date?e:new Date(e):null,f=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let k=v=>{x.current&&!x.current.contains(v.target)&&m(false);};return i&&document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[i]),useEffect(()=>{i&&p(r?o:"start");},[i,r,o]);let b=k=>k?k.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",w=useCallback(()=>{let k=g.getFullYear(),v=g.getMonth(),E=new Date(k,v,1),S=new Date(k,v+1,0).getDate(),X=E.getDay(),O=[],F=new Date(k,v,0).getDate();for(let Z=X-1;Z>=0;Z--)O.push({date:new Date(k,v-1,F-Z),isCurrentMonth:false});for(let Z=1;Z<=S;Z++)O.push({date:new Date(k,v,Z),isCurrentMonth:true});let Y=42-O.length;for(let Z=1;Z<=Y;Z++)O.push({date:new Date(k,v+1,Z),isCurrentMonth:false});return O},[g]),C=k=>{if(r)o==="start"?a(k,f||void 0):a(h||void 0,k),m(false);else if(d==="start"){let v=f&&k>f?k:f;a(k,v||void 0),p("end");}else {let v=h&&k<h?k:h;a(v||void 0,k),m(false);}},N=()=>{let k=new Date,v=new Date(k);v.setDate(k.getDate()+1);let E=new Date(k);E.setDate(k.getDate()+((6-k.getDay()+7)%7||7));let I=new Date(k);I.setDate(k.getDate()+((1-k.getDay()+7)%7||7));let S=new Date(k);S.setDate(k.getDate()+(6-k.getDay()+7)%7+7);let X=new Date(k);X.setDate(k.getDate()+14);let O=new Date(k);return O.setDate(k.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:k,display:k.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:v,display:v.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:E,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:I,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:S,display:S.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:X,display:X.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let k=r&&o==="start"?h:f;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(k)})]})}let T=r&&o==="start"?h:f;return jsxs("div",{ref:x,className:"relative",children:[jsxs("button",{onClick:k=>{k.stopPropagation(),m(!i);let v=o==="start"?h:f;v&&y(new Date(v.getFullYear(),v.getMonth(),1));},className:u("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:u("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-white/60":"text-gray-500"),children:b(T)})]}),i&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>m(false)}),jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),onClick:k=>k.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[N().map((k,v)=>jsxs("button",{className:u("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(k.date),children:[jsx("span",{children:k.label}),jsx("span",{className:u("text-xs",s?"text-white/30":"text-gray-400"),children:k.display})]},v)),jsx("div",{className:u("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,f||void 0):a(h||void 0,void 0):a(void 0,void 0),m(false);},className:u("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:n==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className:u("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:d==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:u("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>y(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>y(new Date(g.getFullYear(),g.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(k=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:k},k))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:w().map((k,v)=>{let E=k.date.toDateString()===new Date().toDateString(),I=h?.toDateString()===k.date.toDateString(),S=f?.toDateString()===k.date.toDateString(),X=I||S,O=!r&&h&&f&&k.date>=h&&k.date<=f;return jsx("button",{onClick:()=>C(new Date(k.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!k.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),k.isCurrentMonth&&(s?"text-white":"text-gray-900"),E&&"ring-2 ring-[#007BFF]",I&&"bg-[#007BFF] text-white",S&&!I&&"bg-[#7C3AED] text-white",O&&!X&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!X&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:k.date.getDate()},v)})})]})]})]})]})}function Wi({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let c=e?e instanceof Date?e:new Date(e):null;return jsx(Km,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:l||null,onChange:(p,g)=>{t&&t(s==="start"?p:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function Hn(e=600){let[t,a]=useState(false),r=useRef(null),o=useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Gi(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=useState(e),[l,c]=useState(false),i=useRef(e),m=useRef([]);return useEffect(()=>{if(m.current.forEach(clearTimeout),m.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let d=i.current??0,p=e,g=p-d,y=r/o;c(true);for(let x=1;x<=o;x++){let h=setTimeout(()=>{let f=x/o,b=1-Math.pow(1-f,3),w=Math.round(d+g*b);n(w),x===o&&(c(false),n(p));},y*x);m.current.push(h);}return i.current=e,()=>{m.current.forEach(clearTimeout),m.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function qm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,l]=useState(0),c=useRef(null),i=useRef(null),m=useCallback(g=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(g),l(0);let y=Date.now();i.current=setInterval(()=>{let x=Date.now()-y,h=Math.min(x/a*100,100);l(h);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),l(0);},a);},[a,e]),d=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:o,isPending:o!==null,progress:n,startChange:m,cancelChange:d}}function Xm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let[n,l]=useState(false),[c,i]=useState(""),m=useRef(null),{isFlashing:d,triggerFlash:p}=Hn(),{displayValue:g,isAnimating:y}=Gi(e,{enabled:o,duration:300,steps:6}),x=C=>{if(r||!t)return;C.stopPropagation();let N=C.currentTarget.getBoundingClientRect(),T=C.clientX-N.left,k=Math.round(T/N.width*100),v=Math.max(0,Math.min(100,k));v!==e&&(t(v),s&&p());},h=useCallback(C=>{r||!t||(C.stopPropagation(),i(String(e)),l(true));},[r,t,e]);useEffect(()=>{n&&m.current&&(m.current.focus(),m.current.select());},[n]);let f=useCallback(()=>{l(false);let C=parseInt(c,10);if(!isNaN(C)&&t){let N=Math.max(0,Math.min(100,C));N!==e&&(t(N),s&&p());}},[c,t,e,s,p]),b=useCallback(C=>{C.key==="Enter"&&f(),C.key==="Escape"&&l(false);},[f]),w=g??e;return jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",d&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[jsx("div",{onClick:x,className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:u("h-full rounded-full transition-[width]",w===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",y&&"transition-none"),style:{width:`${w}%`}})}),n?jsxs("div",{className:"flex items-center gap-0.5",onClick:C=>C.stopPropagation(),children:[jsx("input",{ref:m,value:c,onChange:C=>i(C.target.value.replace(/[^0-9]/g,"")),onBlur:f,onKeyDown:b,maxLength:3,className:u("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-blue-400":"bg-white border-gray-300 text-gray-900 focus:border-blue-500")}),jsx("span",{className:u("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:h,className:u("text-xs w-8 text-right tabular-nums font-mono rounded px-1",a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",y&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[w,"%"]})]})}function Zm({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=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 m=()=>{l!==e&&t?.(l),n(false);},d=p=>{p.key==="Enter"?m():p.key==="Escape"&&(c(e),n(false));};return o||!t?jsx("span",{className:u("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:l,onChange:p=>c(p.target.value),onBlur:m,onKeyDown:d,onClick:p=>p.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:p=>{p.stopPropagation(),n(true);},className:u("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 ag({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:l=true,enableSaveFlash:c=true}){let[i,m]=useState(false),[d,p]=useState(e?.toString()||""),g=useRef(null),{isFlashing:y,triggerFlash:x}=Hn(),{displayValue:h,isAnimating:f}=Gi(e,{enabled:l&&!i});useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),useEffect(()=>{p(e?.toString()||"");},[e]);let b=()=>{let C=parseFloat(d);if(!isNaN(C)){let N=C;o!==void 0&&(N=Math.max(o,N)),s!==void 0&&(N=Math.min(s,N)),N!==e&&(t?.(N),c&&x());}m(false);},w=C=>{C.key==="Enter"?b():C.key==="Escape"&&(p(e?.toString()||""),m(false));};return n||!t?jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500",f&&"font-medium"),children:h!==void 0?h:r}):i?jsx("input",{ref:g,type:"number",value:d,onChange:C=>p(C.target.value),onBlur:b,onKeyDown:w,onClick:C=>C.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white":"bg-white border-[#007BFF] text-gray-900")}):jsx("button",{onClick:C=>{C.stopPropagation(),m(true);},className:u("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"),y&&(a?"bg-green-500/30":"bg-green-500/20"),f&&"font-medium scale-105"),children:h!==void 0?h:r})}function rg({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=useState(false),c=useRef(null);return useEffect(()=>{let i=m=>{c.current&&!c.current.contains(m.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsx("span",{className:u("text-sm",r?"text-white/60":"text-gray-500"),children:e||o}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:u("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:u("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||o}),jsx(ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),n&&jsx("div",{className:u("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:u("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:m=>{m.stopPropagation(),a(i),l(false);},className:u("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsx(Check,{className:"w-4 h-4 text-[#007BFF]"})]},i))})]})}function ng({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:l,progress:c,startChange:i,cancelChange:m}=qm(t,{delay:s}),d=g=>{g.stopPropagation(),!r&&t&&(o?l?m():i(!e):t(!e));},p=l?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:d,disabled:r||!t,className:u("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",p?"bg-[#007BFF] border-[#007BFF]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&p&&"ring-green-500/50",l&&!p&&"ring-red-500/50",l&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[l&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsx("button",{onClick:g=>{g.stopPropagation(),m();},className:u("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 lg({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:u("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[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)),o>0&&jsxs("span",{className:u("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:["+",o]})]})}function W2(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 G2(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 o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function Dr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:l=false,lens:c="hours",hourlyRate:i=0}){let[m,d]=useState(false),[p,g]=useState(""),y=useRef(null),{isFlashing:x,triggerFlash:h}=Hn(),f=c==="financial"&&i>0,b=f&&e?`$${Math.round(e/60*i).toLocaleString("en-US")}`:W2(e,r);useEffect(()=>{m&&y.current&&(y.current.focus(),y.current.select());},[m]),useEffect(()=>{if(e){let T=Math.floor(e/60),k=e%60;T>0&&k>0?g(`${T}h ${k}m`):T>0?g(`${T}h`):g(`${k}m`);}else g("");},[e,m]);let w=()=>{let T=G2(p);T!==e&&(t?.(T),n&&h()),d(false);},C=T=>{T.key==="Enter"?w():T.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:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:u("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 N=f?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsx(N,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:u("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:b})]}):m?jsx("input",{ref:y,type:"text",value:p,onChange:T=>g(T.target.value),onBlur:w,onKeyDown:C,onClick:T=>T.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#007BFF] text-white placeholder:text-white/30":"bg-white border-[#007BFF] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:T=>{T.stopPropagation(),d(true);},className:u("flex items-center justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",x&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(N,{className:u("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:b})]})}function pg({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:o="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:u("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let n=c=>c.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),l=()=>{if(a==null)return null;let c=o==="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:u("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?n(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?n(t):"\u2014"]}),l()]})}function gg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:o,onSoldEffortUpdate:s,onOpenTimeLog:n,lens:l="hours",hourlyRate:c=0}){let i=a==="es",m=l==="financial"&&c>0,d=Z=>m?`$${Math.round(Z*c).toLocaleString("en-US")}`:`${Z}h`,[p,g]=useState(false),[y,x]=useState(false),[h,f]=useState(null),b=useRef(null),w=e.timeLoggedMinutes||0,C=e.effortMinutes||0,N=e.soldEffortMinutes||0,T=Math.round(w/60*10)/10,k=Math.round(C/60*10)/10,v=C>0?w/C*100:0,E=v>100?Math.round((w-C)/60*10)/10:0,I=v>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!y&&!h)return;let Z=Ee=>{b.current&&!b.current.contains(Ee.target)&&(x(false),f(null));};return document.addEventListener("mousedown",Z),()=>document.removeEventListener("mousedown",Z)},[y,h]);let S=Z=>{if(Z.stopPropagation(),r&&!o&&!s){f("log");return}if(r||o||s){x(Ee=>!Ee),f(null);return}n&&n(e);},X=Z=>{x(false),f(Z);},O=async(Z,Ee)=>{h==="log"&&r&&Z?r(e,Z,Ee):h==="estimate"&&o?o(e,Z):h==="quoted"&&s&&s(e,Z),f(null);},$=r||o||s||n,F=[{mode:"log",icon:Clock,label:i?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:i?"Estimaci\xF3n":"Estimate",show:!!o},{mode:"quoted",icon:DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(Z=>Z.show),Y=h==="estimate"?C:h==="quoted"?N:void 0;return C===0&&w===0&&N===0?jsxs("div",{ref:b,className:"relative flex items-center gap-2",onClick:Z=>Z.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsx("span",{className:u("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),p&&$&&jsx("button",{onClick:S,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:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Z.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Z.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&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(Z=>jsxs("button",{onClick:Ee=>{Ee.stopPropagation(),X(Z.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:Ee=>{Ee.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ee=>{Ee.target.style.background="transparent";},children:[jsx(Z.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Z.label]},Z.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(oo,{mode:h,locale:a,isDark:t,currentValue:Y||void 0,onSave:O,onClose:()=>f(null)})})})})]}):jsxs("div",{ref:b,className:"relative flex items-center gap-2 w-full",onClick:Z=>Z.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:t?"#FFFFFF":"#111827"},children:d(T)}),C>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(k)]}),E>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:"#EF4444",backgroundColor:"rgba(239,68,68,0.15)"},children:["+",d(E)," ",i?"Excedido":"Over"]})]}),C>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(v,100)}%`,backgroundColor:I,borderRadius:2,transition:"width 0.3s"}})})]}),$&&jsx("button",{onClick:S,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:p?1:0,pointerEvents:p?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Z.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Z=>{Z.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Z.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&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(Z=>jsxs("button",{onClick:Ee=>{Ee.stopPropagation(),X(Z.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:Ee=>{Ee.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ee=>{Ee.target.style.background="transparent";},children:[jsx(Z.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Z.label]},Z.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(oo,{mode:h,locale:a,isDark:t,currentValue:Y||void 0,onSave:O,onClose:()=>f(null)})})})})]})}function X2(e){let t=new Map;function a(r){if(r.assignees)for(let o of r.assignees)o.name&&!t.has(o.name)&&t.set(o.name,o);if(r.subtasks)for(let o of r.subtasks)a(o);}return a(e),Array.from(t.values())}function J2(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 fg({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",o=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:u(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsx("div",{className:u(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",o,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function bg({task:e,isDark:t,locale:a="en"}){let r=a==="es",o=!!e.hasChildren,s=e.assignees?.[0],n=e.teamLoad;if(o){let m=X2(e);if(m.length===0)return null;let d=m.slice(0,3),p=m.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:d.map((g,y)=>jsx(fg,{assignee:g,size:24,isDark:t},g.name+y))}),p>0&&jsxs("span",{className:u("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:m.slice(3).map(g=>g.name).join(", "),children:["+",p]})]})}if(!s)return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:u("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:u("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let l=n?.percentage??0,c=!!n&&l>0,i=c?J2(l):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(fg,{assignee:s,size:28,isDark:t}),jsx("span",{className:u("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 Q2={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function yg({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:u("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,o)=>jsxs("span",{className:u("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",Q2[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${o}`))})}function m1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function g1(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 Tg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:m=[],onOpenTimeLog:d,onReportBlocker:p,onCopyTaskLink:g,onTaskMove:y,onTaskIndent:x,onTaskOutdent:h}){let f=useRef(null),b=r==="es"?wg.es:wg.en;if(useEffect(()=>{let k=E=>{f.current&&!f.current.contains(E.target)&&t();},v=E=>{E.key==="Escape"&&t();};return document.addEventListener("mousedown",k),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",v);}},[t]),!e.isOpen)return null;let w=()=>{if(!e.task)return [];let k=[];return o&&k.push({id:"edit",label:b.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),k.push({id:"sep1",label:"",icon:null,separator:true}),l&&(k.push({id:"status",label:b.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:b.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:b.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:b.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),k.push({id:"priority",label:b.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:b.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:b.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:b.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:b.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),m.length>0&&k.push({id:"assign",label:b.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:m.slice(0,5).map(v=>({id:`assign-${v.id}`,label:v.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:v.name.charAt(0).toUpperCase()}),onClick:()=>{let E=e.task.assignees||[],S=E.some(X=>X.name===v.name)?E.filter(X=>X.name!==v.name):[...E,{name:v.name,initials:m1(v.name),color:v.color||g1(v.name),avatar:v.avatarUrl}];l({...e.task,assignees:S}),t();}}))})),d&&k.push({id:"log-time",label:b.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),p&&k.push({id:"report-blocker",label:b.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),g&&k.push({id:"copy-link",label:b.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),k.push({id:"sep2",label:"",icon:null,separator:true}),s&&k.push({id:"duplicate",label:b.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(y||x||h)&&(k.push({id:"sep3",label:"",icon:null,separator:true}),y&&(k.push({id:"move-up",label:b.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"up"),t();}}),k.push({id:"move-down",label:b.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{y(e.task.id,"down"),t();}})),x&&k.push({id:"indent",label:b.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),h&&k.push({id:"outdent",label:b.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),n&&k.push({id:"delete",label:b.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),k},C=()=>{if(!e.columnId)return [];let k=[];return i&&(k.push({id:"sort-asc",label:b.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),k.push({id:"sort-desc",label:b.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(k.push({id:"sep-hide",label:"",icon:null,separator:true}),k.push({id:"hide",label:b.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),k},N=e.type==="task"?w():C(),T={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:f,style:T,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:N.map(k=>k.separator?jsx("div",{className:u("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},k.id):k.submenu?jsx(f1,{item:k,isDark:a},k.id):jsxs("button",{onClick:k.onClick,className:u("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",k.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:u(k.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:k.icon}),k.label]},k.id))})}function f1({item:e,isDark:t}){let[a,r]=useState(false),o=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:u("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:u("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:u("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:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var wg={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var Ag={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"})},A1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function Ig({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[c,i]=useState(""),[m,d]=useState(null),[p,g]=useState(null),y=useRef(null),x=l==="es"?Lg.es:Lg.en;useLayoutEffect(()=>{if(!e||!y.current)return;let k=()=>{if(!y.current)return;let v=y.current.parentElement;if(v){let X=v.getBoundingClientRect();g({top:X.bottom+4,right:window.innerWidth-X.right});}let E=y.current.getBoundingClientRect(),S=window.innerHeight-E.top-20;d(Math.max(300,S));};return requestAnimationFrame(k),window.addEventListener("resize",k),()=>window.removeEventListener("resize",k)},[e]),useEffect(()=>{if(!e)return;let k=setTimeout(()=>{let v=I=>{y.current&&!y.current.contains(I.target)&&t();},E=I=>{I.key==="Escape"&&t();};document.addEventListener("mousedown",v),document.addEventListener("keydown",E),y._cleanup=()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",E);};},100);return ()=>{clearTimeout(k),y._cleanup&&y._cleanup();}},[e,t]);let h=useMemo(()=>{let k=new Set([...A1]);return a.forEach(v=>{v.type&&v.type!=="assignees"&&k.add(v.type);}),Array.from(k)},[a]);if(!e)return null;let f=k=>{let v=x.columns[k];if(v)return v;let E=a.find(I=>I.type===k);return E?.label?E.label:k},b=k=>{if(k==="name")return;let v=a.map(E=>E.id===k?{...E,visible:!E.visible}:E);o(v);},w=(k,v)=>{let E=a.find(S=>S.type===k&&(!v||S.customFieldId===v));if(E){b(E.id);return}let I={id:v||k,type:k,label:v?r.find(S=>S.id===v)?.name||k:f(k),width:120,visible:true,sortable:true,resizable:true,customFieldId:v};o([...a,I]);},C=h.filter(k=>k!=="assignees"&&f(k).toLowerCase().includes(c.toLowerCase())),N=r.filter(k=>k.name.toLowerCase().includes(c.toLowerCase())),T=n?"#00E5FF":"#2E94FF";return jsxs("div",{ref:y,style:{...m?{maxHeight:`${m}px`}:{},...p?{top:p.top,right:p.right}:{},background:n?"#111114":"#FFFFFF",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:n?"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 ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:n?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:x.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",k.currentTarget.style.color=n?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:k=>{k.currentTarget.style.backgroundColor="transparent",k.currentTarget.style.color=n?"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:n?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:c,onChange:k=>i(k.target.value),placeholder:x.searchPlaceholder,style:{fontSize:12,background:n?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:n?"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:k=>{k&&k.style.setProperty("--focus-border",T);},onFocus:k=>{k.currentTarget.style.borderColor=T,k.currentTarget.style.background=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:k=>{k.currentTarget.style.borderColor=n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",k.currentTarget.style.background=n?"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:k=>k.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:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:x.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:C.map(k=>{let v=a.find(S=>S.type===k&&!S.customFieldId),E=v?.visible??false,I=k==="name";return jsxs("button",{onClick:()=>{I||(v?b(v.id):w(k));},disabled:I,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:I?.4:1,cursor:I?"not-allowed":"pointer"},onMouseEnter:S=>{I||(S.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:E?T:"transparent",border:E?`1.5px solid ${T}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:E?`0 0 6px ${T}40`:"none"},children:E&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:E?T:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Ag[k]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:E?500:400,color:E?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:f(k),children:f(k)})]},k)})})]}),N.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:n?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:x.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:N.map(k=>{let E=a.find(I=>I.customFieldId===k.id)?.visible??false;return jsxs("button",{onClick:()=>w(k.type,k.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:I=>{I.currentTarget.style.backgroundColor=n?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:I=>{I.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:E?T:"transparent",border:E?`1.5px solid ${T}`:`1.5px solid ${n?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:E?`0 0 6px ${T}40`:"none"},children:E&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:E?T:n?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:Ag[k.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:E?500:400,color:E?n?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":n?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:k.name})]},k.id)})})]})]})]})}var Lg={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var U1=[{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 Og({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[l,c]=useState("text"),[i,m]=useState([""]),d=o==="es"?Rg.es:Rg.en;useEffect(()=>{e&&(n(""),c("text"),m([""]));},[e]),useEffect(()=>{let h=f=>{f.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let p=()=>{if(!s.trim())return;let h={name:s.trim(),type:l};l==="dropdown"&&(h.options=i.filter(f=>f.trim())),a(h),t();},g=()=>{m([...i,""]);},y=(h,f)=>{let b=[...i];b[h]=f,m(b);},x=h=>{i.length>1&&m(i.filter((f,b)=>b!==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:u("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:u("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:u("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:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsx("input",{type:"text",value:s,onChange:h=>n(h.target.value),placeholder:d.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/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:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:U1.map(h=>jsxs("button",{onClick:()=>c(h.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===h.type?"border-[#007BFF] bg-[#007BFF]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:l===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-400",children:h.icon}),jsx("span",{className:u("text-xs",l===h.type?"text-[#007BFF]":r?"text-white/60":"text-gray-500"),children:d.types[h.type]})]},h.type))})]}),l==="dropdown"&&jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxs("div",{className:"space-y-2",children:[i.map((h,f)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:h,onChange:b=>y(f,b.target.value),placeholder:`${d.option} ${f+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsx("button",{onClick:()=>x(f),className:u("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"})})]},f)),jsxs("button",{onClick:g,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#007BFF] hover:bg-white/[0.05]":"text-blue-600 hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxs("div",{className:u("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:u("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:d.cancel}),jsx("button",{onClick:p,disabled:!s.trim(),className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#007BFF] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var Rg={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 zg={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 Ug({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=useState(false),c=useRef(null),i=useRef(0),m=s==="es"?zg.es:zg.en;useEffect(()=>{if(!n)return;let g=x=>{Date.now()-i.current<100||c.current&&!c.current.contains(x.target)&&l(false);},y=x=>{x.key==="Escape"&&l(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y);}},[n]);let d=[{value:"all",label:m.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}),color:"text-[#007BFF]"},{value:"completed",label:m.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:m.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:m.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),n||(i.current=Date.now()),l(y=>!y);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",o?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#2E94FF]/20 border-[#2E94FF]/50 text-[#2E94FF]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),m.filters,p&&jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#2E94FF]":"bg-blue-500")})]}),n&&jsxs("div",{className:u("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:u("px-4 py-3 border-b",o?"border-[#222]":"border-gray-200"),children:jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-white/30":"text-gray-400"),children:m.filterByStatus})}),jsx("div",{className:"py-2",children:d.map(g=>{let y=e===g.value&&!t,x=()=>g.value==="all"?y?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#007BFF] bg-[#007BFF]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxs("button",{onClick:()=>{a(g.value),r(false),l(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:u(y?g.color:"text-gray-400","flex-shrink-0"),children:x()}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:g.label}),y&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]},g.value)})}),jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),l(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(o?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#007BFF]":"text-blue-500":o?"text-white/30":"text-gray-400")}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:m.hideCompleted}),t&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#007BFF]":"text-blue-500")})]})})]})]})}function Wg(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 Ns(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function Gg({data:e,isDark:t,locale:a="en",onClose:r,lens:o="hours",onUnassignedTaskClick:s}){let n=a==="es",l=o==="financial";return jsxs("div",{className:u("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:u("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:u("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:l?n?"SALUD FINANCIERA":"FINANCIAL HEALTH":n?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsx("button",{onClick:r,className:u("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:n?"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,m=e.totalExecuted??0,d=c-i,p=c>0?Math.round(d/c*100):0,g=c>0?Math.min(Math.round(i/c*100),120):0,y=i>c&&c>0,x=y?"#F87171":"#00E5CC";return jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"PRESUPUESTO":"BUDGET"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Ofertado":"Offered"}),jsx("span",{className:u("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Ns(c)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Estimado":"Estimated"}),jsx("span",{className:u("text-[11px] font-mono font-bold",y?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Ns(i)})]}),m>0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Ejecutado":"Executed"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Ns(m)})]}),c>0&&jsx("div",{className:u("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(g,100)}%`,backgroundColor:x}})}),jsxs("div",{className:u("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",d>=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:[d>=0?`+${Ns(d)} ${n?"Disp.":"Avail."}`:`${Ns(Math.abs(d))} ${n?"P\xE9rdida":"Loss"}`,c>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",p,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let c=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,m=i>0?Math.min(Math.round(c/i*100),100):0,d=c>i&&i>0,p=d?"#F87171":m>=80?"#FFD60A":"#3BF06E";return jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Usado":"Spent"}),jsx("span",{className:u("text-[11px] font-mono font-bold",d?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Wg(c)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Asignado":"Allocated"}),jsx("span",{className:u("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:Wg(i)})]}),i>0&&jsx("div",{className:u("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:`${m}%`,backgroundColor:p}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"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:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:u("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:u("text-xs",t?"text-white/60":"text-gray-600"),children:n?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:u("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:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsx("div",{className:u("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:u("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?n?"tarea pendiente":"pending task":n?"tareas pendientes":"pending tasks"}),jsx("p",{className:u("text-[10px]",t?"text-white/40":"text-gray-400"),children:n?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsx("div",{className:u("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:u("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:u("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:u("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:u("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:n?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let c=e.scheduleVarianceDays??0,i=c>0,m=c<0,d=e.scheduleVarianceLabel||(i?`+${c} ${n?"D\xEDas ADELANTE":"Days AHEAD"}`:m?`${c} ${n?"D\xEDas ATR\xC1S":"Days BEHIND"}`:n?"EN TIEMPO":"ON TRACK");return jsx("div",{className:u("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",m&&"bg-[#F87171]/15 text-[#F87171]",!i&&!m&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:d})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:u("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:n?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((c,i)=>{let m=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:u("text-xs",t?"text-white/60":"text-gray-600"),children:c.name}),jsxs("span",{className:u("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[c.utilizationPercent,"%"]})]}),jsx("div",{className:u("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:m}})})]},`${c.name}-${i}`)})})]})]})}var rw=[{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 Yg(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...Yg(r.subtasks,t+1));return a}function ow(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,o=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let n=s.startDate.getTime(),c=s.endDate.getTime()-n;if(c<=0)continue;let m=Math.max(0,Math.min(a.getTime()-n,c))/c*100;if(m<=0)continue;let d=(s.progress||0)/m;r+=d,o++;}return o>0?r/o:null}function Vn(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let o of e.subtasks)if(o.subtasks?.length){let s=Vn(o);t+=s.spent>0?s.spent:o.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:o.effortMinutes??0,r+=s.quoted>0?s.quoted:o.soldEffortMinutes??0;}else t+=o.timeLoggedMinutes??0,a+=o.effortMinutes??0,r+=o.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Gn(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 nw({value:e,onChange:t,isDark:a}){let[r,o]=useState(false),[s,n]=useState(String(e||""));return r?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:l=>l.stopPropagation(),onChange:l=>n(l.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let l=parseFloat(s);!isNaN(l)&&l>=0&&l<=100?t(l):s===""&&t(0),o(false);},onKeyDown:l=>{l.key==="Enter"&&l.target.blur(),l.key==="Escape"&&(n(String(e||"")),o(false));},className:u("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-blue-400 text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:l=>{l.stopPropagation(),n(String(e||"")),o(true);},className:u("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 Xg({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:c=[],toolbarRightContent:i}){let{theme:m="dark",locale:d="en",customTranslations:p,showSearch:g=true,showHierarchy:y=true,tableColumns:x,allowColumnCustomization:h=true,allowColumnResize:f=true,enableContextMenu:b=true,showCreateTaskButton:w=false,onCreateTask:C,persistFilter:N=false,financialBlur:T,healthSidebar:k,lens:v="hours",hourlyRate:E=0,rateMap:I,aggregateParentHours:S=false,showProjectTotals:X=false}=t,O=Hi(d,p),$=m==="dark",F=M=>{if(!I||!M.assignees||M.assignees.length===0)return E;let se=M.assignees.map(xe=>xe.id?I[xe.id]:void 0).filter(xe=>xe!=null&&xe>0);return se.length===0?E:se.reduce((xe,Ce)=>xe+Ce,0)/se.length},Y=M=>{let se=0,xe=0,Ce=0,Ke=ot=>{for(let he of ot)if(he.subtasks&&he.subtasks.length>0){let We={s:se,a:xe,q:Ce};if(Ke(he.subtasks),se-We.s+(xe-We.a)+(Ce-We.q)===0){let St=F(he);se+=(he.timeLoggedMinutes??0)/60*St,xe+=(he.effortMinutes??0)/60*St,Ce+=(he.soldEffortMinutes??0)/60*St;}}else {let We=F(he);se+=(he.timeLoggedMinutes??0)/60*We,xe+=(he.effortMinutes??0)/60*We,Ce+=(he.soldEffortMinutes??0)/60*We;}};return M.subtasks&&Ke(M.subtasks),{dollarSpent:se,dollarAllocated:xe,dollarQuoted:Ce}},Z=useCallback(()=>{if(!N||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let M=localStorage.getItem(N);if(M){let se=JSON.parse(M);return {statusFilter:se.statusFilter||"all",hideCompleted:se.hideCompleted||!1}}}catch(M){console.error("Error loading persisted filter:",M);}return {statusFilter:"all",hideCompleted:false}},[N]),Ee=useMemo(()=>{function M(se){let xe=0,Ce=0,Ke=0,ot=0,he=0,We=0;for(let mt of se)if(mt.subtasks&&mt.subtasks.length>0){let St=M(mt.subtasks);if(St.spent+St.allocated+St.quoted>0)xe+=St.spent,Ce+=St.allocated,Ke+=St.quoted,ot+=St.dollarSpent,he+=St.dollarAllocated,We+=St.dollarQuoted;else {let Et=mt.timeLoggedMinutes??0,Ct=mt.effortMinutes??0,sa=mt.soldEffortMinutes??0;xe+=Et,Ce+=Ct,Ke+=sa;let aa=F(mt);ot+=Et/60*aa,he+=Ct/60*aa,We+=sa/60*aa;}}else {let St=mt.timeLoggedMinutes??0,Lt=mt.effortMinutes??0,Et=mt.soldEffortMinutes??0;xe+=St,Ce+=Lt,Ke+=Et;let Ct=F(mt);ot+=St/60*Ct,he+=Lt/60*Ct,We+=Et/60*Ct;}return {spent:xe,allocated:Ce,quoted:Ke,dollarSpent:ot,dollarAllocated:he,dollarQuoted:We}}return M(e)},[e]),R=useMemo(()=>{let M=new Map;function se(xe){let Ce=0;for(let Ke of xe)if(Ke.subtasks&&Ke.subtasks.length>0){let ot=se(Ke.subtasks);M.set(Ke.id,ot),Ce+=ot;}else Ce+=Ke.weight||0;return Ce}return se(e),M},[e]),_=useMemo(()=>!k?.enabled||!k.data?k:{...k,data:{...k.data,totalHoursSpentMinutes:Ee.spent,totalHoursAllocatedMinutes:Ee.allocated}},[k,Ee]),[ye,Je]=useState(true),[z,re]=useState(null),[J,Ae]=useState("position"),[ve,ze]=useState("asc"),[Be,st]=useState(""),[ee,it]=useState(()=>Z().statusFilter),[de,lt]=useState(()=>Z().hideCompleted),[rt,At]=useState(x||rw),[we,vt]=useState(false),[gt,tt]=useState(false),[H,le]=useState({isOpen:false,x:0,y:0,type:"task"}),[D,K]=useState(null),[pe,Te]=useState(false),[G,te]=useState(null),[Re,De]=useState(null),[Ue,Fe]=useState(null),_e=useRef(0),ft=useRef(false),dt=!!(a.onTaskMove||a.onTaskReparent),ut=useCallback((M,se)=>{dt&&(se.preventDefault(),_e.current=se.clientY,K(M),ft.current=false,Te(false),Fe({x:se.clientX,y:se.clientY}));},[dt]),at=useCallback(M=>{if(!D||(Math.abs(M.clientY-_e.current)>5&&!ft.current&&(ft.current=true,Te(true)),Fe({x:M.clientX,y:M.clientY}),!ft.current))return;let xe=document.querySelectorAll("[data-listview-row]"),Ce=null,Ke=null;xe.forEach(ot=>{let he=ot.getBoundingClientRect(),We=ot.getAttribute("data-listview-row");if(We&&We!==D&&M.clientY>=he.top&&M.clientY<=he.bottom){Ce=We;let mt=M.clientY-he.top,St=he.height;Ke=mt<St*.25?"above":mt>St*.75?"below":"child";}}),te(Ce),De(Ke);},[D]),Vt=useCallback(()=>{if(ft.current&&D&&G&&Re){if(Re==="child"&&a.onTaskReparent)a.onTaskReparent(D,G);else if(Re==="above"||Re==="below"){let M=(Ce,Ke,ot=null)=>{for(let he of Ce){if(he.id===Ke)return ot;if(he.subtasks){let We=M(he.subtasks,Ke,he.id);if(We!==void 0)return We}}},se=M(e,D,null),xe=M(e,G,null);if(a.onTaskReparent){let Ce=(St,Lt)=>{if(Lt===null)return St;for(let Et of St){if(Et.id===Lt)return Et.subtasks||[];if(Et.subtasks){let Ct=Ce(Et.subtasks,Lt);if(Ct.length>0||Et.subtasks.some(sa=>sa.id===Lt))return Ct}}return []},Ke=Ce(e,xe??null),ot=Ke.findIndex(St=>St.id===G),he=se===xe,We=he?Ke.findIndex(St=>St.id===D):-1,mt=Re==="below"?ot+1:ot;he&&We!==-1&&We<ot&&(mt-=1),a.onTaskReparent(D,xe??null,Math.max(0,mt));}}}K(null),te(null),De(null),Fe(null),ft.current=false,Te(false);},[D,G,Re,e,a]);useEffect(()=>{if(D)return document.addEventListener("mousemove",at),document.addEventListener("mouseup",Vt),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",at),document.removeEventListener("mouseup",Vt),document.body.style.cursor="",document.body.style.userSelect="";}},[D,at,Vt]);let[Mt,Dt]=useState("all"),[wt,bt]=useState(false),Ut=useRef(null),Ge=useRef(null),Le=useMemo(()=>{let M=0;function se(xe,Ce){for(let Ke of xe)Ce>M&&(M=Ce),Ke.subtasks?.length&&se(Ke.subtasks,Ce+1);}return se(e,1),M},[e]);useEffect(()=>{if(!wt)return;let M=se=>{Ut.current?.contains(se.target)||Ge.current?.contains(se.target)||bt(false);};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[wt]),useEffect(()=>{if(Mt==="all"){let xe=function(Ce){for(let Ke of Ce)Ke.subtasks?.length&&(Ke.isExpanded===false&&a.onTaskToggleExpand?.(Ke.id),xe(Ke.subtasks));};xe(e);}else {let xe=function(Ce,Ke){for(let ot of Ce)if(ot.subtasks?.length){let he=Ke<Mt,We=ot.isExpanded!==false;he!==We&&a.onTaskToggleExpand?.(ot.id),xe(ot.subtasks,Ke+1);}};xe(e,1);}},[Mt]);let[nt,oe]=useState(null),[fe,L]=useState(0),[j,q]=useState(0),me=useRef(null),[Ne,Xe]=useState(null),[je,Oe]=useState(null);useEffect(()=>{x&&At(M=>{if(M.length===x.length){let se=true;for(let xe=0;xe<M.length;xe++){let Ce=M[xe],Ke=x[xe];if(!Ce||!Ke||Ce.id!==Ke.id||Ce.visible!==Ke.visible||Ce.width!==Ke.width||Ce.label!==Ke.label){se=false;break}}if(se)return M}return x});},[x]),useEffect(()=>{if(!(!N||typeof window>"u"))try{localStorage.setItem(N,JSON.stringify({statusFilter:ee,hideCompleted:de}));}catch(M){console.error("Error persisting filter state:",M);}},[N,ee,de]);let kt=useMemo(()=>{let M=new Set;function se(xe){for(let Ce of xe)Ce.subtasks?.length&&(Ce.isExpanded!==false&&M.add(Ce.id),se(Ce.subtasks));}return se(e),M},[e]),pt=useMemo(()=>rt.filter(M=>M.visible),[rt]),Wt=useCallback(M=>{a.onTaskToggleExpand?.(M);},[a]),Ta=useCallback(M=>{J===M?ze(se=>se==="asc"?"desc":"asc"):(Ae(M),ze("asc")),a.onSortChange?.({column:M,direction:ve==="asc"?"desc":"asc"});},[J,ve,a]),Xt=useCallback(M=>{At(M),a.onColumnsChange?.(M);},[a]),U=useCallback(M=>{let se=rt.map(xe=>xe.id===M?{...xe,visible:false}:xe);Xt(se);},[rt,Xt]),ne=useCallback((M,se)=>{Ae(M),ze(se);},[]),$e=useCallback((M,se,xe)=>{b&&(M.preventDefault(),le({isOpen:true,x:M.clientX,y:M.clientY,type:se?"task":"header",task:se,columnId:xe}));},[b]),A=useCallback(()=>{le(M=>({...M,isOpen:false}));},[]),ge=useCallback((M,se)=>{if(!f)return;M.preventDefault(),M.stopPropagation();let xe=rt.find(Ce=>Ce.id===se);xe&&(oe(se),L(M.clientX),q(xe.width));},[rt,f]);useEffect(()=>{if(!nt)return;let M=rt,se=Ce=>{let Ke=Ce.clientX-fe,ot=Math.max(50,j+Ke);M=M.map(he=>he.id===nt?{...he,width:ot}:he),At(M);},xe=()=>{a.onColumnsChange?.(M),oe(null);};return document.addEventListener("mousemove",se),document.addEventListener("mouseup",xe),()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",xe);}},[nt,fe,j,a]);let Ve=useCallback((M,se)=>{if(se==="name"){M.preventDefault();return}Xe(se),M.dataTransfer.effectAllowed="move",M.dataTransfer.setData("text/plain",se),M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="0.5");},[]),Ze=useCallback(M=>{M.currentTarget instanceof HTMLElement&&(M.currentTarget.style.opacity="1"),Xe(null),Oe(null);},[]),na=useCallback((M,se)=>{M.preventDefault(),se!=="name"&&(M.dataTransfer.dropEffect="move",Oe(se));},[]),jt=useCallback(()=>{Oe(null);},[]),La=useCallback((M,se)=>{if(M.preventDefault(),!Ne||Ne===se||se==="name")return;let xe=[...rt],Ce=xe.findIndex(he=>he.id===Ne),Ke=xe.findIndex(he=>he.id===se);if(Ce===-1||Ke===-1)return;let ot=xe.splice(Ce,1);ot[0]&&(xe.splice(Ke,0,ot[0]),Xt(xe),Xe(null),Oe(null));},[Ne,rt,Xt]),qa=useCallback(async M=>{if(a.onCreateCustomField){let se={...M,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(se);}tt(false);},[a]),Ia=useCallback(M=>M.progress===100||M.status==="completed"?"completed":M.progress&&M.progress>0||M.status==="in-progress"?"in-progress":"todo",[]),ga=useMemo(()=>{let M=Yg(e);if(Be.trim()){let se=Be.toLowerCase();M=M.filter(xe=>xe.name.toLowerCase().includes(se));}return ee!=="all"&&(M=M.filter(se=>Ia(se)===ee)),de&&(M=M.filter(se=>Ia(se)!=="completed")),M.sort((se,xe)=>{let Ce,Ke;switch(J){case "name":Ce=se.name.toLowerCase(),Ke=xe.name.toLowerCase();break;case "startDate":Ce=se.startDate?.getTime()||0,Ke=xe.startDate?.getTime()||0;break;case "endDate":Ce=se.endDate?.getTime()||0,Ke=xe.endDate?.getTime()||0;break;case "progress":Ce=se.progress||0,Ke=xe.progress||0;break;case "status":Ce=se.status||"todo",Ke=xe.status||"todo";break;case "priority":let ot={urgent:0,high:1,medium:2,low:3,none:4};Ce=ot[se.priority]??4,Ke=ot[xe.priority]??4;break;case "position":return 0;default:return 0}return Ce<Ke?ve==="asc"?-1:1:Ce>Ke?ve==="asc"?1:-1:0}),M},[e,Be,ee,de,J,ve,Ia]),cr=useCallback((M,se)=>{let xe=ot=>{a.onTaskUpdate?.({...M,...ot});},Ce=ot=>ot?M.customFields?.find(We=>We.fieldId===ot)?.value:void 0,Ke=(ot,he)=>{if(!ot)return;let mt=[...M.customFields||[]],St=mt.findIndex(Lt=>Lt.fieldId===ot);St>=0?mt[St]={fieldId:ot,value:he}:mt.push({fieldId:ot,value:he}),xe({customFields:mt});};switch(se.type){case "name":return null;case "status":return jsx(Hm,{value:M.status||(M.progress===100?"completed":M.progress&&M.progress>0?"in-progress":"todo"),onChange:he=>{xe({status:he,progress:he==="completed"?100:he==="in-progress"?50:0});},isDark:$,locale:d,translations:O.status});case "priority":return jsx(Um,{value:M.priority,onChange:he=>xe({priority:he}),isDark:$,locale:d});case "assignees":{let he=M.hasChildren,We=M.assignees||[];if(he&&M.subtasks?.length){let mt=new Map;(M.assignees||[]).forEach(Lt=>mt.set(Lt.name,Lt));let St=Lt=>{(Lt||[]).forEach(Et=>{(Et.assignees||[]).forEach(Ct=>{mt.has(Ct.name)||mt.set(Ct.name,Ct);}),Et.subtasks?.length&&St(Et.subtasks);});};St(M.subtasks),We=Array.from(mt.values());}return jsx(jd,{value:We,availableUsers:l,onChange:mt=>xe({assignees:mt}),isDark:$,locale:d,disabled:he})}case "startDate":return jsx(Wi,{value:M.startDate,onChange:he=>xe({startDate:he}),isDark:$,locale:d,dateField:"start",startDate:M.startDate,endDate:M.endDate});case "endDate":return jsx(Wi,{value:M.endDate,onChange:he=>xe({endDate:he}),isDark:$,locale:d,dateField:"end",startDate:M.startDate,endDate:M.endDate});case "progress":{let he=!!(M.subtasks&&M.subtasks.length>0);return jsx(Xm,{value:M.progress||0,onChange:he?void 0:We=>{let mt=We===100?"completed":We>0?"in-progress":"todo";xe({progress:We,status:mt});},isDark:$,disabled:he})}case "tags":return jsx(lg,{value:M.tags||[],isDark:$});case "text":return jsx(Zm,{value:Ce(se.customFieldId)||"",onChange:he=>Ke(se.customFieldId,he),isDark:$});case "number":return jsx(ag,{value:Ce(se.customFieldId)||0,onChange:he=>Ke(se.customFieldId,he),isDark:$});case "date":let ot=Ce(se.customFieldId);return jsx(Wi,{value:ot?new Date(ot):void 0,onChange:he=>Ke(se.customFieldId,he),isDark:$,locale:d});case "dropdown":return jsx(rg,{value:Ce(se.customFieldId)||"",options:se.options||[],onChange:he=>Ke(se.customFieldId,he),isDark:$});case "checkbox":return jsx(ng,{value:Ce(se.customFieldId)||false,onChange:he=>Ke(se.customFieldId,he),isDark:$});case "estimatedTime":{let he=M.status==="completed"||M.progress===100;return jsx(Dr,{value:M.estimatedTime,onChange:We=>xe({estimatedTime:We}),isDark:$,locale:d,disabled:he,lens:v,hourlyRate:F(M)})}case "quotedTime":{let he=M.status==="completed"||M.progress===100,We=T?.enabled&&(!T.columns||T.columns.includes("quotedTime"));return jsx(Dr,{value:M.quotedTime,onChange:mt=>xe({quotedTime:mt}),isDark:$,locale:d,disabled:he,isBlurred:We,lens:v,hourlyRate:F(M)})}case "elapsedTime":{let he=M.status==="completed"||M.progress===100;return jsx(Dr,{value:M.elapsedTime,onChange:We=>xe({elapsedTime:We}),isDark:$,locale:d,disabled:he,lens:v,hourlyRate:F(M)})}case "effortMinutes":{if(S&&M.subtasks&&M.subtasks.length>0){let{allocated:Lt}=Vn(M);if(v==="financial"){let Et=Y(M),Ct=Math.round(Et.dollarAllocated),sa=Math.round(Et.dollarQuoted),aa=sa-Ct;return jsxs("div",{className:"flex flex-col",children:[Ct>0?jsxs("span",{className:u("text-sm font-mono",$?"text-white/60":"text-gray-500"),children:["$",Ct.toLocaleString("es-CO")]}):null,aa!==0&&Ct>0&&sa>0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",aa>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[aa>0?"+":"",Math.abs(aa)>=1e3?`$${(aa/1e3).toFixed(1)}K`:`$${aa}`]})]})}return jsx(Dr,{value:Lt>0?Lt:void 0,isDark:$,locale:d,disabled:true,lens:v,hourlyRate:E})}let he=M.status==="completed"||M.progress===100,We=M.effortMinutes||0,mt=M.soldEffortMinutes||0,St=F(M);if(v==="financial"&&St&&We>0&&mt>0){let Lt=Math.round(We/60*St),Ct=Math.round(mt/60*St)-Lt;return jsxs("div",{className:"flex flex-col",children:[jsx(Dr,{value:We,onChange:sa=>xe({effortMinutes:sa}),isDark:$,locale:d,disabled:he,lens:v,hourlyRate:F(M)}),Ct!==0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ct>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ct>0?"+":"",Math.abs(Ct)>=1e3?`$${(Ct/1e3).toFixed(1)}K`:`$${Ct}`]})]})}return jsx(Dr,{value:We,onChange:Lt=>xe({effortMinutes:Lt}),isDark:$,locale:d,disabled:he,lens:v,hourlyRate:F(M)})}case "timeLoggedMinutes":{if(S&&M.subtasks&&M.subtasks.length>0){let{spent:We}=Vn(M);return jsx(Dr,{value:We>0?We:void 0,isDark:$,locale:d,disabled:true,lens:v,hourlyRate:F(M)})}let he=M.status==="completed"||M.progress===100;return jsx(Dr,{value:M.timeLoggedMinutes,onChange:a.onLogTime?We=>{a.onLogTime?.(M,We);}:void 0,isDark:$,locale:d,placeholder:d==="es"?"Agregar":"Add",disabled:he,lens:v,hourlyRate:F(M)})}case "soldEffortMinutes":{if(S&&M.subtasks&&M.subtasks.length>0){let{quoted:mt}=Vn(M),St=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx(Dr,{value:mt>0?mt:void 0,isDark:$,locale:d,disabled:true,isBlurred:St,lens:v,hourlyRate:F(M)})}let he=M.status==="completed"||M.progress===100,We=T?.enabled&&(!T.columns||T.columns.includes("soldEffortMinutes"));return jsx(Dr,{value:M.soldEffortMinutes,onChange:mt=>xe({soldEffortMinutes:mt}),isDark:$,locale:d,disabled:he,isBlurred:We,lens:v,hourlyRate:F(M)})}case "scheduleVariance":{let he=M.effortMinutes||0,We=M.soldEffortMinutes||0,mt=M.timeLoggedMinutes||0,St=he>0||We>0||mt>0;return jsx(pg,{startDate:M.startDate,endDate:M.endDate,scheduleVariance:M.scheduleVariance,isDark:$,locale:d,hasTimeAllocated:St})}case "hoursBar":{if(S&&M.hasChildren){let{spent:he,allocated:We,quoted:mt}=Vn(M),St=he>We&&We>0;return jsxs("span",{className:u("text-[11px] font-mono flex items-center gap-1.5",$?"text-white/50":"text-gray-500"),children:[jsx("span",{className:u("font-bold",St?"text-[#FF453A]":$?"text-white/80":"text-gray-800"),children:Gn(he)}),We>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:$?"text-white/60":"text-gray-600",children:Gn(We)})]}),mt>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:$?"text-amber-400/70":"text-amber-600",children:Gn(mt)})]})]})}return jsx(gg,{task:M,isDark:$,locale:d,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:v,hourlyRate:F(M)})}case "teamLoad":return M.hasChildren||M.subtasks&&M.subtasks.length>0?jsx(bg,{task:M,isDark:$,locale:d}):jsx(jd,{value:M.assignees||[],availableUsers:l,onChange:We=>{a.onTaskUpdate?.({...M,assignees:We});},isDark:$,locale:d});case "blockers":return jsx(yg,{blockers:M.blockers,isDark:$,locale:d});case "weight":{let he=R.get(M.id);if(he!==void 0)return jsx("span",{className:u("text-xs font-mono",he>0?$?"text-white/50":"text-gray-400":$?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:he>0?`${Number(he.toFixed(2))}%`:"\u2014"});let We=M.weight||0;return jsx(nw,{value:We,onChange:mt=>xe({weight:mt}),isDark:$})}default:return jsx("span",{className:u("text-sm",$?"text-white/60":"text-gray-500"),children:"-"})}},[a,$,d,l,O,S,R]),Kn=useCallback(M=>{let xe={name:O.columns.name,status:O.columns.status,priority:O.columns.priority,assignees:O.columns.assignees,startDate:O.columns.startDate,endDate:O.columns.endDate,progress:O.columns.progress,tags:O.columns.tags||(d==="es"?"Etiquetas":"Tags"),estimatedTime:O.columns.estimatedTime||(d==="es"?"Estimado":"Estimated"),quotedTime:O.columns.quotedTime||(d==="es"?"Ofertado":"Quoted"),elapsedTime:O.columns.elapsedTime||(d==="es"?"Ejecutado":"Executed"),soldEffortMinutes:O.columns.soldEffortMinutes||(d==="es"?"Ofertado":"Quoted"),effortMinutes:O.columns.effortMinutes||(d==="es"?"Estimado":"Estimated"),timeLoggedMinutes:O.columns.timeLoggedMinutes||(d==="es"?"Ejecutado":"Executed"),scheduleVariance:O.columns.scheduleVariance||(d==="es"?"Prog / Var":"Sched / Var"),hoursBar:O.columns.hoursBar||(d==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:O.columns.teamLoad||(d==="es"?"Equipo":"Team"),blockers:O.columns.blockers||(d==="es"?"Bloqueantes":"Blockers"),weight:O.columns.weight||(d==="es"?"Peso":"Weight")}[M.type]||M.label;return typeof xe=="string"?xe:String(xe||M.type)},[O,d]),zr=useMemo(()=>{let xe=pt.reduce((Ke,ot)=>Ke+ot.width,0)+(h?48:0),Ce={};for(let Ke of pt)Ce[Ke.id]=`${Ke.width/xe*100}%`;return Ce},[pt,h]);return r?jsx("div",{className:u("flex-1 flex items-center justify-center",$?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007BFF]"}),jsxs("p",{className:u("text-sm",$?"text-white/60":"text-gray-600"),children:[O.empty.noTasks,"..."]})]})}):o?jsx("div",{className:u("flex-1 flex items-center justify-center",$?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",$?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",$?"text-white/60":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",$?"bg-[#0D0D0D]":"bg-white",s),style:n,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#007BFF]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#007BFF]"})}),jsx("h3",{className:u("text-lg font-semibold mb-2",$?"text-white":"text-gray-900"),children:O.empty.noTasks}),jsx("p",{className:u("text-sm",$?"text-white/60":"text-gray-600"),children:O.empty.addFirstTask})]})}):jsxs("div",{ref:me,className:u($?"bg-[#0D0D0D]":"bg-white",nt&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...n},children:[jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",$?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:u("text-sm",$?"text-white/60":"text-gray-600"),children:[ga.length," ",O.pagination.tasks]}),g&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",$?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:Be,onChange:M=>st(M.target.value),placeholder:O.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#007BFF]/30",$?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),i&&jsx("div",{className:"flex items-center gap-2",children:i}),y&&Le>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:Ut,onClick:()=>bt(!wt),className:u("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",$?wt?"bg-blue-500/10 border-blue-500/40 text-blue-400":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":wt?"bg-blue-50 border-blue-300 text-blue-600":"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"}),Mt==="all"?d==="es"?"Todos":"All":`L${Mt}`]}),wt&&jsx("div",{ref:Ge,className:u("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",$?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:d==="es"?"Todos":"All"},...Array.from({length:Math.min(Le,5)},(M,se)=>({value:se+1,label:`L${se+1}`}))].map(M=>jsxs("button",{onClick:()=>{Dt(M.value),bt(false);},className:u("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",$?Mt===M.value?"bg-blue-500/10 text-blue-400":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":Mt===M.value?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:M.label}),Mt===M.value&&jsx("span",{className:"text-blue-400",children:"\u2713"})]},String(M.value)))})]}),jsx(Ug,{value:ee,hideCompleted:de,onChange:it,onHideCompletedChange:lt,isDark:$,locale:d}),_?.enabled&&_.data&&!ye&&jsx("button",{onClick:()=>Je(true),className:u("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",$?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:d==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,w&&C&&jsxs(motion.button,{onClick:C,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #007BFF 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:O.toolbar.newTask})]})]})}),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",$?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[dt&&jsx("div",{className:"w-5 flex-shrink-0"}),pt.map(M=>{let se=M.id!=="name",xe=je===M.id&&Ne!==M.id;return jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",$?"text-white/60":"text-gray-500",se&&"cursor-grab",M.type!=="name"&&"justify-center",Ne===M.id&&"opacity-50",xe&&($?"bg-[#007BFF]/20 border-l-2 border-l-[#007BFF]":"bg-blue-50 border-l-2 border-l-blue-400")),style:{width:zr[M.id],minWidth:M.minWidth},draggable:se,onDragStart:se?Ce=>Ve(Ce,M.id):void 0,onDragEnd:se?Ze:void 0,onDragOver:se?Ce=>na(Ce,M.id):void 0,onDragLeave:se?jt:void 0,onDrop:se?Ce=>La(Ce,M.id):void 0,onContextMenu:Ce=>$e(Ce,void 0,M.id),children:[se&&jsx(GripVertical,{className:u("w-3 h-3 flex-shrink-0 transition-opacity",$?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),M.sortable?jsxs("button",{draggable:false,onClick:()=>Ta(M.id),className:"flex items-center gap-1 hover:text-[#007BFF]",children:[Kn(M),jsx(ArrowUpDown,{className:u("w-3 h-3",J===M.id&&"text-[#007BFF]")})]}):jsx("span",{draggable:false,children:Kn(M)}),f&&M.resizable&&jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#007BFF]",nt===M.id&&"bg-[#007BFF]"),onMouseDown:Ce=>ge(Ce,M.id)})]},M.id)}),h&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:M=>{M.stopPropagation(),vt(se=>!se);},className:u("p-0.5 rounded transition-colors",$?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",we&&($?"bg-white/[0.05]":"bg-gray-200")),title:d==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(Ig,{isOpen:we,onClose:()=>vt(false),columns:rt,customFields:c,onColumnsChange:Xt,onCreateCustomField:()=>{vt(false),tt(true);},isDark:$,locale:d})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:ga.map((M,se)=>{let xe=kt.has(M.id),Ce=Math.min(se*.01,.2),Ke=M.hasChildren&&M.level===0,ot=M.subtasks?.length||0;if(Ke){let{spent:Et,allocated:Ct,quoted:sa}=Vn(M),aa=ow(M);return jsxs(motion.div,{"data-task-id":M.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ce},className:u("flex items-center border-y cursor-pointer transition-colors duration-500",$?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",z===M.id&&($?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(M),children:[dt&&jsx("div",{className:"w-5 flex-shrink-0"}),pt.map(Ba=>jsx("div",{className:u("flex items-center px-4 py-3 min-h-[56px]",Ba.type!=="name"&&"justify-center"),style:{width:zr[Ba.id],minWidth:Ba.minWidth},children:Ba.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{onClick:Ot=>{Ot.stopPropagation(),Wt(M.id);},className:u("p-0.5 rounded flex-shrink-0 mt-0.5",$?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:xe?jsx(ChevronDown,{className:u("w-4 h-4",$?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:u("w-4 h-4",$?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:Ot=>{Ot.stopPropagation(),Wt(M.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:xe?jsx(FolderOpen,{className:"w-4 h-4",style:{color:$?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:$?"#FFD60A":"#B45309"}})}),M.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:$?"#FFD60A":"#B45309"},children:M.wbsCode}),jsxs("div",{className:"flex flex-col min-w-0",children:[jsx("span",{className:u("text-[13px] font-bold uppercase tracking-wide",$?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:M.name}),jsxs("span",{className:u("text-[10px] font-mono",$?"text-white/30":"text-gray-500"),children:["(",ot," ",d==="es"?ot===1?"Tarea":"Tareas":ot===1?"Item":"Items",")"]}),aa!==null&&jsxs("span",{className:u("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",aa>=1?"text-[#32D74B] bg-[#32D74B]/10":aa>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",aa.toFixed(2)]})]})]}):Ba.type==="timeLoggedMinutes"?v==="financial"?(()=>{let Ot=Y(M),Wa=Math.round(Ot.dollarSpent);return Wa>0?jsxs("span",{className:u("text-sm font-mono",$?"text-white/60":"text-gray-500"),children:["$",Wa.toLocaleString("en-US")]}):null})():jsx(Dr,{value:Et>0?Et:void 0,isDark:$,locale:d,disabled:true,lens:v,hourlyRate:F(M)}):Ba.type==="soldEffortMinutes"?v==="financial"?(()=>{let Ot=Y(M),Wa=Math.round(Ot.dollarQuoted);return Wa>0?jsxs("span",{className:u("text-sm font-mono",$?"text-white/60":"text-gray-500"),children:["$",Wa.toLocaleString("en-US")]}):null})():jsx(Dr,{value:sa>0?sa:void 0,isDark:$,locale:d,disabled:true,lens:v,hourlyRate:F(M)}):Ba.type==="effortMinutes"?v==="financial"?(()=>{let Ot=Y(M),Wa=Math.round(Ot.dollarAllocated),Qa=Math.round(Ot.dollarQuoted),ur=Qa-Wa;return jsxs("div",{className:"flex flex-col",children:[Wa>0?jsxs("span",{className:u("text-sm font-mono",$?"text-white/60":"text-gray-500"),children:["$",Wa.toLocaleString("es-CO")]}):null,ur!==0&&Wa>0&&Qa>0&&jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",ur>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[ur>0?"+":"",Math.abs(ur)>=1e3?`$${(ur/1e3).toFixed(1)}K`:`$${ur}`]})]})})():jsx(Dr,{value:Ct>0?Ct:void 0,isDark:$,locale:d,disabled:true,lens:v,hourlyRate:F(M)}):cr(M,Ba)},Ba.id)),h&&jsx("div",{className:"w-12 flex-shrink-0"})]},M.id)}let he=D===M.id,We=G===M.id,mt=We&&Re==="above",St=We&&Re==="below",Lt=We&&Re==="child";return jsxs(motion.div,{"data-task-id":M.id,"data-listview-row":M.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ce},className:u("flex items-center border-b transition-colors relative group",$?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",z===M.id&&($?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:he?.4:1,backgroundColor:Lt?$?"rgba(46,148,255,0.08)":"rgba(46,148,255,0.05)":void 0,boxShadow:Lt?"inset 0 0 0 2px #2E94FF":void 0},onClick:()=>a.onTaskClick?.(M),onDoubleClick:()=>a.onTaskDoubleClick?.(M),onContextMenu:Et=>$e(Et,M),children:[mt&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),St&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#2E94FF",zIndex:10}}),dt&&jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:Et=>ut(M.id,Et),style:{color:$?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),pt.map(Et=>jsx("div",{className:u("flex items-center px-4 py-3 min-h-[56px]",Et.type!=="name"&&"justify-center"),style:{width:zr[Et.id],minWidth:Et.minWidth},children:Et.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[y&&M.level>0&&jsx("div",{style:{width:`${M.level*24}px`},className:"flex-shrink-0"}),y&&M.hasChildren&&jsx("button",{onClick:Ct=>{Ct.stopPropagation(),Wt(M.id);},className:u("p-0.5 rounded flex-shrink-0",$?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:xe?jsx(ChevronDown,{className:u("w-4 h-4",$?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:u("w-4 h-4",$?"text-white/60":"text-gray-400")})}),y&&!M.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(M.wbsCode||M.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[M.wbsCode&&jsx("span",{className:u("text-[10px] font-mono",$?"text-[#007BFF]":"text-blue-600"),children:M.wbsCode}),M.taskCode&&jsx("span",{className:u("text-[10px] font-mono",$?"text-white/40":"text-gray-400"),children:M.taskCode})]}),jsx("span",{className:u("truncate text-[13px]",M.hasChildren?"font-semibold":"font-medium",M.progress===100?$?"line-through text-white/50":"line-through text-gray-400":$?"text-white":"text-gray-900"),children:M.name}),M.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${M.tags[0].color}20`,color:M.tags[0].color},children:M.tags[0].name})]})]}):cr(M,Et)},Et.id)),h&&jsx("div",{className:"w-12 flex-shrink-0"})]},M.id)})}),X&&ga.length>0&&(()=>{let{spent:M,allocated:se,quoted:xe}=Ee,Ce=se-M,Ke=Ce<0,ot=Ke?`+${Gn(Math.abs(Ce))} ${d==="es"?"EXCEDIDO":"OVER"}`:`-${Gn(Ce)} ${d==="es"?"AHORRADO":"SAVED"}`,he=v==="financial"&&E>0,We=(Lt,Et)=>{if(he){let Ct=Et??Lt/60*E;return `$${Math.round(Ct).toLocaleString("es-CO")}`}return Gn(Lt)},mt=he?Math.abs(Ee.dollarAllocated-Ee.dollarSpent):0,St=he?`${Ke?"+":"-"}$${mt.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Ke?d==="es"?"EXCEDIDO":"OVER":d==="es"?"AHORRADO":"SAVED"}`:ot;return jsxs("div",{className:u("flex items-center sticky bottom-0 z-[5]",$?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:$?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[dt&&jsx("div",{className:"w-5 flex-shrink-0"}),pt.map(Lt=>jsx("div",{className:u("flex items-center px-4 py-3",Lt.type!=="name"&&"justify-center"),style:{width:zr[Lt.id],minWidth:Lt.minWidth},children:Lt.type==="name"?jsx("span",{className:u("text-[11px] font-black uppercase tracking-widest",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:d==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}):Lt.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:u("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:We(M,he?Ee.dollarSpent:void 0)}),jsx("span",{className:u("text-[11px]",$?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:u("text-[11px]",$?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:We(se,he?Ee.dollarAllocated:void 0)})]}),se>0&&jsx("span",{className:u("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Ke?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:he?St:ot})]}):Lt.type==="soldEffortMinutes"?jsx("span",{className:u("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:xe>0?We(xe,he?Ee.dollarQuoted:void 0):"\u2013"}):Lt.type==="effortMinutes"?(()=>{if(he&&xe>0&&se>0){let Et=Math.round(Ee.dollarQuoted),Ct=Math.round(Ee.dollarAllocated),sa=Et-Ct,aa=Et>0?Math.round(sa/Et*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:u("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:We(se,Ee.dollarAllocated)}),jsxs("span",{className:u("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",sa>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[sa>=0?"+":"",Math.abs(sa)>=1e3?`$${(sa/1e3).toFixed(1)}K`:`$${sa}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",aa,"%)"]})]})]})}return jsx("span",{className:u("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:se>0?We(se,he?Ee.dollarAllocated:void 0):"\u2013"})})():Lt.type==="timeLoggedMinutes"?jsx("span",{className:u("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:M>0?We(M,he?Ee.dollarSpent:void 0):"\u2013"}):Lt.type==="progress"?(()=>{let Et=e||[],Ct=[],sa=Qa=>{for(let ur of Qa)ur.subtasks&&ur.subtasks.length>0?sa(ur.subtasks):Ct.push({progress:ur.progress||0,weight:ur.weight||0});};sa(Et);let aa=0,Ba=0,Ot=0;for(let Qa of Ct)Qa.weight>0&&(aa+=Qa.progress*Qa.weight,Ba+=Qa.weight),Ot+=Qa.progress;let Wa=Ba>0?Math.round(aa/Ba*10)/10:Ct.length>0?Math.round(Ot/Ct.length):0;return jsxs("span",{className:u("text-[12px] font-bold font-mono",$?"text-[#00E5CC]":"text-cyan-600"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Wa,"%"]})})():Lt.type==="weight"?(()=>{let Et=e||[],Ct=[],sa=Wa=>{for(let Qa of Wa)Ct.push(Qa),Qa.subtasks?.length&&sa(Qa.subtasks);};sa(Et);let Ba=Ct.filter(Wa=>!Wa.subtasks?.length||Wa.subtasks.length===0).reduce((Wa,Qa)=>Wa+(Qa.weight||0),0),Ot=Math.abs(Ba-100)<.1;return jsxs("span",{className:u("text-[12px] font-bold font-mono",Ot?$?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(Ba.toFixed(1)),"%"]})})():jsx("span",{className:u("text-[11px]",$?"text-white/30":"text-gray-300"),children:"\u2013"})},Lt.id)),h&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),ga.length===0&&Be&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:u("w-12 h-12 mx-auto mb-4",$?"text-white/30":"text-gray-400")}),jsx("p",{className:u($?"text-white/60":"text-gray-600"),children:O.empty.noResults})]})})]})}),_?.enabled&&_.data&&ye&&jsx(Gg,{data:_.data,isDark:$,locale:d,onClose:()=>Je(false),lens:t?.lens,onUnassignedTaskClick:M=>{let se=document.querySelector(`[data-task-id="${M}"]`);se&&(se.scrollIntoView({behavior:"smooth",block:"center"}),re(M),setTimeout(()=>re(null),2e3));}})]}),jsx(Tg,{state:H,onClose:A,isDark:$,locale:d,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:U,onColumnSort:ne,availableUsers:l,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),pe&&Ue&&D&&createPortal(jsx("div",{style:{position:"fixed",left:Ue.x+12,top:Ue.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let se=Se.flattenTasks(e).find(xe=>xe.id===D);return se?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:$?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${$?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsx(GripVertical,{className:"w-3 h-3",style:{color:"#2E94FF"}}),jsx("span",{className:"text-xs font-medium",style:{color:$?"#e6edf3":"#111827"},children:se.name})]}):null})()}),document.body),jsx(Og,{isOpen:gt,onClose:()=>tt(false),onSave:qa,isDark:$,locale:d})]})}var Jg=[{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}],Qg=[{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"}],Zg=[{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 lc={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:"#007BFF",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#007BFF",statusCompleted:"#34D399",focusRing:"#007BFF",checkboxBg:"#1A1A1A",checkboxChecked:"#007BFF",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},dc={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:"#2E94FF"},cc={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"},Xi={dark:lc,light:dc,neutral:cc};function e0(e){return Xi[e]||Xi.dark}var uc={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},pc={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Ji={en:uc,es:pc};function Ss(e){return Ji[e]||Ji.en}function Qi(e,t){let a=Ss(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function t0(e){let t=Ss(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function a0(e,t=0,a=true){let r=Ss(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function Ms(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function gc(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function n0({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsx(Circle,{className:u("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var l0=26,mw=22,gw=10;function s0(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function fc(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let o=Math.round(e/60*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function d0(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let o=r<0,s;if(t==="financial"&&a>0){let n=Math.round(Math.abs(r/60)*a);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}else {let n=Math.round(Math.abs(r)/60);s=n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`;}return {text:`${o?"-":"+"}${s}`,isNegative:o}}function i0(e,t="hours",a=0){if(t==="financial"&&a>0){let o=Math.round(Math.abs(e/60)*a);return o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function fw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:o,t:s,lens:n="hours",hourlyRate:l=0}){let{task:c,spanCols:i,lane:m,isStart:d,isEnd:p}=e,g=c.progress===100||c.status==="completed",y=c.isCriticalPath,x=d&&p?"rounded":d?"rounded-l":p?"rounded-r":"",h=p?fc(c.effortMinutes,n,l):null,f=p?d0(c,n,l):null,b=p?c.blockers?.find(w=>w.severity==="critical"):null;return jsxs(motion.button,{onClick:w=>{w.stopPropagation(),a();},whileHover:{scale:1.005},className:u("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",x,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":y?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:{top:`${m*l0}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${mw}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:y?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:d?"3px":void 0,borderLeftColor:d?y?"#EF4444":g?"#10B981":"#1264FF":void 0,...o?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(59, 130, 246, 0.7), 0 0 12px rgba(59, 130, 246, 0.2)",zIndex:20}:{}},children:[y&&d&&jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsx("span",{className:"truncate flex-1 text-left font-medium",children:c.name}),p&&(h||f)&&jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[h&&jsxs("span",{children:[s.labels.estimate,": ",h]}),f&&jsxs(Fragment,{children:[jsx("span",{className:"text-white/15",children:"|"}),jsx("span",{className:u(f.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:f.text})]})]}),b&&jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",b.type]}),c.progress>0&&c.progress<100&&jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${c.progress}%`}})]})}function c0({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:c=[],onCreateTag:i,attachmentsByTask:m,comments:d,onAddComment:p,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,onTaskOpen:h,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:w,timerState:C,onLogTime:N,onUpdateEstimate:T,onUpdateSoldEffort:k,onStartTimer:v,onStopTimer:E,onDiscardTimer:I,blurFinancials:S=false,suppressDetailModal:X$1=false,lens:O="hours",hourlyRate:$=0}){let{theme:F="dark",locale:Y="en",customTranslations:Z,showBacklog:Ee=true}=t,R=Qi(Y,Z),_=F==="dark"||F==="neutral",[ye,Je]=useState(r||new Date),[z,re]=useState(null),[J,Ae]=useState(null),[ve,ze]=useState(null),[Be,st]=useState({}),ee=3,it=3,de=useCallback(G=>{Ae(G.id),X$1||re(G),h?.(G.id);},[X$1,h]),[lt,rt]=useState(null),At=useCallback(()=>{Je(new Date(ye.getFullYear(),ye.getMonth()-1,1));},[ye]),we=useCallback(()=>{Je(new Date(ye.getFullYear(),ye.getMonth()+1,1));},[ye]),vt=useCallback(()=>{Je(new Date);},[]),gt=useMemo(()=>{let G=ye.getFullYear(),te=ye.getMonth(),Re=new Date(G,te,1),De=new Date(G,te+1,0),Ue=Re.getDay(),Fe=De.getDate(),_e=Ms(e),ft=new Date;ft.setHours(0,0,0,0);let dt=[],ut=Ue,at=new Date(G,te,0).getDate();for(let Mt=ut-1;Mt>=0;Mt--){let Dt=new Date(G,te-1,at-Mt);dt.push({date:Dt,isCurrentMonth:false,isToday:false,isWeekend:Dt.getDay()===0||Dt.getDay()===6,events:_e.filter(wt=>gc(Dt,wt)).map(wt=>({id:wt.id,title:wt.name,start:wt.startDate,end:wt.endDate,task:wt}))});}for(let Mt=1;Mt<=Fe;Mt++){let Dt=new Date(G,te,Mt),wt=Dt.getTime()===ft.getTime();dt.push({date:Dt,isCurrentMonth:true,isToday:wt,isWeekend:Dt.getDay()===0||Dt.getDay()===6,events:_e.filter(bt=>gc(Dt,bt)).map(bt=>({id:bt.id,title:bt.name,start:bt.startDate,end:bt.endDate,task:bt}))});}let Vt=42-dt.length;for(let Mt=1;Mt<=Vt;Mt++){let Dt=new Date(G,te+1,Mt);dt.push({date:Dt,isCurrentMonth:false,isToday:false,isWeekend:Dt.getDay()===0||Dt.getDay()===6,events:_e.filter(wt=>gc(Dt,wt)).map(wt=>({id:wt.id,title:wt.name,start:wt.startDate,end:wt.endDate,task:wt}))});}return dt},[ye,e]),tt=useMemo(()=>Ms(e).filter(G=>!G.startDate||!G.endDate),[e]),H=useMemo(()=>{let G=Ms(e),te=0,Re=0,De=0,Ue=0,Fe=0;G.forEach(at=>{at.effortMinutes&&(te+=at.effortMinutes),at.soldEffortMinutes&&(Re+=at.soldEffortMinutes),at.scheduleVariance!=null&&(De+=at.scheduleVariance,Ue++),at.soldEffortMinutes&&at.effortMinutes&&(Fe+=at.soldEffortMinutes-at.effortMinutes);});let _e=Re>0?Math.min(100,Math.round(te/Re*100)):0,ft=Ue>0?Math.round(De/Ue):0,ut=`${Fe<0?"-":"+"}${i0(Fe,O,$)}`;return {budgetUtil:_e,avgVariance:ft,costDisplay:ut,hasCostData:Re>0}},[e,O,$]),le=useMemo(()=>{let G=[0,0,0,0,0,0];return gt.forEach((te,Re)=>{let De=Math.floor(Re/7);te.events.forEach(Ue=>{if(Ue.task.startDate&&Ue.task.soldEffortMinutes){let Fe=new Date(Ue.task.startDate),_e=te.date;Fe.getFullYear()===_e.getFullYear()&&Fe.getMonth()===_e.getMonth()&&Fe.getDate()===_e.getDate()&&De<G.length&&(G[De]-=Ue.task.soldEffortMinutes);}});}),G},[gt]),D=useMemo(()=>{let G=Ms(e),te=new Map,Re=new Set,De=[0,0,0,0,0,0];if(gt.length===0)return {segmentsByCell:te,multiDayTaskIds:Re,maxLanesPerRow:De};let Ue=ut=>new Date(ut.getFullYear(),ut.getMonth(),ut.getDate()),Fe=Ue(gt[0].date),_e=Ue(gt[gt.length-1].date),ft=[];for(let ut of G){if(!ut.startDate||!ut.endDate)continue;let at=Ue(ut.startDate),Vt=Ue(ut.endDate);if(at.getTime()===Vt.getTime()||Vt<Fe||at>_e)continue;let Mt=at<Fe?Fe:at,Dt=Vt>_e?_e:Vt,wt=s0(Mt,Fe),bt=s0(Dt,Fe);wt<0||wt>41||bt<0||bt>41||wt!==bt&&(Re.add(ut.id),ft.push({task:ut,startIdx:wt,endIdx:bt}));}ft.sort((ut,at)=>ut.startIdx!==at.startIdx?ut.startIdx-at.startIdx:at.endIdx-at.startIdx-(ut.endIdx-ut.startIdx));let dt=[[],[],[],[],[],[]];for(let{task:ut,startIdx:at,endIdx:Vt}of ft){let Mt=Math.floor(at/7),Dt=Math.floor(Vt/7),wt=Ue(ut.startDate),bt=Ue(ut.endDate),Ut=false;for(let Ge=Mt;Ge<=Dt;Ge++){let Le=Ge===Mt?at%7:0,nt=Ge===Dt?Vt%7:6,oe=nt-Le+1,fe=0,L=dt[Ge]??[];for(dt[Ge]||(dt[Ge]=L);fe<L.length&&(L[fe]??-1)>=Le;)fe++;if(fe>=gw){Ut=true;break}fe>=L.length?L.push(nt):L[fe]=nt,De[Ge]=Math.max(De[Ge]??0,fe+1);let j=Ge===Mt&&wt>=Fe,q=Ge===Dt&&bt<=_e,me=Ge*7+Le,Ne={taskId:ut.id,task:ut,rowIndex:Ge,startCol:Le,endCol:nt,spanCols:oe,lane:fe,isStart:j,isEnd:q};te.has(me)||te.set(me,[]),te.get(me).push(Ne);}Ut&&(Re.delete(ut.id),te.forEach((Ge,Le)=>{let nt=Ge.filter(oe=>oe.taskId!==ut.id);nt.length===0?te.delete(Le):te.set(Le,nt);}));}return {segmentsByCell:te,multiDayTaskIds:Re,maxLanesPerRow:De}},[gt,e]),K=Y==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],pe=ye.toLocaleDateString(Y==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Te=pe.charAt(0).toUpperCase()+pe.slice(1);return o?jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#050505]":"bg-white",n),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxs("p",{className:u("text-sm font-mono",_?"text-white/30":"text-gray-600"),children:[R.labels.noEvents,"..."]})]})}):s?jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#050505]":"bg-white",n),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:u("w-12 h-12 rounded-full flex items-center justify-center",_?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:u("text-lg font-semibold mb-2",_?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",_?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#050505]":"bg-white",n),style:l,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:u("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",_?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-blue-500/10"),children:jsx(Calendar,{className:u("w-8 h-8",_?"text-[#007FFF]":"text-blue-500")})}),jsx("h3",{className:u("text-lg font-semibold mb-2",_?"text-white/90":"text-gray-900"),children:R.labels.noEvents}),jsx("p",{className:u("text-sm",_?"text-white/30":"text-gray-600"),children:R.labels.newTask})]})}):jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-hidden",_?"bg-[#050505]":"bg-white",n),style:l,children:[jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxs("div",{className:u("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",_?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxs("div",{className:u("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",_?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsx(Calendar,{className:u("w-3.5 h-3.5",_?"text-[#007FFF]":"text-blue-500")}),jsx("span",{className:u("font-medium",_?"text-white":"text-gray-900"),children:Y==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:u("h-4 w-px",_?"bg-white/10":"bg-gray-200")}),jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsx("button",{onClick:At,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",_?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("span",{className:u("text-sm font-semibold tracking-tight min-w-[150px] text-center",_?"text-white":"text-gray-900"),children:Te}),jsx("button",{onClick:we,className:u("w-6 h-6 flex items-center justify-center rounded transition-colors",_?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxs(Fragment,{children:[t.toolbarRightContent,jsx("div",{className:u("h-4 w-px",_?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:vt,className:u("px-2.5 py-1 text-xs rounded-md transition-all font-medium",_?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:R.navigation.today})]})]}),jsx("div",{className:u("grid grid-cols-7 sticky top-0 z-10",_?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:K.map(G=>jsx("div",{className:u("py-2 text-center text-[10px] font-bold uppercase tracking-widest",_?"text-white/60 font-mono":"text-gray-500"),children:G},G))}),jsx("div",{className:"flex-1 overflow-y-auto",children:jsx("div",{className:u("grid grid-cols-7 min-h-[800px]",_?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Ae(null),children:gt.map((G,te)=>{let Re=te%7===6,De=te>=35;return jsxs("div",{className:u("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Re&&(_?"border-r border-[#222]":"border-r border-gray-200"),!De&&(_?"border-b border-[#222]":"border-b border-gray-200"),_?G.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":G.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",G.isToday&&_&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",G.isToday&&!_&&"ring-2 ring-blue-500 ring-inset"),children:[jsx("span",{className:u("text-xs font-mono select-none relative z-20",G.isToday?_?"text-[#007FFF] font-bold":"text-blue-600 font-bold":G.isCurrentMonth?_?"text-white/60":"text-gray-900":_?"text-white/20":"text-gray-400"),children:String(G.date.getDate()).padStart(2,"0")}),(()=>{let Ue=Math.floor(te/7),Fe=(D.maxLanesPerRow[Ue]??0)*l0,_e=D.segmentsByCell.get(te);return Fe===0&&!_e?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Fe}px`,zIndex:5},children:_e?.map(ft=>jsx(fw,{segment:ft,isDark:_,blurFinancials:S,isSelected:J===ft.taskId,t:R,lens:O,hourlyRate:$,onClick:()=>{de(ft.task),a.onEventClick?.({id:ft.task.id,title:ft.task.name,start:ft.task.startDate,end:ft.task.endDate,task:ft.task});}},ft.taskId))})})(),(()=>{let Ue=G.events.filter(Fe=>Fe.task.isMilestone&&!D.multiDayTaskIds.has(Fe.id));return Ue.length===0?null:jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[Ue.slice(0,4).map(Fe=>jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Fe.title,onClick:_e=>{_e.stopPropagation(),de(Fe.task);}},Fe.id)),Ue.length>4&&jsxs("span",{className:u("text-[8px] font-mono",_?"text-white/30":"text-gray-400"),children:["+",Ue.length-4]})]})})(),(()=>{let Ue=[];G.events.forEach(_e=>{_e.task.blockers?.forEach(ft=>{(ft.severity==="warning"||ft.severity==="critical")&&Ue.push({taskId:_e.id,type:ft.type,severity:ft.severity,variance:_e.task.scheduleVariance});});});let Fe=Ue[0];return Fe?jsx("div",{className:"mt-0.5 px-0.5",children:jsxs("div",{className:u("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Fe.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsx("span",{children:"\u26A0"}),jsxs("span",{className:"truncate",children:[R.labels.risk,": ",Fe.type,Fe.variance?` (+${Math.abs(Fe.variance)}d ${R.labels.delay})`:""]})]})}):null})(),(()=>{let Ue=G.events.filter(dt=>!D.multiDayTaskIds.has(dt.id)),Fe=Be[te]||ee,_e=Ue.slice(0,Fe),ft=Ue.length-Fe;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[_e.map(dt=>jsxs(motion.button,{onClick:()=>{de(dt.task),a.onEventClick?.(dt);},whileHover:{scale:1.01},className:u("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",dt.task.progress===100||dt.task.status==="completed"?_?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":_?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-blue-300"),style:_?dt.task.progress===100||dt.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:dt.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsx("span",{className:u("flex-shrink-0 text-[9px]",dt.task.isMilestone?_?"text-amber-400":"text-amber-600":dt.task.isCriticalPath?"text-red-400":_?"text-[#1264FF]":"text-gray-400"),children:dt.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:dt.title})]},dt.id)),ft>0&&jsxs("button",{onClick:dt=>{dt.stopPropagation(),st(ut=>({...ut,[te]:Fe+it}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",_?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",ft," ",Y==="es"?"m\xE1s":"more"]}),Fe>ee&&Ue.length>ee&&jsx("button",{onClick:dt=>{dt.stopPropagation(),st(ut=>({...ut,[te]:ee}));},className:u("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",_?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:Y==="es"?"menos":"less"})]})})(),G.isCurrentMonth&&a.onTaskCreate&&jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let Ue=te>=28,Fe=te%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:_e=>{_e.stopPropagation(),rt(lt===te?null:te);},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",lt===te?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",_?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-blue-500 text-gray-400 hover:text-white"),children:jsx(Plus,{className:u("w-3.5 h-3.5 transition-transform",lt===te&&"rotate-45")})}),jsx(AnimatePresence,{children:lt===te&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>rt(null)}),jsx(motion.div,{initial:{opacity:0,y:Ue?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ue?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",Ue?"bottom-full mb-1":"top-full mt-1",Fe?"right-0":"left-0",_?"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(Jo,{onSubmit:_e=>{a.onTaskCreate?.({name:_e.name,startDate:_e.startDate||G.date,endDate:_e.endDate||G.date,priority:_e.priority,assignees:_e.assignee?[_e.assignee]:void 0}),rt(null);},onCancel:()=>rt(null),availableUsers:t.availableUsers,isDark:_,locale:Y==="es"?"es":"en",defaultDate:G.date,dropdownDirection:Ue?"up":"down"})})]})})]})})()}),te%7===6&&(()=>{let Ue=Math.floor(te/7),Fe=le[Ue];if(!Fe||Fe===0)return null;let _e=i0(Fe,O,$);return jsxs("div",{className:u("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Fe<0?"text-red-400":"text-emerald-400",S&&"blur-sm select-none"),children:[R.labels.cashOut,": ",Fe<0?"-":"+",_e]})})()]},te)})})})]}),Ee&&jsxs("aside",{className:u("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",_?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxs("div",{className:u("flex-shrink-0 h-14 flex items-center justify-between px-4",_?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsx("span",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",_?"text-white/40":"text-gray-500"),children:R.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:u("text-[10px] font-mono tabular-nums",_?"text-white/20":"text-gray-400"),children:tt.length})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:tt.length===0?jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:u("w-10 h-10 rounded-xl flex items-center justify-center mb-3",_?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:u("w-5 h-5",_?"text-white/20":"text-gray-400")})}),jsx("p",{className:u("text-xs font-mono",_?"text-white/20":"text-gray-400"),children:Y==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):tt.map(G=>jsxs("button",{onClick:()=>{de(G);},className:u("w-full text-left rounded-md p-3 transition-all group/card",_?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsx("div",{className:u("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",_?"bg-white/20":"bg-gray-300")}),jsx("span",{className:u("text-sm font-medium leading-snug line-clamp-2",_?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:G.name})]}),G.tags&&G.tags.length>0&&jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[G.tags.slice(0,3).map(te=>jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${te.color}15`,color:te.color,border:`1px solid ${te.color}30`},children:te.name},te.id)),G.tags.length>3&&jsxs("span",{className:u("text-[9px] font-mono px-1 py-0.5",_?"text-white/20":"text-gray-400"),children:["+",G.tags.length-3]})]}),(G.effortMinutes||G.soldEffortMinutes)&&jsxs("div",{className:u("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",_?"text-white/25":"text-gray-400",S&&"blur-sm select-none"),children:[fc(G.effortMinutes,O,$)&&jsxs("span",{children:[R.labels.estimate,": ",fc(G.effortMinutes,O,$)]}),(()=>{let te=d0(G,O,$);return te?jsx("span",{className:te.isNegative?"text-red-400":"text-emerald-400",children:te.text}):null})()]}),jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[G.priority&&jsx(Flag,{className:u("w-3 h-3",G.priority==="urgent"||G.priority==="high"?"text-red-400":G.priority==="medium"?"text-yellow-400":"text-green-400")}),jsx(n0,{task:G,isDark:_})]}),G.assignees&&G.assignees.length>0&&jsx("div",{className:"flex -space-x-1",children:G.assignees.slice(0,2).map((te,Re)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:te.color||"#007FFF"},title:te.name,children:te.initials||te.name?.slice(0,2).toUpperCase()},Re))})]})]},G.id))}),a.onTaskCreate&&jsx("div",{className:u("flex-shrink-0 px-3 py-2.5 border-t",_?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsx("input",{type:"text",placeholder:R.labels.typeToAdd,className:u("w-full text-[11px] font-mono bg-transparent outline-none",_?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:G=>{G.key==="Enter"&&G.target.value.trim()&&(a.onTaskCreate?.({name:G.target.value.trim()}),G.target.value="");}})}),H.hasCostData&&jsxs("div",{className:u("flex-shrink-0 px-4 py-3 border-t space-y-2.5",_?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",_?"text-white/40":"text-gray-500"),children:["\u25C8 ",R.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:u("text-[10px] font-mono",_?"text-white/40":"text-gray-500"),children:R.labels.budgetUtil}),jsxs("span",{className:u("text-[10px] font-mono font-bold tabular-nums",_?"text-white/60":"text-gray-700",S&&"blur-sm select-none"),children:[H.budgetUtil,"%"]})]}),jsx("div",{className:u("h-1.5 rounded-full overflow-hidden",_?"bg-white/5":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${H.budgetUtil}%`,background:H.budgetUtil>90?"#EF4444":H.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #2E94FF, #8B5CF6)"}})})]}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",_?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",_?"text-white/25":"text-gray-400"),children:R.labels.variance}),jsxs("div",{className:u("text-[11px] font-mono font-bold tabular-nums",H.avgVariance>0?"text-emerald-400":H.avgVariance<0?"text-red-400":_?"text-white/50":"text-gray-600"),children:[H.avgVariance>0?"+":"",H.avgVariance," ",R.labels.days]})]}),jsxs("div",{className:u("rounded-md px-2 py-1.5 text-center",_?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:u("text-[8px] font-mono uppercase tracking-wider mb-0.5",_?"text-white/25":"text-gray-400"),children:R.labels.cost}),jsx("div",{className:u("text-[11px] font-mono font-bold tabular-nums",H.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",S&&"blur-sm select-none"),children:H.costDisplay})]})]})]})]})]}),!X$1&&jsx(bo,{task:z,isOpen:!!z,onClose:()=>re(null),onTaskUpdate:G=>{a.onTaskUpdate?.(G),re(G);},theme:F==="dark"?"dark":"light",locale:Y,availableUsers:t.availableUsers?.map(G=>({id:G.id,name:G.name,avatar:G.avatar,initials:G.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:i,attachments:z?m?.get(z.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:Ms(e).filter(G=>G.id!==z?.id),comments:d?.filter(G=>G.taskId===z?.id).map(G=>({...G,createdAt:G.createdAt instanceof Date?G.createdAt:new Date(G.createdAt),updatedAt:G.updatedAt instanceof Date?G.updatedAt:G.updatedAt?new Date(G.updatedAt):void 0})),onAddComment:p,currentUser:g,mentionableUsers:y,onUploadCommentAttachments:x,enableTimeTracking:f,timeTrackingSummary:b,timeEntries:w,isTimerRunning:C?.isRunning,timerElapsedSeconds:C?.elapsedSeconds,onTimeLog:N,onEstimateUpdate:T,onSoldEffortUpdate:k,onTimerStart:v,onTimerStop:E,onTimerDiscard:I,blurFinancials:S}),jsx(AnimatePresence,{children:ve&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>ze(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:u("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",_?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",_?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsx("span",{className:u("font-medium text-sm",_?"text-white/90":"text-gray-900"),children:ve.date.toLocaleDateString(Y==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>ze(null),className:u("p-1 rounded",_?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}),jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:ve.events.map(G=>jsxs("button",{onClick:()=>{ze(null),de(G.task);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",_?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsx(n0,{task:G.task,isDark:_}),jsx("span",{className:u("text-sm truncate flex-1",_?"text-white/80":"text-gray-900"),children:G.title}),(G.task.priority==="high"||G.task.priority==="urgent")&&jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"})]},G.id))})]})]})})]})}var bc={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 127, 255, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 127, 255, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 127, 255, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},hc={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 127, 255, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},yc={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},tl={dark:bc,light:hc,neutral:yc};function u0(e){return tl[e]||tl.dark}function hw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[c,i]=useState(false),m=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),d=useMemo(()=>{let g=m.length,y=new Set(m.flatMap(f=>f.assignedUserIds||[])).size,x=m.map(f=>f.priority).filter(Boolean),h=new Set(m.flatMap(f=>f.labels||[])).size;return {totalCards:g,uniqueAssignees:y,priorities:x,labels:h}},[m]),p=()=>{o?.(e.id);};return jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:p,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:u("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),n?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:m.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:m.map(g=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsx("h4",{children:g.title}),g.description&&jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var m0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Ps(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 As(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 g0(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function f0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let c=useMemo(()=>({...m0,...n}),[n]),[i,m]=useState(new Set),d=useRef(null),p=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(w=>{let C=w.timestamp.toISOString().split("T")[0],N=b.get(C);N?N.push(w):b.set(C,[w]);}),Array.from(b.entries()).sort((w,C)=>C[0].localeCompare(w[0])).map(([w,C])=>({date:new Date(w),events:C.sort((N,T)=>T.timestamp.getTime()-N.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:g,uniqueTypes:y}=useMemo(()=>{let b=new Set,w=new Set;return e.forEach(C=>{b.add(C.userId),w.add(C.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(w)}},[e]),x=b=>{m(w=>{let C=new Set(w);return C.has(b)?C.delete(b):C.add(b),C});},h=b=>{let C=new Date().getTime()-b.getTime(),N=Math.floor(C/6e4),T=Math.floor(C/36e5),k=Math.floor(C/864e5);return N<1?"just now":N<60?`${N}m ago`:T<24?`${T}h ago`:k<7?`${k}d ago`:b.toLocaleDateString()},f=useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return useEffect(()=>{if(s&&d.current){let b=d.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:u("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:u("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:b=>{let w=b.target.value;a({...t,types:w?[w]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),y.map(b=>jsxs("option",{value:b,children:[As(b)," ",b.replace("_"," ")]},b))]}),g.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let w=b.target.value;a({...t,users:w?[w]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),g.map(b=>jsx("option",{value:b,children:b},b))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),f>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",f,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:p.map(b=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&b.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:b.events.map((w,C)=>{let N=i.has(w.id),T=s===w.id,k=g0(w.type);return jsxs("div",{"data-event-id":w.id,className:u("history-timeline-event",N&&"expanded",T&&"selected"),onClick:()=>o?.(w),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:k},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:As(w.type)})}),C<b.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:k}})]}),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&&w.userAvatar&&jsx("img",{src:w.userAvatar,alt:w.userName||w.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:w.userName||w.userId}),jsx("span",{className:"history-timeline-event-action",children:Ps(w)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?h(w.timestamp):w.timestamp.toLocaleString()})]}),Object.keys(w.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:v=>{v.stopPropagation(),x(w.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(w.changes).map(([v,E])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[v,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(E.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(E.to)})]})]},v)),w.metadata&&Object.keys(w.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(w.metadata).map(([v,E])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[v,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(E)})]},v))]})]})]})]},w.id)})})]},b.date?.toISOString()||"all"))})]})}function h0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:c,className:i}){let m=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:u("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:u("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&As(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&Ps(d)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>l(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,y)=>jsx("div",{className:u("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>l(y),title:Ps(g)},g.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:n,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:m.map(g=>jsxs("button",{className:u("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>c(g),children:[g,"x"]},g))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxs("div",{className:u("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 xc(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function vc(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 y0(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 x0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Cw(e,t,a,r,o,s=100){let n=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(n.map(c=>[c.id,c]));for(let c=0;c<s;c++){let i=1-c/s;n.forEach(m=>{let d=a/2,p=r/2;m.vx+=(d-m.x)*o.centerForce*i,m.vy+=(p-m.y)*o.centerForce*i,n.forEach(g=>{if(m.id===g.id)return;let y=m.x-g.x,x=m.y-g.y,h=Math.sqrt(y*y+x*x)||1,f=o.chargeStrength*i/(h*h);m.vx+=y/h*f,m.vy+=x/h*f;});}),t.forEach(m=>{let d=l.get(typeof m.source=="string"?m.source:m.source.id),p=l.get(typeof m.target=="string"?m.target:m.target.id);if(!d||!p)return;let g=p.x-d.x,y=p.y-d.y,x=Math.sqrt(g*g+y*y)||1,h=(x-o.linkDistance)/x*o.forceStrength*i;d.vx+=g*h,d.vy+=y*h,p.vx-=g*h,p.vy-=y*h;}),n.forEach(m=>{m.fx!==null&&m.fx!==void 0?(m.x=m.fx,m.vx=0):m.x+=m.vx,m.fy!==null&&m.fy!==void 0?(m.y=m.fy,m.vy=0):m.y+=m.vy,m.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,m.x)),m.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,m.y)),m.vx*=.9,m.vy*=.9;});}return n}function v0({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:c}){let i=useRef(null),[m,d]=useState([]),[p,g]=useState(null),[y,x]=useState(null),[h,f]=useState(null),[b,w]=useState(1),[C,N]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let O=Cw(e,t,a.width,a.height,a,150);d(O);},[e,t,a]);let T=useCallback((O,$)=>{a.enableDragging&&($.stopPropagation(),g(O));},[a.enableDragging]),k=useCallback(O=>{if(!p||!i.current)return;let F=i.current.getBoundingClientRect(),Y=(O.clientX-F.left-C.x)/b,Z=(O.clientY-F.top-C.y)/b;d(Ee=>Ee.map(R=>R.id===p?{...R,x:Y,y:Z,fx:Y,fy:Z}:R));},[p,b,C]),v=useCallback(()=>{g(null);},[]),E=useCallback((O,$)=>{$.stopPropagation(),l?.({type:"node-click",node:O,position:{x:$.clientX,y:$.clientY}});},[l]),I=useCallback((O,$)=>{$.stopPropagation(),l?.({type:"edge-click",edge:O,position:{x:$.clientX,y:$.clientY}});},[l]),S=useCallback(O=>{let $=m.find(F=>F.id===O);return $?{x:$.x,y:$.y}:{x:0,y:0}},[m]),X=useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let $=O.card.priority;return $==="URGENT"?"#ef4444":$==="HIGH"?"#f59e0b":$==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:u("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:u("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:n.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:n.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.min(O+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>w(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{w(1),N({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:xc(O)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[y0(O)," ",vc(O)]})]},O))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:k,onMouseUp:v,onMouseLeave:v,children:[jsxs("g",{transform:`translate(${C.x}, ${C.y}) scale(${b})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let $=S(typeof O.source=="string"?O.source:O.source.id),F=S(typeof O.target=="string"?O.target:O.target.id),Y=x0(O.type),Z=h===O.id,Ee=O.onCriticalPath;return jsxs("g",{className:u("relationships-graph-edge",Z&&"hovered",Ee&&"critical"),onMouseEnter:()=>f(O.id),onMouseLeave:()=>f(null),onClick:R=>I(O,R),children:[jsx("line",{x1:$.x,y1:$.y,x2:F.x,y2:F.y,stroke:xc(O.type),strokeWidth:Ee?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Z?1:.6,markerEnd:Y?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Z&&jsx("text",{x:($.x+F.x)/2,y:($.y+F.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:vc(O.type)})]},O.id)})}),jsx("g",{className:"relationships-graph-nodes",children:m.map(O=>{let $=y===O.id,F=O.onCriticalPath;return jsxs("g",{className:u("relationships-graph-node",$&&"hovered",F&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:Y=>T(O.id,Y),onMouseEnter:()=>x(O.id),onMouseLeave:()=>x(null),onClick:Y=>E(O,Y),children:[jsx("circle",{r:F?a.nodeSize*1.2:a.nodeSize,fill:X(O),stroke:F?"#fbbf24":"#ffffff",strokeWidth:F?3:2,opacity:$?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 C0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[l,c]=useState(false),[i,m]=useState(null),[d,p]=useState(null),g=useRef(null),y=l||o;useEffect(()=>{e&&g.current&&g.current.focus();},[e]),useEffect(()=>{let b=w=>{w.key==="Escape"&&!y&&x();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,y]);let x=()=>{y||(n(""),m(null),p(null),t());},h=async()=>{if(!(!s.trim()||y)){c(true),m(null),p(null);try{let b=await r(s.trim());p(b);}catch(b){m(b instanceof Error?b.message:"Failed to generate plan");}finally{c(false);}}},f=()=>{d&&(a(d),x());};return e?jsxs(Qt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:b=>b.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:x,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((b,w)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},w))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((b,w)=>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:b.title}),b.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},w)),d.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:g,value:s,onChange:b=>n(b.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),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((b,w)=>jsx("button",{onClick:()=>n(b),disabled:y,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:b},w))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:y&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:x,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsx("button",{onClick:f,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()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var wc={"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 Nw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Dw={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 Sw(e,t,a){let r=wc[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Ls(e){return `$${e.toFixed(4)}`}var kc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Sw(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,p)=>d+p.cost,0),s=a.reduce((d,p)=>d+p.inputTokens,0),n=a.reduce((d,p)=>d+p.outputTokens,0),l=a.filter(d=>d.success),c=a.reduce((d,p)=>d+p.duration,0),i={},m={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,m[d.feature]=(m[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:m,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 o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let l=this.operations.filter(m=>m.timestamp>=n).length,c=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:c,percentUsed:i,isExceeded:l>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},ln=new kc;function D0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(ln.getStats()),[s,n]=useState(ln.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(ln.getStats()),n(ln.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=ln.getRecentOperations(5);return jsxs(Qt,{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-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Ls(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,i])=>{let m=r.costsByFeature[c]||0,d=r.totalOperations>0?i/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children: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:Ls(m)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},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:Ls(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 M0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=useState(""),[c,i]=useState(""),[m,d]=useState(""),[p,g]=useState(false),[y,x]=useState(null),[h,f]=useState(null),[b,w]=useState(null),C=useRef(null),N=p||o;useEffect(()=>{e&&C.current&&C.current.focus();},[e]),useEffect(()=>{let I=S=>{S.key==="Escape"&&!N&&T();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,N]);let T=()=>{N||(l(""),i(""),d(""),x(null),f(null),w(null),t());},k=async()=>{if(!(!n.trim()||N)){g(true),x(null),f(null),w(null);try{let I=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:m||void 0});f(I.tasks.tasks),w({from_cache:I.from_cache,tokens_used:I.tokens_used,mock_mode:I.mock_mode,similarity:I.similarity,tokens_saved:I.tokens_saved});}catch(I){x(I instanceof Error?I.message:"Failed to generate tasks");}finally{g(false);}}},v=()=>{h&&(a(h),T());};if(!e)return null;let E=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxs(Qt,{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:I=>I.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:T,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children: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:[b?.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"}),b?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",E,"% similar)"]}):jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[b?.tokens_used||0," tokens"]}),b?.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:[b.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((I,S)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxs("span",{className:"text-xs text-white/50",children:["#",S+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:I.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"})]}),I.start," \u2192 ",I.end]}),jsxs("span",{children:[I.duration," days"]}),I.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",I.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${I.priority==="high"?"bg-red-500/20 text-red-400":I.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:I.priority})]})},I.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:C,value:n,onChange:I=>l(I.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:N}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:c,onChange:I=>i(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:m,onChange:I=>d(I.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:N})]})]}),y&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),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((I,S)=>jsx("button",{onClick:()=>l(I),disabled:N,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:I},S))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:N&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:T,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),h?jsx("button",{onClick:v,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:k,disabled:!n.trim()||N,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #2E94FF 0%, #2E94FF 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function ol({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(h=>{t&&Vs(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(f,b,w)=>{console.warn(`Retry attempt ${b} after ${w}ms: ${f.message}`);}}).then(f=>{f.success||console.error(`Failed to persist board after ${f.attempts} attempts:`,f.error);});},[t]),s=useCallback(async(h,f,b)=>{r(w=>{let C=w.cards.find(I=>I.id===h);if(!C)return w;let N=C.columnId,T={...C,columnId:f,position:b},k=w.cards.map(I=>I.id===h?T:I),v=w.columns.map(I=>{if(I.id===N)return {...I,cardIds:I.cardIds.filter(S=>S!==h)};if(I.id===f){let S=k.filter(X=>X.columnId===f).sort((X,O)=>X.position-O.position);return {...I,cardIds:S.map(X=>X.id)}}return I}),E={...w,cards:k,columns:v};return o(E),E});},[o]),n=useCallback(async(h,f)=>{r(b=>{let w=b.cards.map(N=>N.id===h?{...N,...f}:N),C={...b,cards:w};return o(C),C});},[o]),l=useCallback(async h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let w={...h,id:f},C=b.columns.map(T=>T.id===h.columnId?{...T,cardIds:[...T.cardIds,f]}:T),N={...b,cards:[...b.cards,w],columns:C};return o(N),N});},[o]),c=useCallback(async h=>{r(f=>{let b=f.cards.find(T=>T.id===h);if(!b)return f;let w=f.cards.filter(T=>T.id!==h),C=f.columns.map(T=>T.id===b.columnId?{...T,cardIds:T.cardIds.filter(k=>k!==h)}:T),N={...f,cards:w,columns:C};return o(N),N});},[o]),i=useCallback(async h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let w={...h,id:f,cardIds:[]},C={...b,columns:[...b.columns,w]};return o(C),C});},[o]),m=useCallback(async(h,f)=>{r(b=>{let w=b.columns.map(N=>N.id===h?{...N,...f}:N),C={...b,columns:w};return o(C),C});},[o]),d=useCallback(async h=>{r(f=>{let b=f.cards.filter(N=>N.columnId!==h),w=f.columns.filter(N=>N.id!==h),C={...f,cards:b,columns:w};return o(C),C});},[o]),p=useCallback(h=>{let f=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(h),f},[l]),g=useCallback(h=>{let f=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),f},[i]),y=useCallback(()=>{r(h=>{let f={...h,cards:[],columns:[]};return o(f),f});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:m,onColumnDelete:d},setBoard:r,helpers:{addCard:p,addColumn:g,deleteCard:c,deleteColumn:d,clearBoard:y}}}function P0({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=ol({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(c,i,m={})=>{s.addCard({title:i,columnId:c,position:r.cards.filter(d=>d.columnId===c).length,...m});},addColumn:(c,i)=>{let m=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:c,position:i??m+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:n}}var Is={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},L0={by:"none",order:"asc"};function I0({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...Is,...e}),[s,n]=useState({...L0,...t}),l=useCallback(x=>{o(h=>({...h,...x}));},[]),c=useCallback(x=>{n(h=>({...h,...x}));},[]),i=useCallback(()=>{o(Is),n(L0);},[]),m=useCallback(()=>{a&&o({...Is,assignees:[a]});},[a]),d=useCallback(()=>{o({...Is,dateFilter:"overdue"});},[]),p=useCallback(()=>{o({...Is,priorities:["HIGH","URGENT"]});},[]),g=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),y=useCallback(x=>{let h=[...x];if(r.search){let f=r.search.toLowerCase();h=h.filter(b=>b.title.toLowerCase().includes(f)||b.description?.toLowerCase().includes(f));}if(r.dateFilter!=="all"){let f=new Date,b=f.getFullYear(),w=String(f.getMonth()+1).padStart(2,"0"),C=String(f.getDate()).padStart(2,"0"),N=`${b}-${w}-${C}`;h=h.filter(T=>{if(!T.endDate&&!T.dueDate)return false;let k=T.endDate||T.dueDate;if(!k)return false;let v;if(typeof k=="string")v=k.split("T")[0]||k;else {let E=k.getUTCFullYear(),I=String(k.getUTCMonth()+1).padStart(2,"0"),S=String(k.getUTCDate()).padStart(2,"0");v=`${E}-${I}-${S}`;}switch(r.dateFilter){case "overdue":return v<N;case "today":return v===N;case "this-week":let E=new Date(N+"T00:00:00"),I=new Date(v+"T00:00:00"),S=new Date(E);return S.setDate(S.getDate()+7),I>=E&&I<=S;case "custom":if(r.dateRange){let X=typeof k=="string"?new Date(k):k;return X>=r.dateRange.start&&X<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(h=h.filter(f=>f.priority&&r.priorities.includes(f.priority))),r.assignees.length>0&&(h=h.filter(f=>(f.assignedUserIds||(f.assigneeId?[f.assigneeId]:[])).some(w=>r.assignees.includes(w)))),r.labels.length>0&&(h=h.filter(f=>f.labels&&f.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(h=h.filter(f=>r.columns.includes(f.columnId))),s.by!=="none"&&h.sort((f,b)=>{let w=0;switch(s.by){case "created":let C=f.createdAt?new Date(f.createdAt).getTime():0,N=b.createdAt?new Date(b.createdAt).getTime():0;w=C-N;break;case "priority":let T={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},k=T[f.priority||"LOW"],v=T[b.priority||"LOW"];w=k-v;break;case "dueDate":let E=f.endDate||f.dueDate,I=b.endDate||b.dueDate;if(!E)return 1;if(!I)return -1;let S=typeof E=="string"?new Date(E).getTime():E.getTime(),X=typeof I=="string"?new Date(I).getTime():I.getTime();w=S-X;break;case "title":w=f.title.localeCompare(b.title);break;case "estimate":let O=f.estimatedTime||0,$=b.estimatedTime||0;w=O-$;break;default:w=0;}return s.order==="asc"?w:-w}),h},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:m,filterOverdue:d,filterHighPriority:p,applyFilters:y,hasActiveFilters:g}}var R0,O0;if(typeof window<"u")try{let e=Us("ai");R0=e.generateObject,O0=e.generateText;}catch{}function $0(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(R0&&O0&&e.apiKey),n=useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let g=p instanceof Error?p:new Error("Failed to generate plan");throw o(g),g}finally{a(false);}},[s]),l=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let g=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(g),g}finally{a(false);}},[s]),c=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(p){let g=p instanceof Error?p:new Error("Failed to predict risks");throw o(g),g}finally{a(false);}},[s]),i=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(p){let g=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(g),g}finally{a(false);}},[s]),m=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(p){let g=p instanceof Error?p:new Error("Failed to estimate effort");throw o(g),g}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:m,isAvailable:s,isLoading:t,error:r}}function Tc(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function H0(e){let{cards:t}=e,[a,r]=Tc(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=useCallback((d,p)=>{if(!p){r({selectedCardIds:[d],lastSelectedCardId:d});return}let g=p.ctrlKey||p.metaKey,y=p.shiftKey;if(g)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(x=>x!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(y&&a.lastSelectedCardId){let x=t.find(f=>f.id===d),h=t.find(f=>f.id===a.lastSelectedCardId);if(x&&h&&x.columnId===h.columnId){let f=t.filter(v=>v.columnId===x.columnId).sort((v,E)=>v.position-E.position),b=f.findIndex(v=>v.id===a.lastSelectedCardId),w=f.findIndex(v=>v.id===d),[C,N]=b<w?[b,w]:[w,b],T=f.slice(C,N+1).map(v=>v.id),k=Array.from(new Set([...a.selectedCardIds,...T]));r({selectedCardIds:k,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),m=useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:m}}var z0={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function U0(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...z0,...a}),[a]),[s,n]=useState([]),l=useCallback((x,h,f,b,w)=>{if(h.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let C={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:h,columnId:f,strategy:b,color:w,isExpanded:true,position:s.filter(N=>N.columnId===f).length,createdAt:new Date};n(N=>[...N,C]);},[o.minCardsPerStack,s]),c=useCallback(x=>{n(h=>h.filter(f=>f.id!==x));},[]),i=useCallback(x=>{n(h=>h.map(f=>f.id===x?{...f,isExpanded:!f.isExpanded}:f));},[]),m=useCallback((x,h)=>{n(f=>f.map(b=>b.id===x&&!b.cardIds.includes(h)?{...b,cardIds:[...b.cardIds,h]}:b));},[]),d=useCallback((x,h)=>{n(f=>f.map(b=>{if(b.id===x){let w=b.cardIds.filter(C=>C!==h);return w.length<o.minCardsPerStack?null:{...b,cardIds:w}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),p=useCallback(x=>s.filter(h=>h.columnId===x).sort((h,f)=>h.position-f.position),[s]),g=useCallback(async x=>{let h=t.filter(N=>N.columnId===x);if(h.length<o.minCardsPerStack*2)return [];let f=[],b=new Map;h.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(T=>{b.has(T)||b.set(T,[]),b.get(T).push(N);});}),b.forEach((N,T)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F4CC} ${T}`,cardIds:N.map(k=>k.id),columnId:x,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${T}"`,confidence:.85});});let w=new Map;h.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(T=>{w.has(T)||w.set(T,[]),w.get(T).push(N);});}),w.forEach((N,T)=>{N.length>=o.minCardsPerStack&&f.push({stack:{title:`\u{1F464} Assigned to user-${T.slice(-4)}`,cardIds:N.map(k=>k.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let C=new Map;if(h.forEach(N=>{N.priority&&(C.has(N.priority)||C.set(N.priority,[]),C.get(N.priority).push(N));}),C.forEach((N,T)=>{if(N.length>=o.minCardsPerStack){let k={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[T.toLowerCase()]||"\u26AA";f.push({stack:{title:`${k} ${T} Priority`,cardIds:N.map(v=>v.id),columnId:x,strategy:"priority",color:T==="high"||T==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${T} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of h){let k=(await r.findSimilar(N,h)).filter(v=>v.similarity>=o.autoStackConfidenceThreshold);if(k.length>=o.minCardsPerStack-1){let v=[N.id,...k.map(I=>I.card.id)],E=k.reduce((I,S)=>I+S.similarity,0)/k.length;f.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:v,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${k.length+1} similar tasks`,confidence:E});}}return f.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,T)=>T.confidence-N.confidence).slice(0,5)},[t,o,r]),y=useCallback(x=>{l(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[l]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let f=await g(h),b=f[0];f.length>0&&b&&b.confidence>=.9&&y(b);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:m,removeFromStack:d,getStacksForColumn:p,getSuggestions:g,applySuggestion:y,config:o}}var W0=createContext(null);function G0({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(c=>{let{Column:i}=Us("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=Us("@libxai/core");n.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=Us("@libxai/core");l=new c(t.board);}r.current=new BoardStore({board:l,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(W0.Provider,{value:{store:o},children:e})}function nl(){let e=useContext(W0);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Rs(){let e=nl(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let l=useCallback(b=>{e.updateBoard(b);},[e]),c=useCallback(b=>{e.addColumn(b);},[e]),i=useCallback((b,w)=>{e.updateColumn(b,w);},[e]),m=useCallback(b=>{e.deleteColumn(b);},[e]),d=useCallback(b=>e.getColumn(b),[e]),p=useCallback(b=>{e.addCard(b);},[e]),g=useCallback((b,w)=>{e.updateCard(b,w);},[e]),y=useCallback(b=>{e.deleteCard(b);},[e]),x=useCallback((b,w,C)=>{e.moveCard(b,w,C);},[e]),h=useCallback(b=>e.getCard(b),[e]),f=useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:m,getColumn:d,addCard:p,updateCard:g,deleteCard:y,moveCard:x,getCard:h,getCardsByColumn:f}}function j0(e){let{cards:t}=Rs();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function _0(e="position",t="asc"){let{cards:a}=Rs();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=o.priority?l[o.priority]:0,i=s.priority?l[s.priority]:0;n=c-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var sl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=nu.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let n=s[t];if(typeof n=="function")try{let l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},Vw=new sl;function q0({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:c}){let i=useRef(null),m=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=m.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=n?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:p,className:o,children:jsx("div",{style:g,children:d.map(y=>{let x=e[y.index];if(!x)return null;let h=c?c(x,y.index):y.index,f={position:"absolute",top:n?0:y.start,left:n?y.start:0,width:n?y.size:"100%",height:n?"100%":y.size};return jsx("div",{style:f,"data-index":y.index,children:r(x,y.index)},h)})})})}function Y0(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 J0({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:c,horizontal:i=true}){let m=useRef(null),d=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:n,gap:l}),p=d.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},y={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:m,style:g,className:s,children:jsx("div",{style:y,children:p.map(x=>{let h=e[x.index];if(!h)return null;let f=c?c(h,x.index):x.index,b={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsx("div",{style:b,"data-index":x.index,children:o(h,x.index)},f)})})})}function Q0(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 Z0(e,t=10){return e>t}var Ec={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Mc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Fc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Pc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ac={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Lc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Ic={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Bc={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)"},Rc={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)"},Oc={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},$c={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}},Hc={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}},il={spacing:Ec,borderRadius:Mc,fontSize:Fc,fontWeight:Pc,lineHeight:Ac,zIndex:Lc,duration:Ic,easing:Bc,shadows:Rc,opacity:Oc,kanban:$c,gantt:Hc};function ef(e,t,a){return e[t]??a}function zc(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?zc(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function Kw(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Uc(e="asakaa"){let t=zc(il),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=Kw(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
414
414
|
${a.join(`
|
|
415
415
|
`)}
|
|
416
|
-
}`}function
|
|
416
|
+
}`}function Os(e,t="asakaa"){let a=[],r=zc(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
|
|
417
417
|
${a.join(`
|
|
418
418
|
`)}
|
|
419
|
-
}`}var
|
|
419
|
+
}`}var ll={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},Wc={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#2563eb"},priority:{low:"#9ca3af",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#f9fafb"}},Gc={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#71717a",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#71717a",weekend:"#27272a"}};function Vc(e=ll,t="asakaa"){let a=Uc(t),r=Os(e,t);return `${a}
|
|
420
420
|
|
|
421
421
|
${r}`}function tf(){return `/**
|
|
422
422
|
* ASAKAA Design Tokens
|
|
@@ -424,21 +424,21 @@ ${r}`}function tf(){return `/**
|
|
|
424
424
|
* Do not edit this file directly
|
|
425
425
|
*/
|
|
426
426
|
|
|
427
|
-
${
|
|
427
|
+
${Vc(ll)}
|
|
428
428
|
|
|
429
429
|
/* Light theme */
|
|
430
430
|
[data-theme="light"] {
|
|
431
|
-
${
|
|
431
|
+
${Os(Wc,"asakaa").split(`
|
|
432
432
|
`).slice(1,-1).join(`
|
|
433
433
|
`)}
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
/* Neutral theme */
|
|
437
437
|
[data-theme="neutral"] {
|
|
438
|
-
${
|
|
438
|
+
${Os(Gc,"asakaa").split(`
|
|
439
439
|
`).slice(1,-1).join(`
|
|
440
440
|
`)}
|
|
441
441
|
}
|
|
442
|
-
`}var qw=({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 af({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=
|
|
443
|
-
export{D0 as AIUsageDashboard,Dw as AI_FEATURES,
|
|
442
|
+
`}var qw=({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 af({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=Sn();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,l])=>{let c=n,i=c===r;return jsxs("button",{onClick:()=>o(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(qw,{theme:c})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:l.displayName})]},c)})})}
|
|
443
|
+
export{D0 as AIUsageDashboard,Dw as AI_FEATURES,wc as AI_MODELS,Vl as AddCardButton,Hl as AddColumnButton,io as AttachmentUploader,G0 as BoardProvider,mi as BulkOperationsToolbar,ad as BurnDownChart,Zg as CUSTOM_FIELD_TYPES,c0 as CalendarBoard,go as Card,Xl as CardDetailModal,Zl as CardDetailModalV2,h0 as CardHistoryReplay,f0 as CardHistoryTimeline,v0 as CardRelationshipsGraph,hw as CardStack,dd as CardTemplateSelector,yl as CircuitBreaker,vn as Column,xi as ColumnManager,Kl as CommandPalette,md as ConfigMenu,Pn as ContextMenu,cs as DEFAULT_SHORTCUTS,Jg as DEFAULT_TABLE_COLUMNS,ld as DEFAULT_TEMPLATES,Xn as DateRangePicker,Qn as DependenciesSelector,hs as DependencyLine,rd as DistributionCharts,Dl as EditableColumnTitle,Cn as ErrorBoundary,Jp as ExportDropdown,ud as ExportImportModal,pd as FilterBar,Fm as GANTT_AI_SYSTEM_PROMPT,Ii as GanttAIAssistant,Dm as GanttBoard,Mn as GanttI18nContext,Mi as GanttMilestone,yi as GanttToolbar,M0 as GenerateGanttTasksDialog,C0 as GeneratePlanModal,sd as GroupBySelector,Al as HealthBar,Fo as KanbanBoard,Ol as KanbanToolbar,is as KanbanViewAdapter,id as KeyboardShortcutsHelp,Xg as ListView,ua as MenuIcons,sl as PluginManager,_o as PrioritySelector,Ll as ProfitabilityReport,Jo as QuickTaskCreate,Nw as RATE_LIMITS,Qg as STANDARD_FIELDS,od as SwimlaneBoardView,El as TagBadge,Wu as TagList,So as TagPicker,Ti as TaskBar,bo as TaskDetailModal,Mm as TaskFormModal,wi as TaskGrid,hd as ThemeModal,Hp as ThemeProvider,af as ThemeSwitcher,oo as TimeInputPopover,Ml as TimePill,Fl as TimePopover,Pi as Timeline,qo as UserAssignmentSelector,td as VelocityChart,J0 as VirtualGrid,q0 as VirtualList,ln as aiUsageTracker,Mc as borderRadius,Gs as calculatePosition,bc as calendarDarkTheme,uc as calendarEnTranslations,pc as calendarEsTranslations,hc as calendarLightTheme,yc as calendarNeutralTheme,tl as calendarThemes,Ji as calendarTranslations,Oi as cardToGanttTask,Om as cardsToGanttTasks,u as cn,yp as createKanbanView,If as createRetryWrapper,gd as darkTheme,ll as darkTokenTheme,fi as defaultTheme,il as designTokens,Ic as duration,Bc as easing,tf as exportTokensToCSS,wo as findTaskByName,Fc as fontSize,Pc as fontWeight,Ls as formatCost,hi as ganttEnTranslations,Up as ganttEsTranslations,Rm as ganttTaskToCardUpdate,ht as ganttThemes,Hc as ganttTokens,yd as ganttTranslations,Se as ganttUtils,Uc as generateCSSVariables,Vc as generateCompleteCSS,Ff as generateInitialPositions,Pm as generateTasksContext,Os as generateThemeVariables,u0 as getCalendarTheme,Ss as getCalendarTranslations,e0 as getListViewTheme,Ud as getListViewTranslations,t0 as getMonthNames,ef as getToken,Wp as getTranslations,a0 as getWeekdayNames,$c as kanbanTokens,fd as lightTheme,Wc as lightTokenTheme,Ac as lineHeight,lc as listViewDarkTheme,Hd as listViewEnTranslations,zd as listViewEsTranslations,dc as listViewLightTheme,cc as listViewNeutralTheme,Xi as listViewThemes,$i as listViewTranslations,Qi as mergeCalendarTranslations,Hi as mergeListViewTranslations,xd as mergeTranslations,bd as neutralTheme,Gc as neutralTokenTheme,Oc as opacity,Im as parseLocalCommand,Rd as parseNaturalDate,Od as parseNaturalDuration,$d as parseProgress,Lm as parseStatus,Vw as pluginManager,Lf as retrySyncOperation,Vs as retryWithBackoff,Rc as shadows,Z0 as shouldVirtualizeGrid,Ec as spacing,en as themes,$0 as useAI,P0 as useBoard,Rs as useBoardCore,nl as useBoardStore,U0 as useCardStacking,Bl as useDragState,j0 as useFilteredCards,I0 as useFilters,Rr as useGanttI18n,ol as useKanbanState,Rp as useKeyboardShortcuts,H0 as useMultiSelect,Tc as useSelectionState,_0 as useSortedCards,Sn as useTheme,Q0 as useVirtualGrid,Y0 as useVirtualList,Bm as validateAIResponse,jl as withErrorBoundary,_s as wouldCreateCircularDependency,Lc as zIndex};//# sourceMappingURL=index.js.map
|
|
444
444
|
//# sourceMappingURL=index.js.map
|