@libxai/board 1.4.12 → 1.4.14
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 +25 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +25 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,selectionStore,BoardStore}from'@libxai/core';export{Board as BoardModel,BoardStore,Card as CardModel,Column as ColumnModel,DependencyEngine,Store}from'@libxai/core';import {createContext,memo,useRef,useState,forwardRef,useContext,useCallback,useEffect,useMemo,useImperativeHandle,useLayoutEffect,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import Jm 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,FileText,Timer,Clock,Tag,BarChart,CalendarCheck,Users,Flag,CircleDot,Moon,Sun,Palette,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,File,User,Check,CalendarDays,X,Hourglass,Play,Square,Diamond,Upload,MessageSquare,Rows3,Filter,FileImage,FileSpreadsheet,FileJson,FolderKanban,Download,ChevronLeft,GripVertical,Smile,Paperclip,Send,AlertCircle,Milestone,List,Search,Loader2}from'lucide-react';import {Command}from'cmdk';import
|
|
2
|
-
`)}async function
|
|
3
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}async function Wd(e,t,a,r){switch(t){case "json":return
|
|
4
|
-
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=Vd(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=Vd(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((f,v)=>{i[f]=l[v]||"";});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 Vd(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 _d(e,t){switch(t){case "json":return Vg(e);case "csv":return _g(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function jd(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 mi=createContext(null);function Kd(){return useContext(mi)}var qd=createContext(null);function Yd({children:e,themeName:t}){return jsx(qd.Provider,{value:{themeName:t},children:e})}function Fo(){return useContext(qd)}function ht({children:e,container:t}){let[a,r]=useState(false),o=Kd(),s=Fo();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 ec={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},Qg="#BDC3C7",ef=({color:e})=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function co({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),l=useRef(null),c=useRef(null),i=()=>{if(!c.current)return;let f=c.current.getBoundingClientRect(),v=window.innerHeight,w=window.innerWidth,g=160,y=220,h=4,b=f.right-g;b<10&&(b=f.left),b+g>w-10&&(b=w-g-10);let x=v-f.bottom,N=f.top,D;x>=y+h?D=f.bottom+h:N>=y+h?D=f.top-y-h:D=x>=N?f.bottom+h:Math.max(10,f.top-y-h),n({top:D,left:b}),o(true);};useEffect(()=>{let f=v=>{l.current&&!l.current.contains(v.target)&&!c.current?.contains(v.target)&&o(false);};if(r)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),useEffect(()=>{let f=v=>{v.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r]);let m=f=>{t(f),o(false);},d=e?ec[e]:null,p=d?.color||Qg;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(ht,{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(ec).map(([f,v])=>jsxs("button",{onClick:()=>m(f),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:v.color,background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsx(ef,{color:v.color}),jsx("span",{className:"font-semibold text-sm",children:v.label}),e===f&&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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},f)),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: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("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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var tf=[{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 an({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=(Fo()?.themeName||"dark")==="dark",f=()=>{if(!i.current)return;let b=i.current.getBoundingClientRect(),x=window.innerHeight,N=window.innerWidth,D=320,T=380,k=4,O=b.left;O+D>N-10&&(O=N-D-10),O<10&&(O=10);let I=x-b.bottom,C=b.top,H;I>=T+k?H=b.bottom+k:C>=T+k?H=b.top-T-k:H=I>=C?b.bottom+k:Math.max(10,b.top-T-k),l({top:H,left:O}),s(true);};useEffect(()=>{let b=x=>{c.current&&!c.current.contains(x.target)&&!i.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[o]),useEffect(()=>{let b=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[o]);let v=b=>{let x=new Date,N=O=>{let I=O.getFullYear(),C=String(O.getMonth()+1).padStart(2,"0"),H=String(O.getDate()).padStart(2,"0");return `${I}-${C}-${H}`},D=N(x),T=new Date(x);T.setDate(T.getDate()+b);let k=N(T);a(D,k),s(false);},w=()=>{if(!e||!t)return "Set date";let b=T=>{if(T instanceof Date)return T;if(typeof T!="string"||!T.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=T.split("-").map(Number);if(k.length!==3||k.some(H=>isNaN(H)))return null;let O=k[0],I=k[1],C=k[2];return O===void 0||I===void 0||C===void 0?null:new Date(O,I-1,C)},x=b(e),N=b(t);if(!x||!N||isNaN(x.getTime())||isNaN(N.getTime()))return "Set date";let D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${D[x.getMonth()]} ${x.getDate()} \u2013 ${D[N.getMonth()]} ${N.getDate()}`},g=e&&t,h=(()=>{if(!t)return false;let b=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),b<x})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,onClick:()=>o?s(false):f(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:g?`${w()}`:"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:w()})]}),o&&jsx(ht,{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:tf.map(b=>jsx("button",{onClick:()=>v(b.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:x=>{x.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:b.label},b.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:b=>a(b.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:b=>a(e,b.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:b=>{b.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:b=>{b.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function uo({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),f=()=>{if(!p.current)return;let h=p.current.getBoundingClientRect(),b=window.innerHeight,x=window.innerWidth,N=300,D=380,T=4,k=h.right-N;k<10&&(k=h.left),k+N>x-10&&(k=x-N-10);let O=b-h.bottom,I=h.top,C;O>=D+T?C=h.bottom+T:I>=D+T?C=h.top-D-T:C=O>=I?h.bottom+T:Math.max(10,h.top-D-T),m({top:C,left:k}),n(true);};useEffect(()=>{let h=b=>{d.current&&!d.current.contains(b.target)&&!p.current?.contains(b.target)&&(n(false),c(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),useEffect(()=>{let h=b=>{b.key==="Escape"&&(n(false),c(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let v=h=>{let b=e.some(x=>x.id===h.id);a(b?e.filter(x=>x.id!==h.id):[...e,h]);},w=t.filter(h=>h.name.toLowerCase().includes(l.toLowerCase())),g=e.slice(0,o),y=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:p,onClick:()=>s?n(false):f(),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:[g.map(h=>jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),y>0&&jsxs("div",{className:"asakaa-avatar",children:["+",y]})]}):jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsx(ht,{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:h=>c(h.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:w.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"}):w.map(h=>{let b=e.some(x=>x.id===h.id);return jsxs("button",{onClick:()=>v(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:h.color,color:"#fff"},children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials}),jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:h.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:b?"#3b82f6":"transparent"},children:b?"\u2713":""})]},h.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 Gn(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 on({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),[f,v]=useState({top:0,left:0}),[w,g]=useState(null),y=useRef(null),h=useRef(null),b=()=>{if(!h.current)return;let k=h.current.getBoundingClientRect(),O=window.innerHeight,I=window.innerWidth,C=300,H=d?380:120,R=4,Q=k.right-C;Q<10&&(Q=k.left),Q+C>I-10&&(Q=I-C-10);let S=O-k.bottom,G=k.top,ne;S>=H+R?ne=k.bottom+R:G>=H+R?ne=k.top-H-R:ne=S>=G?k.bottom+R:Math.max(10,k.top-H-R),v({top:ne,left:Q}),c(true);};useEffect(()=>{if(!l||!h.current)return;let k=h.current.getBoundingClientRect(),O=window.innerHeight,I=window.innerWidth,C=300,H=d?380:120,R=4,Q=k.right-C;Q<10&&(Q=k.left),Q+C>I-10&&(Q=I-C-10);let S=O-k.bottom,G=k.top,ne;S>=H+R?ne=k.bottom+R:G>=H+R?ne=k.top-H-R:ne=S>=G?k.bottom+R:Math.max(10,k.top-H-R),v({top:ne,left:Q});},[d,l]),useEffect(()=>{let k=O=>{y.current&&!y.current.contains(O.target)&&!h.current?.contains(O.target)&&(c(false),m(""));};if(l)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),useEffect(()=>{let k=O=>{O.key==="Escape"&&(c(false),m(""));};if(l)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[l]);let x=k=>{let O=t.includes(k),I=a.find(C=>C.id===k);if(g(null),O){let C=t.filter(H=>H!==k);r(C),C.length===0&&p(false);}else {if(s&&Gn(a,k,e)){let H=`Cannot add "${I?.title||k}" as dependency - would create circular reference`;g(H),n?.(k,I?.title||k),setTimeout(()=>g(null),3e3);return}r([...t,k]),p(true);}},N=()=>{let k=!d;p(k),k||r([]);},D=a.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(i.toLowerCase())||k.id.toLowerCase().includes(i.toLowerCase())),T=t.length>0?"#3B82F6":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:h,onClick:()=>l?c(false):b(),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:T,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:T},children:t.length})]}),l&&jsx(ht,{children:jsxs("div",{ref:y,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${f.top}px`,left:`${f.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:[w&&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:w})]}),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:k=>m(k.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:D.length===0?jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):D.map(k=>{let O=t.includes(k.id);return jsxs("button",{onClick:()=>x(k.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:O?"#3b82f6":"transparent",borderColor:O?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:O&&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:k.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:k.id})]})]},k.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 Mr=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:f,isDragging:v}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),w={transform:zn.Transform.toString(p),transition:f};if(t)return jsx("div",{ref:d,style:w,...i,...m,onClick:()=>a?.(e),children:t(e)});let g=l.filter(x=>e.assignedUserIds?.includes(x.id)),y=e.progress===100,h=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),b={...w,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:d,style:b,className:u("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...m,onClick:x=>{x.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:x=>{x.currentTarget.style.display="none";}})}),h.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsx("img",{src:h[0].url,alt:h[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:x=>{x.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((x,N)=>jsxs("div",{className:"relative",children:[jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:D=>{D.currentTarget.style.display="none";}}),N===3&&h.length>4&&jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxs("span",{className:"text-white text-sm font-medium",children:["+",h.length-4]})})]},x.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:y?"line-through":"none",opacity:y?.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:x=>x.stopPropagation(),className:"priority-selector",children:jsx(co,{priority:e.priority,onChange:x=>n?.(e.id,{priority:x})})}),jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsx(an,{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:(x,N)=>n?.(e.id,{startDate:x,endDate:N})})}),l.length>0&&jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsx(uo,{assignedUsers:g,availableUsers:l,onChange:x=>n?.(e.id,{assignedUserIds:x.map(N=>N.id)})})}),jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsx(on,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:c,onChange:x=>n?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsx("span",{className:"asakaa-label",children:x},x))}),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:"#3B82F6"},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:"#3B82F6"}})})]})]})},(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&&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)));Mr.displayName="Card";var Vn={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"}},cc=({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 mc({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(Vn).map(([g,y])=>({id:g,label:y.label,color:y.color,icon:y.icon})),...r.filter(g=>!Object.keys(Vn).includes(g.id)).map(g=>({id:g.id,label:g.title,color:g.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let g=Vn[e];if(g)return {...g,id:e};let y=r.find(h=>h.id===e);return y?{id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}:{...Vn.todo,id:"todo"}},p=()=>{if(!i.current)return;let g=i.current.getBoundingClientRect(),y=window.innerHeight,h=window.innerWidth,b=180,x=280,N=4,D=g.right-b;D<10&&(D=g.left),D+b>h-10&&(D=h-b-10);let T=y-g.bottom,k=g.top,O;T>=x+N?O=g.bottom+N:k>=x+N?O=g.top-x-N:O=T>=k?g.bottom+N:Math.max(10,g.top-x-N),l({top:O,left:D}),s(true);};useEffect(()=>{let g=y=>{c.current&&!c.current.contains(y.target)&&!i.current?.contains(y.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),useEffect(()=>{let g=y=>{y.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let f=g=>{t(g),s(false);},v=d(),w=v.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:`${w}10`,boxShadow:`0 0 0 2px ${w}30 inset`},title:v.label,children:jsx(cc,{icon:v.icon,color:w})}),o&&jsx(ht,{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(g=>jsxs("button",{onClick:()=>f(g.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:g.color,background:"transparent"},onMouseEnter:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsx(cc,{icon:g.icon,color:g.color}),jsx("span",{className:"font-semibold",children:g.label}),e===g.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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g.id))})]})})]})}function uc({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=useState(false),[l,c]=useState(false),[i,m]=useState(e),[d,p]=useState({top:0,left:0}),f=useRef(null),v=useRef(null),w=useRef(null);useEffect(()=>{if(s&&v.current){let b=v.current.getBoundingClientRect();p({top:b.bottom+window.scrollY+8,left:b.left+window.scrollX});}},[s]),useEffect(()=>{let b=x=>{f.current&&!f.current.contains(x.target)&&!v.current?.contains(x.target)&&(n(false),c(false));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),useEffect(()=>{let b=x=>{x.key==="Escape"&&(n(false),c(false),m(e));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s,e]),useEffect(()=>{l&&w.current&&(w.current.focus(),w.current.select());},[l]);let g=()=>{c(true),m(e);},y=()=>{let b=i.trim();b&&b!==e&&t(b),c(false),n(false),m(e);},h=b=>{b.key==="Enter"?y():b.key==="Escape"&&(c(false),m(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:v,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",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"})]})}),s&&jsx(ht,{children:jsx("div",{ref:f,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.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:"Rename Column"}),jsx("input",{ref:w,type:"text",value:i,onChange:b=>m(b.target.value),onKeyDown:h,onBlur:y,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:"Column name",maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:g,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:"Rename"})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),n(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:"Delete"})]})]})]})})})]})}var Io=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:f,onColumnRename:v,onColumnDelete:w,isDeletable:g=false,className:y})=>{let{setNodeRef:h,isOver:b}=useDroppable({id:e.id,data:{type:"column",column:e}}),x=useRef(null),N=m??$d(t.length),D=useVirtualizer({count:t.length,getScrollElement:()=>x.current,estimateSize:()=>d,enabled:N});if(a)return jsx("div",{ref:h,className:y,children:a(e,t)});let k=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let C=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:C}:C>=80?{state:"warning",percentage:C}:C>=60?{state:"approaching",percentage:C}:{state:"ok",percentage:C}})(),O=k.state==="exceeded",I=()=>"asakaa-column-count";return jsxs("div",{ref:h,className:u("asakaa-column",b&&"ring-2 ring-asakaa-accent-blue",O&&"ring-2 ring-asakaa-accent-red",y),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(I()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&k.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${k.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[k.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"})]}),k.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"})]}),k.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"})}),k.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"})]})]}),(v||w)&&jsx(uc,{columnTitle:e.title,onRename:C=>v?.(e.id,C),onDelete:w?()=>w(e.id):void 0,isDeletable:g}),f&&jsx("button",{onClick:f,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),!p&&jsx("div",{ref:x,className:"asakaa-column-cards",style:{maxHeight:N?"600px":void 0},children:jsx(SortableContext,{items:t.map(C=>C.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"})}):N?jsx("div",{style:{height:`${D.getTotalSize()}px`,position:"relative"},children:D.getVirtualItems().map(C=>{let H=t[C.index];return H?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${C.start}px)`},children:jsx(Mr,{card:H,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i})},H.id):null})}):t.map(C=>jsx(Mr,{card:C,render:r,onClick:n,onUpdate:l,availableUsers:c,allCards:i},C.id))})})]})});Io.displayName="Column";function hi({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 wf(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 yc(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 Cf(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Tf(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Nf=["\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 vc({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:f,onRemoveFile:v,maxFileSizeMB:w=10}){let g=l==="dark",[y,h]=useState(false),[b,x]=useState([]),[N,D]=useState(0),[T,k]=useState(null),[O,I]=useState(false),C=useRef(null),H=useRef(null),R=useRef(null),Q=useRef(null),S=useCallback((E,q)=>{let ee=wf(E,q);if(k(ee),ee){let fe=r.filter(ue=>ue.name.toLowerCase().includes(ee.query)||ue.email&&ue.email.toLowerCase().includes(ee.query)).slice(0,5);x(fe),h(fe.length>0),D(0);}else h(false),x([]);},[r]),G=E=>{let q=E.target.value;if(t(q),S(q,E.target.selectionStart||0),C.current){C.current.style.height="24px";let ee=C.current.scrollHeight,fe=280,ue=Math.min(ee,fe);C.current.style.height=`${ue}px`,C.current.style.overflowY=ee>fe?"auto":"hidden";}},ne=()=>{C.current&&S(e,C.current.selectionStart||0);},Ce=useCallback(E=>{if(!T||!C.current)return;let q=e.slice(0,T.start),ee=e.slice(T.end),fe=`@${E.name.replace(/\s+/g,"")} `,ue=q+fe+ee;t(ue),h(false),k(null),setTimeout(()=>{if(C.current){let pe=T.start+fe.length;C.current.selectionStart=pe,C.current.selectionEnd=pe,C.current.focus();}},0);},[T,e,t]),A=E=>{if(y&&b.length>0)switch(E.key){case "ArrowDown":E.preventDefault(),D(q=>q<b.length-1?q+1:0);break;case "ArrowUp":E.preventDefault(),D(q=>q>0?q-1:b.length-1);break;case "Enter":{E.preventDefault();let q=b[N];q&&Ce(q);break}case "Tab":{E.preventDefault();let q=b[N];q&&Ce(q);break}case "Escape":E.preventDefault(),h(false);break}else E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),a());};useEffect(()=>{let E=q=>{H.current&&!H.current.contains(q.target)&&C.current&&!C.current.contains(q.target)&&h(false),Q.current&&!Q.current.contains(q.target)&&I(false);};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]);let Pe=useCallback(E=>{if(!C.current)return;let q=C.current.selectionStart||e.length,ee=e.slice(0,q)+E+e.slice(q);t(ee),I(false),setTimeout(()=>{if(C.current){let fe=q+E.length;C.current.selectionStart=fe,C.current.selectionEnd=fe,C.current.focus();}},0);},[e,t]),L=useCallback(E=>{if(!f||!E.target.files)return;let q=Array.from(E.target.files),ee=w*1024*1024,fe=q.filter(ue=>ue.size>ee?(console.warn(`File ${ue.name} exceeds max size of ${w}MB`),false):true);fe.length>0&&f(fe),E.target.value="";},[f,w]),U=useCallback(E=>E.type.startsWith("image/")?Image:E.type.includes("pdf")||E.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(y&&H.current){let E=H.current.children[N];E&&E.scrollIntoView({block:"nearest"});}},[N,y]),jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:p.map(E=>{let q=U(E.file),ee=E.file.type.startsWith("image/");return jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",g?"bg-white/10":"bg-gray-100"),children:[ee&&E.preview?jsx("img",{src:E.preview,alt:E.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(q,{className:u("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:u("text-xs truncate",g?"text-white":"text-gray-900"),children:E.file.name}),jsx("p",{className:u("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:Tf(E.file.size)})]}),v&&jsx("button",{onClick:()=>v(E.id),className:u("p-0.5 rounded-full transition-colors",g?"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"})})]},E.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",g?"bg-white/5":"bg-white border border-gray-200"),children:[m&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>I(!O),disabled:s||n,className:u("p-1 rounded transition-colors flex-shrink-0",g?"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:O&&jsx(motion.div,{ref:Q,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",g?"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:Nf.map(E=>jsx("button",{type:"button",onClick:()=>Pe(E),className:u("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",g?"hover:bg-white/10":"hover:bg-gray-100"),children:E},E))})})})]}),d&&f&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>R.current?.click(),disabled:s||n,className:u("p-1.5 rounded transition-colors",g?"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:R,type:"file",multiple:true,onChange:L,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:C,value:e,onChange:G,onSelect:ne,onKeyDown:A,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",g?"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":g?"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:y&&b.length>0&&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 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:b.map((E,q)=>jsxs("button",{type:"button",onClick:()=>Ce(E),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",q===N?g?"bg-white/10":"bg-gray-100":g?"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:E.color||"#8B5CF6"},children:Cf(E.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:u("text-sm font-medium truncate",g?"text-white":"text-gray-900"),children:E.name}),E.email&&jsx("p",{className:u("text-xs truncate",g?"text-[#6B7280]":"text-gray-500"),children:E.email})]})]},E.id))})})]})]})]})}function xc({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 Yn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function _r({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),[f,v]=useState(Yn[10]||"#3B82F6"),[w,g]=useState({top:0,left:0}),y=useRef(null),h=useRef(null),b=useRef(null),x=useRef(null),N=t.filter(C=>C.name.toLowerCase().includes(i.toLowerCase())),D=t.some(C=>C.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(l&&h.current){let C=h.current.getBoundingClientRect();g({top:C.bottom+6,left:C.left});}},[l]),useEffect(()=>{let C=H=>{let R=H.target,Q=y.current?.contains(R),S=b.current?.contains(R);!Q&&!S&&(c(false),m(""),p(false));};if(l)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[l]),useEffect(()=>{l&&x.current&&x.current.focus();},[l]);let T=C=>{let H=e.some(R=>R.id===C.id);a(H?e.filter(R=>R.id!==C.id):[...e,C]);},k=async()=>{if(!(!r||!i.trim())){p(true);try{let C=await r(i.trim(),f);C&&(a([...e,C]),m(""),v(Yn[Math.floor(Math.random()*Yn.length)]||"#3B82F6"));}finally{p(false);}}},O=(C,H)=>{H.stopPropagation(),a(e.filter(R=>R.id!==C));},I={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:y,className:"relative",children:[jsxs("button",{ref:h,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(C=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${C.color}20`,color:C.color},children:C.name},C.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:b,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:w.top,left:w.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:x,type:"text",value:i,onChange:C=>m(C.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:C=>{C.key==="Enter"&&i.trim()&&!D&&r&&k();}})}),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(C=>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:`${C.color}20`,color:C.color},onClick:H=>O(C.id,H),children:[C.name,jsx(X,{className:"w-3 h-3"})]},C.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(C=>{let H=e.some(R=>R.id===C.id);return jsxs("button",{type:"button",onClick:()=>T(C),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:H?`${C.color}15`:"transparent",color:o.textPrimary},onMouseEnter:R=>{H||(R.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:R=>{H||(R.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:C.color}}),jsx("span",{className:"flex-1 text-left",children:C.name}),H&&jsx(Check,{className:"w-4 h-4",style:{color:C.color}})]},C.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()&&!D&&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:Yn.map(C=>jsx("button",{type:"button",onClick:()=>v(C),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:C,outline:f===C?`2px solid ${C}`:"none",outlineOffset:"2px"}},C))}),jsxs("button",{type:"button",onClick:k,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:f,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 yi({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 wc({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(yi,{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 go=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{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 Cc(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 If(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 Bf({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 vi({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=If(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=Cc(e.loggedMinutes),i=e.estimateMinutes?Cc(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(Bf,{className:l[t]}),jsx("span",{children:m})]})}function Nc(e){let t=e.trim().toLowerCase();if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?0:Math.round(o*60)}function Jn(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 $f(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 zf({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function Uf({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 Dc({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 Hf({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 xi({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,f]=useState(""),[v,w]=useState(t.estimateMinutes?Jn(t.estimateMinutes):""),[g,y]=useState(""),[h,b]=useState(false),[x,N]=useState(false),D=useRef(null);useEffect(()=>{D.current?.focus();},[]);let T=async()=>{let I=Nc(p);if(!(I<=0||!s)){b(true);try{await s({durationMinutes:I,note:g.trim()||void 0,source:"manual"}),f(""),y("");}finally{b(false);}}},k=async()=>{if(!n)return;let I=v.trim()?Nc(v):null;await n(I),N(false);},O=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),T()),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(Dc,{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:$f(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(Uf,{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(Dc,{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(zf,{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(Hf,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:D,type:"text",value:p,onChange:I=>f(I.target.value),onKeyDown:O,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:T,disabled:h||!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:g,onChange:I=>y(I.target.value),onKeyDown:O,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:Jn(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"}),x?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:v,onChange:I=>w(I.target.value),onKeyDown:I=>{I.key==="Enter"&&k(),I.key==="Escape"&&N(false);},onBlur:k,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?Jn(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:Jn(I.durationMinutes)})]},I.id))})]})]})}function _f(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function jf(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function fo({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,c]=useState(jf(r)),[i,m]=useState(""),[d,p]=useState(false),f=useRef(null);useEffect(()=>{f.current?.focus();},[]);let v=async()=>{p(true);let b=_f(l);await o(b&&b>0?b:null,i||void 0),p(false);},w=async()=>{p(true),await o(null),p(false);},g=b=>{b.key==="Enter"&&!b.shiftKey&&(b.preventDefault(),v()),b.key==="Escape"&&s();},y={estimate:t==="es"?"Duraci\xF3n estimada":"Estimated duration",quoted:t==="es"?"Tiempo ofertado":"Quoted time",log:t==="es"?"Registrar tiempo":"Log time"},h={estimate:"8 (=8h)",quoted:"8 (=8h)",log:"8 (=8h)"};return jsxs("div",{className:u("w-64 p-3 rounded-lg shadow-xl border",a?"bg-[#1F2937] border-[#374151]":"bg-white border-gray-200",n),onClick:b=>b.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:u("text-sm font-medium",a?"text-white":"text-gray-900"),children:y[e]}),jsx("button",{type:"button",onClick:s,className:u("p-1 rounded transition-colors",a?"hover:bg-white/10 text-gray-400":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsxs("div",{className:"mb-3",children:[jsx("input",{ref:f,type:"text",value:l,onChange:b=>c(b.target.value),onKeyDown:g,placeholder:h[e],className:u("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")}),jsx("p",{className:u("text-xs mt-1",a?"text-gray-500":"text-gray-400"),children:t==="es"?"Ej: 8 (=8h), 1h 30m, 45m, 2:30":"e.g. 8 (=8h), 1h 30m, 45m, 2:30"})]}),e==="log"&&jsx("div",{className:"mb-3",children:jsx("input",{type:"text",value:i,onChange:b=>m(b.target.value),onKeyDown:g,placeholder:t==="es"?"Comentario (opcional)":"Comment (optional)",className:u("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})}),jsx("button",{type:"button",onClick:v,disabled:d||!l.trim(),className:u("w-full py-2 px-3 text-sm font-medium rounded-lg transition-colors","bg-blue-600 hover:bg-blue-700 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:d?t==="es"?"Guardando...":"Saving...":t==="es"?"Guardar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:w,disabled:d,className:u("w-full mt-2 py-1.5 px-3 text-xs font-medium rounded-lg transition-colors",a?"text-gray-400 hover:text-red-400 hover:bg-red-500/10":"text-gray-500 hover:text-red-600 hover:bg-red-50"),children:t==="es"?"Quitar valor":"Clear value"})]})}function Kf(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 qf(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 Ci({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Kf(e.health),s=qf(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 Bo(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 Xf(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 Jf(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 Zf(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 Qf({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?"+":"",Bo(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:Bo(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:Bo(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 e0({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?Bo(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:Bo(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,Bo(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",Jf(e.status,a),Xf(e.status,a)),children:Zf(e.status,t)})})]})}function Ti({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",l=n?"bg-[#0F1117]":"bg-gray-50",c=n?"bg-[#1A1D25]":"bg-white",i=n?"border-white/5":"border-gray-200",m=n?"text-[#E5E7EB]":"text-gray-900",d=n?"text-[#9CA3AF]":"text-gray-500",p=n?"bg-[#0F1117]/50":"bg-gray-50",f=useMemo(()=>e?[...e.tasks].sort((v,w)=>v.varianceMinutes===null?1:w.varianceMinutes===null?-1:w.varianceMinutes-v.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(Qf,{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:f.map(v=>jsx(e0,{task:v,locale:a,isDark:n,onClick:s},v.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 Ro(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 g0(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 Rc(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 f0(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 Ar({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:f=[],comments:v=[],onAddComment:w,currentUser:g,mentionableUsers:y=[],onUploadCommentAttachments:h,enableTimeTracking:b=false,timeTrackingSummary:x,timeEntries:N=[],isTimerRunning:D=false,timerElapsedSeconds:T=0,onTimeLog:k,onEstimateUpdate:O,onSoldEffortUpdate:I,onTimerStart:C,onTimerStop:H,onTimerDiscard:R,blurFinancials:Q=false}){let S=s==="dark",G={textTertiary:S?"#6B7280":"#9CA3AF",textSecondary:S?"#9CA3AF":"#6B7280",textPrimary:S?"#FFFFFF":"#111827",borderLight:S?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:S?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:S?"#1A1D25":"#FFFFFF",bgSecondary:S?"#0F1117":"#F9FAFB",hoverBg:S?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},ne=e&&"title"in e&&!("name"in e),Ce=e,[A,Pe]=useState(e?Rc(e,l):null),[L,U]=useState(false),[E,q]=useState(false),[ee,fe]=useState(false),[ue,pe]=useState(null),[Oe,ae]=useState(new Date),[nt,Fe]=useState(false),[qe,ut]=useState(false),[St,je]=useState(""),[Ft,it]=useState(false),[pt,ie]=useState(false),[B,Z]=useState(false),[ce,ke]=useState(false),[$e,Xe]=useState(""),at=useRef(null),ze=useRef(null),[oa,W]=useState(""),Y=useRef(null),[be,Ye]=useState(""),[Te,De]=useState(false),[X$1,re]=useState([]),[_,Ie]=useState(""),[Ae,Ge]=useState(false),He=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 M=Rc(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:M?.id,taskName:M?.name,soldEffortMinutes:M?.soldEffortMinutes,quotedMinutes:M?.quotedMinutes,effortMinutes:M?.effortMinutes,timeLoggedMinutes:M?.timeLoggedMinutes}),Pe(M),Xe(M.description||""),W(M.name||"");}},[e?.id,e?.quotedMinutes,l,t]),useEffect(()=>{if(!t||!$e)return;let M=setTimeout(()=>{let oe=ze.current;oe&&(oe.style.height="auto",oe.style.height=`${Math.max(100,oe.scrollHeight)}px`);},50);return ()=>clearTimeout(M)},[t,$e]),useEffect(()=>()=>{at.current&&clearTimeout(at.current),Y.current&&clearTimeout(Y.current);},[]),useEffect(()=>{t&&He.current&&v.length>0&&setTimeout(()=>{He.current&&(He.current.scrollTop=He.current.scrollHeight);},100);},[t,v.length]);let Be=useCallback(M=>{Pe(M),ne&&o&&Ce?o(f0(M,Ce)):r&&r(M);},[ne,Ce,o,r]),z=useCallback(()=>{U(false),q(false),fe(false),pe(null),ut(false),je(""),it(false);},[]),j=useCallback((M,oe)=>{if(!A)return;let Re={...A,[M]:oe};Be(Re);},[A,Be]),ye=useCallback(()=>{let M=ze.current;M&&(M.style.height="auto",M.style.height=`${Math.max(100,M.scrollHeight)}px`);},[]),Ve=useCallback(M=>{Xe(M),setTimeout(ye,0),at.current&&clearTimeout(at.current),at.current=setTimeout(()=>{if(A){let oe={...A,description:M};Be(oe);}},800);},[A,Be,ye]),Ke=useCallback(M=>{W(M),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{if(A&&M.trim()){let oe={...A,name:M.trim()};Be(oe);}},800);},[A,Be]),V=useCallback(M=>{let oe=M.map(Re=>{let Je={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Re};return Re.type.startsWith("image/")&&(Je.preview=URL.createObjectURL(Re)),Je});re(Re=>[...Re,...oe]);},[]),le=useCallback(M=>{re(oe=>{let Re=oe.find(Je=>Je.id===M);return Re?.preview&&URL.revokeObjectURL(Re.preview),oe.filter(Je=>Je.id!==M)});},[]),_e=useCallback(async()=>{if(!(!A||!be.trim()&&X$1.length===0||!w)){De(true);try{let M=yc(be,y),oe=[];if(X$1.length>0&&h){let Re=X$1.map(Je=>Je.file);oe=await h(Re);}await w(A.id,be.trim(),M.length>0?M:void 0,oe.length>0?oe:void 0),Ye(""),X$1.forEach(Re=>{Re.preview&&URL.revokeObjectURL(Re.preview);}),re([]);}finally{De(false);}}},[A,be,X$1,w,y,h]),yt=useCallback(()=>{if(!A||!_.trim())return;let M={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:_.trim(),progress:0,startDate:new Date,endDate:new Date},oe=[...A.subtasks||[],M],Re={...A,subtasks:oe};Be(Re),Ie(""),Ge(false);},[A,_,Be]),lt=useCallback(M=>{if(!A?.subtasks)return;let oe=A.subtasks.map(Je=>Je.id===M?{...Je,progress:Je.progress===100?0:100}:Je),Re={...A,subtasks:oe};Be(Re);},[A,Be]),sr=useCallback(M=>{if(!A?.subtasks)return;let oe=A.subtasks.filter(Je=>Je.id!==M),Re={...A,subtasks:oe};Be(Re);},[A,Be]),xr=useCallback(M=>{let oe=typeof M=="string"?new Date(M):M,Je=new Date().getTime()-oe.getTime(),la=Math.floor(Je/6e4),ha=Math.floor(Je/36e5),Zt=Math.floor(Je/864e5);return la<1?n==="es"?"Ahora":"Just now":la<60?n==="es"?`Hace ${la} min`:`${la}m ago`:ha<24?n==="es"?`Hace ${ha}h`:`${ha}h ago`:Zt<7?n==="es"?`Hace ${Zt}d`:`${Zt}d ago`:oe.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),ir=useCallback(M=>{if(!A)return;let oe=A.progress||0;M==="completed"?oe=100:M==="in-progress"&&oe===0?oe=10:M==="todo"&&(oe=0);let Re={...A,status:M,progress:oe};Be(Re),U(false);},[A,Be]),Xa=useCallback((M,oe)=>{if(!A)return;let Re={...A,startDate:M,endDate:oe};Be(Re);},[A,Be]),Ne=useCallback(()=>{let M=Oe.getFullYear(),oe=Oe.getMonth(),Re=new Date(M,oe,1),la=new Date(M,oe+1,0).getDate(),ha=Re.getDay(),Zt=[],lr=new Date(M,oe,0).getDate();for(let Ea=ha-1;Ea>=0;Ea--)Zt.push({date:new Date(M,oe-1,lr-Ea),isCurrentMonth:false});for(let Ea=1;Ea<=la;Ea++)Zt.push({date:new Date(M,oe,Ea),isCurrentMonth:true});let Na=42-Zt.length;for(let Ea=1;Ea<=Na;Ea++)Zt.push({date:new Date(M,oe+1,Ea),isCurrentMonth:false});return Zt},[Oe]),vt=useCallback(async M=>{if(M.preventDefault(),M.stopPropagation(),Z(false),!A||!d)return;let oe=Array.from(M.dataTransfer.files);if(oe.length!==0){ke(true);try{await d(A.id,oe);}finally{ke(false);}}},[A,d]),At=useCallback(async M=>{if(!A||!d||!M.target.files)return;let oe=Array.from(M.target.files);if(oe.length!==0){ke(true);try{await d(A.id,oe);}finally{ke(false);}M.target.value="";}},[A,d]),Ja=useCallback(M=>{M.preventDefault(),M.stopPropagation(),Z(true);},[]),Et=useCallback(M=>{M.preventDefault(),M.stopPropagation(),Z(false);},[]),zr=useCallback(M=>M<1024?`${M} B`:M<1024*1024?`${(M/1024).toFixed(1)} KB`:`${(M/(1024*1024)).toFixed(1)} MB`,[]),Za=useCallback(M=>M.startsWith("image/")?Image:M.includes("pdf")||M.includes("document")?FileText:File,[]);return !t||!A?null:jsx(AnimatePresence,{children:t&&A&&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",S?"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]",S?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:u("w-4 h-4",S?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",S?"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",S?"text-[#6B7280]":"text-gray-400"),children:A.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 M=A.progress===100?0:100,Re={...A,progress:M,status:M===100?"completed":"todo"};Be(Re);},className:u("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",A.progress===100?"bg-green-500 border-green-500":S?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:A.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:oa,onChange:M=>Ke(M.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",A.progress===100?"line-through text-[#6B7280]":S?"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",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{z(),U(!L);},className:u("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",A.progress===100||A.status==="completed"?"bg-green-500/20 text-green-400":A.progress&&A.progress>0||A.status==="in-progress"?"bg-blue-500/20 text-blue-400":S?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:A.progress===100||A.status==="completed"?n==="es"?"COMPLETADO":"DONE":A.progress&&A.progress>0||A.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:L&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>U(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]",S?"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(M=>jsxs("button",{onClick:()=>ir(M.id),className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",A.status===M.id&&(S?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",M.color)}),jsx("span",{className:S?"text-white":"text-gray-900",children:M.label})]},M.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:u("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{z(),fe(!ee);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[A.assignees&&A.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[A.assignees.slice(0,3).map((M,oe)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:M.color||"#8B5CF6"},title:M.name,children:M.initials||M.name.slice(0,2).toUpperCase()},oe)),A.assignees.length>3&&jsxs("span",{className:u("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:["+",A.assignees.length-3]})]}):jsx("span",{className:u("text-sm",S?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:u("w-3 h-3",S?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:ee&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>fe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className: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",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(M=>{let oe=A.assignees?.some(Re=>Re.name===M.name);return jsxs("button",{onClick:()=>{let Re=A.assignees||[],Je;oe?Je=Re.filter(la=>la.name!==M.name):Je=[...Re,M],j("assignees",Je);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",oe&&(S?"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:M.color||"#8B5CF6"},children:M.initials||M.name.slice(0,2).toUpperCase()}),jsx("span",{className:u("flex-1",S?"text-white":"text-gray-900"),children:M.name}),oe&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},M.name)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",S?"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",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{pe(ue?null:"start"),ae(A.startDate||new Date);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[A.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:u("mx-1",S?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),A.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:ue&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>pe(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:u("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:M=>M.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",S?"border-white/10":"border-gray-200"),children:[(()=>{let M=new Date,oe=new Date(M);oe.setDate(M.getDate()+1);let Re=new Date(M);Re.setDate(M.getDate()+((6-M.getDay()+7)%7||7));let Je=new Date(M);Je.setDate(M.getDate()+((1-M.getDay()+7)%7||7));let la=new Date(M);la.setDate(M.getDate()+(6-M.getDay()+7)%7+7);let ha=new Date(M);ha.setDate(M.getDate()+14);let Zt=new Date(M);return Zt.setDate(M.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:M,display:M.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:oe,display:oe.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Re,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Je,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:la,display:la.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:ha,display:ha.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Zt,display:Zt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Na,Ea)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",S?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(ue==="start"){let en=A.endDate&&Na.date>A.endDate?Na.date:A.endDate;Xa(Na.date,en),pe("end");}else {let en=A.startDate&&Na.date<A.startDate?Na.date:A.startDate;Xa(en,Na.date),pe(null);}},children:[jsx("span",{children:Na.label}),jsx("span",{className:u("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:Na.display})]},Ea))})(),jsx("div",{className:u("border-t mt-2 pt-2",S?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{Xa(void 0,void 0),pe(null);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",S?"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",S?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:ue==="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:Oe.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>ae(new Date),className:u("p-1 rounded text-sm transition-colors",S?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>ae(new Date(Oe.getFullYear(),Oe.getMonth()-1)),className:u("p-1 rounded",S?"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:()=>ae(new Date(Oe.getFullYear(),Oe.getMonth()+1)),className:u("p-1 rounded",S?"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(M=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",S?"text-[#6B7280]":"text-gray-400"),children:M},M))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:Ne().map((M,oe)=>{let Re=M.date.toDateString()===new Date().toDateString(),Je=A.startDate?.toDateString()===M.date.toDateString(),la=A.endDate?.toDateString()===M.date.toDateString(),ha=Je||la,Zt=A.startDate&&A.endDate&&M.date>=A.startDate&&M.date<=A.endDate;return jsx("button",{onClick:()=>{let lr=new Date(M.date);if(ue==="start"){let Na=A.endDate&&lr>A.endDate?lr:A.endDate;Xa(lr,Na),pe("end");}else {let Na=A.startDate&&lr<A.startDate?lr:A.startDate;Xa(Na,lr),pe(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!M.isCurrentMonth&&(S?"text-[#4B5563]":"text-gray-300"),M.isCurrentMonth&&(S?"text-white":"text-gray-900"),Re&&"ring-2 ring-[#3B82F6]",Je&&"bg-[#3B82F6] text-white",la&&!Je&&"bg-[#7C3AED] text-white",Zt&&!ha&&(S?"bg-[#7C3AED]/20":"bg-purple-100"),!ha&&(S?"hover:bg-white/10":"hover:bg-gray-100")),children:M.date.getDate()},oe)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:u("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{z(),q(!E);},className:u("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",A.priority==="high"||A.priority==="urgent"?"bg-red-500/20 text-red-400":A.priority==="medium"?"bg-yellow-500/20 text-yellow-400":A.priority==="low"?"bg-green-500/20 text-green-400":S?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:A.priority?A.priority==="high"||A.priority==="urgent"?n==="es"?"Alta":"High":A.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:E&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>q(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]",S?"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(M=>jsxs("button",{onClick:()=>{j("priority",M.id),q(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",A.priority===M.id&&(S?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",M.color)}),jsx("span",{className:S?"text-white":"text-gray-900",children:M.label})]},M.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:u("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:u("text-sm",S?"text-white":"text-gray-900"),children:A.startDate&&A.endDate?`${Math.ceil((A.endDate.getTime()-A.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",S?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[nt?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:A.progress||0,onChange:M=>{let oe=parseInt(M.target.value),Re=A.status;oe===100?Re="completed":oe>0?Re="in-progress":Re="todo";let Je={...A,progress:oe,status:Re};Be(Je);},onBlur:()=>Fe(false),className:u("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",S?"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-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>Fe(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",S?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:u("h-full rounded-full transition-all",A.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${A.progress||0}%`}})}),jsxs("span",{className:u("text-sm font-medium min-w-[40px]",S?"text-white":"text-gray-900"),children:[A.progress||0,"%"]})]})]}),b&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:u("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:A.status==="completed"||A.progress===100?jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",S?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:x?.estimateMinutes?Ro(x.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):x?.estimateMinutes?jsx("button",{type:"button",onClick:()=>ie("estimate"),className:u("text-sm px-2 py-0.5 rounded",S?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Ro(x.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>ie("estimate"),className:u("text-sm",S?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:pt==="estimate"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(fo,{mode:"estimate",locale:n,isDark:S,currentValue:x?.estimateMinutes||null,onSave:async M=>{await O?.(A.id,M),ie(false);},onClose:()=>ie(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:u("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:Q?jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",S?"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"}):A.status==="completed"||A.progress===100?jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",S?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:A.quotedMinutes?Ro(A.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):A.quotedMinutes?jsx("button",{type:"button",onClick:()=>ie("quoted"),className:u("text-sm px-2 py-0.5 rounded",S?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Ro(A.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>ie("quoted"),className:u("text-sm",S?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:pt==="quoted"&&!Q&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(fo,{mode:"quoted",locale:n,isDark:S,currentValue:A.quotedMinutes||null,onSave:async M=>{I?(await I(A.id,M),Pe(oe=>oe?{...oe,quotedMinutes:M}:null)):j("quotedMinutes",M),ie(false);},onClose:()=>ie(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:u("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[A.status==="completed"||A.progress===100?jsx("div",{className:u("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",S?"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"})}):D?jsxs("button",{type:"button",onClick:()=>H?.(A.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"}),g0(T||0)]}):jsx("button",{type:"button",onClick:()=>C?.(A.id),className:u("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",S?"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"})}),A.status==="completed"||A.progress===100?jsxs("div",{className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",S?"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:()=>ie("log"),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",S?"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"]}),x&&x.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:u("text-sm font-medium",x.health==="over-budget"?"text-red-500":x.health==="at-risk"?"text-yellow-500":S?"text-white":"text-gray-900"),children:[Ro(x.loggedMinutes),x.estimateMinutes&&jsxs("span",{className:u("font-normal",S?"text-[#6B7280]":"text-gray-400"),children:[" / ",Ro(x.estimateMinutes)]})]}),x.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",x.health==="over-budget"?"bg-red-500":x.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,x.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:pt==="log"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(fo,{mode:"log",locale:n,isDark:S,currentValue:null,onSave:async(M,oe)=>{M&&await k?.(A.id,{durationMinutes:M,note:oe,source:"manual"}),ie(false);},onClose:()=>ie(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:u("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(_r,{selectedTags:A.tags||[],availableTags:c,onChange:M=>{j("tags",M);},onCreateTag:i,theme:G})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:u("w-4 h-4 mt-1.5",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[A.dependencies&&A.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:A.dependencies.map(M=>{let oe=f.find(Re=>Re.id===M);return jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",S?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[oe?.name||M.slice(0,8),jsx("button",{onClick:()=>{let Re=(A.dependencies||[]).filter(Je=>Je!==M);j("dependencies",Re);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},M)})}),jsxs("button",{onClick:()=>{z(),ut(!qe);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"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",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:qe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ut(false),je("");}}),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]",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:u("p-2 border-b",S?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:St,onChange:M=>je(M.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("w-full px-3 py-2 rounded-md text-sm outline-none",S?"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:f.length>0?f.filter(M=>M.id!==A.id).filter(M=>St===""||M.name.toLowerCase().includes(St.toLowerCase())).map(M=>{let oe=A.dependencies?.includes(M.id);return jsxs("button",{onClick:()=>{let Re=A.dependencies||[],Je;oe?Je=Re.filter(la=>la!==M.id):Je=[...Re,M.id],j("dependencies",Je);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",oe&&(S?"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",oe?"bg-blue-500 border-blue-500":S?"border-white/30":"border-gray-300"),children:oe&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:u("block truncate",S?"text-white":"text-gray-900"),children:M.name}),jsx("span",{className:u("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:M.id.slice(0,8)})]})]},M.id)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",S?"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",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{z(),it(!Ft);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"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:A.color||"#6366F1"}}),jsx("span",{className:u("text-sm",S?"text-white":"text-gray-900"),children:go.find(M=>M.value===A.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:u("w-3 h-3",S?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Ft&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>it(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",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:go.map(M=>{let oe=A.color===M.value;return jsx("button",{onClick:()=>{j("color",M.value),it(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",oe&&"ring-2 ring-offset-2",S?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:M.value,outlineColor:oe?M.value:void 0},title:M.name,children:oe&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},M.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:u("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"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:A.isMilestone||false,onChange:M=>j("isMilestone",M.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",A.isMilestone?"bg-purple-500 border-purple-500":S?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:u("text-sm",S?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",S?"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",S?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:u("text-sm font-semibold",S?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:ze,value:$e,onChange:M=>Ve(M.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",S?"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",S?"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",S?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",A.subtasks&&A.subtasks.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",S?"text-[#6B7280]":"text-gray-400"),children:["(",A.subtasks.filter(M=>M.progress===100).length,"/",A.subtasks.length,")"]})]})}),A.subtasks&&A.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:A.subtasks.map(M=>jsxs("div",{className:u("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",S?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>lt(M.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",M.progress===100?"bg-green-500 border-green-500":S?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:M.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:u("text-sm flex-1",M.progress===100?"line-through text-[#6B7280]":S?"text-white":"text-gray-900"),children:M.name}),jsx("button",{onClick:()=>sr(M.id),className:u("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",S?"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"})})]},M.id))}),Ae?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:_,onChange:M=>Ie(M.target.value),onKeyDown:M=>{M.key==="Enter"&&_.trim()?yt():M.key==="Escape"&&(Ge(false),Ie(""));},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",S?"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:yt,disabled:!_.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",_.trim()?"bg-blue-500 hover:bg-blue-600 text-white":S?"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:()=>{Ge(false),Ie("");},className:u("p-2 rounded-lg transition-colors",S?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>Ge(true),className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",S?"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",S?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold mb-3",S?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",m.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",S?"text-[#6B7280]":"text-gray-400"),children:["(",m.length,")"]})]}),m.length>0&&jsx("div",{className:"space-y-2 mb-4",children:m.map(M=>{let oe=Za(M.type),Re=M.type.startsWith("image/");return jsxs("div",{className:u("flex items-center gap-3 p-2 rounded-lg group transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Re&&M.thumbnailUrl?jsx("img",{src:M.thumbnailUrl,alt:M.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",S?"bg-white/10":"bg-gray-200"),children:jsx(oe,{className:u("w-5 h-5",S?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:M.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",S?"text-white":"text-gray-900"),children:M.name}),jsx("p",{className:u("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:zr(M.size)})]}),p&&jsx("button",{onClick:()=>p(M.id),className:u("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",S?"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"})})]},M.id)})}),jsxs("div",{onDragOver:Ja,onDragLeave:Et,onDrop:vt,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",B?S?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":S?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",ce&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:At,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||ce}),ce?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",S?"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",B?"text-blue-500":S?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:u("text-sm",S?"text-[#9CA3AF]":"text-gray-500"),children:B?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",S?"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",S?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between h-[49px]",S?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold",S?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",v.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",S?"text-[#6B7280]":"text-gray-400"),children:["(",v.length,")"]})]}),jsx("button",{onClick:a,className:u("p-1.5 rounded transition-colors",S?"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 Jm 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,FileText,Timer,Clock,Tag,BarChart,CalendarCheck,Users,Flag,CircleDot,Moon,Sun,Palette,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,File,User,Check,CalendarDays,X,Hourglass,Play,Square,Diamond,Upload,MessageSquare,Rows3,Filter,FileImage,FileSpreadsheet,FileJson,FolderKanban,Download,ChevronLeft,GripVertical,Smile,Paperclip,Send,AlertCircle,Milestone,List,Search,Loader2}from'lucide-react';import {Command}from'cmdk';import J0 from'react-markdown';import Z0 from'remark-gfm';import Q0 from'rehype-sanitize';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart as BarChart$1,Bar}from'recharts';var zn=(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 Un=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 [Un.Translate.toString(e),Un.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 Hn(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 Rg(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function ii(e,t){return e.length===0?1e3:t===0?Hn(null,e[0].position):t>=e.length?Hn(e[e.length-1].position,null):Hn(e[t-1].position,e[t].position)}function $d(e,t=100){return e>t}var Og=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 $g(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 Wn(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Og,onRetry:d}=t,m,i=0;for(let c=1;c<=a;c++){i=c;try{return {data:await e(),attempts:i,success:!0}}catch(l){if(m=l,c===a||!n(m,c))return {error:m,attempts:i,success:false};let f=$g(c,r,o,s);if(d)try{d(m,c,f);}catch(v){console.error("Error in retry callback:",v);}await new Promise(v=>setTimeout(v,f));}}return {error:m||new Error("Unknown error"),attempts:i,success:false}}function zg(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 Ug(e,t={}){return async(...a)=>Wn(()=>e(...a),t)}var li=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 zd=(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))(zd||{}),lo=class lo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,d=`[${a}] [${r}] [${s}]`,m=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(d,o,m?n:"");break;case "INFO":console.info(d,o,m?n:"");break;case "WARN":console.warn(d,o,m?n:"");break;case "ERROR":console.error(d,o,m?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",...lo.globalOptions};}static configure(t){lo.globalOptions={...lo.globalOptions,...t};}child(t){return new lo({...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 Gn((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Gn(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:zd[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};lo.globalOptions={};var di=lo,Gn=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}},Ud=new di;function Wg(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 Gg(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(d=>d.id===s.columnId);return [s.id,ci(s.title),ci(s.description||""),ci(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 Vg(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 Jm(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),d=n.toDataURL("image/png"),m=297,i=210,c=n.width/n.height,l=m-20,p=l/c;p>i-20&&(p=i-20,l=p*c);let f=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});f.setFontSize(16),f.setTextColor(255,255,255),f.setFillColor(10,10,10),f.rect(0,0,m,15,"F"),f.text(e.title||"Kanban Board",10,10);let v=(m-l)/2;return f.addImage(d,"PNG",v,20,l,p),f}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 d=e.cards.filter(m=>m.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,d.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):d.forEach(m=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(m.title,25,s),s+=6,m.description){o.setFontSize(9),o.setFont("helvetica","normal");let c=o.splitTextToSize(m.description,160);o.text(c,25,s),s+=c.length*5;}let i=[];if(m.priority&&i.push(`Priority: ${m.priority}`),m.labels&&m.labels.length>0&&i.push(`Labels: ${m.labels.join(", ")}`),m.assignedUserIds&&m.assignedUserIds.length>0&&i.push(`Assigned: ${m.assignedUserIds.length} user(s)`),m.startDate||m.endDate){let c=[];m.startDate&&c.push(`Start: ${m.startDate}`),m.endDate&&c.push(`End: ${m.endDate}`),i.push(c.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 ci(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function Wd(e,t,a,r){switch(t){case "json":return Wg(e,r);case "csv":return Gg(e);case "pdf":return await Vg(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Gd(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let c=`${r}.pdf`;e.save(c);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"},d=new Blob([e],{type:n[t]}),m=URL.createObjectURL(d),i=document.createElement("a");i.href=m,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(m);}function _g(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 jg(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=Vd(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let d=Vd(t[n]||"");if(d.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-d.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${d.length})`);continue}for(;d.length<a.length;)d.push("");let i={};a.forEach((f,v)=>{i[f]=d[v]||"";});let c=i.Column||"Unnamed";o.has(c)||o.set(c,{id:`col-${o.size+1}`,title:c,position:o.size+1,cardIds:[]});let l=o.get(c),p={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:l.id,position:l.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),l.cardIds.push(p.id);}catch(d){s.push(`Line ${n+1}: ${d instanceof Error?d.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 Vd(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 _d(e,t){switch(t){case "json":return _g(e);case "csv":return jg(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function jd(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 mi=createContext(null);function Kd(){return useContext(mi)}var qd=createContext(null);function Yd({children:e,themeName:t}){return jsx(qd.Provider,{value:{themeName:t},children:e})}function Ao(){return useContext(qd)}function gt({children:e,container:t}){let[a,r]=useState(false),o=Kd(),s=Ao();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:d,themeName:m}=o,i={"--asakaa-color-background-primary":d.bgPrimary,"--asakaa-color-background-secondary":d.bgSecondary,"--asakaa-color-background-card":d.bgGrid,"--asakaa-color-background-hover":d.hoverBg,"--asakaa-color-text-primary":d.textPrimary,"--asakaa-color-text-secondary":d.textSecondary,"--asakaa-color-text-tertiary":d.textTertiary,"--asakaa-color-text-inverse":d.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":d.border,"--asakaa-color-border-hover":d.borderLight,"--asakaa-color-border-subtle":d.borderLight,"--asakaa-color-interactive-primary":d.accent,"--asakaa-color-interactive-primaryHover":d.accentHover,"--asakaa-color-interactive-primaryBorder":`${d.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${d.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${d.accent}33`,"--asakaa-color-status-success":d.statusCompleted,"--asakaa-color-status-warning":d.milestone,"--asakaa-color-status-error":d.criticalPath,"--asakaa-color-danger":d.criticalPath,"--asakaa-color-danger-border":`${d.criticalPath}4D`,"--asakaa-color-danger-background":`${d.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${d.criticalPath}26`};return createPortal(jsx("div",{"data-theme":m,"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 ec={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},ef="#BDC3C7",tf=({color:e})=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function co({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),d=useRef(null),m=useRef(null),i=()=>{if(!m.current)return;let f=m.current.getBoundingClientRect(),v=window.innerHeight,w=window.innerWidth,g=160,y=220,h=4,b=f.right-g;b<10&&(b=f.left),b+g>w-10&&(b=w-g-10);let x=v-f.bottom,N=f.top,D;x>=y+h?D=f.bottom+h:N>=y+h?D=f.top-y-h:D=x>=N?f.bottom+h:Math.max(10,f.top-y-h),n({top:D,left:b}),o(true);};useEffect(()=>{let f=v=>{d.current&&!d.current.contains(v.target)&&!m.current?.contains(v.target)&&o(false);};if(r)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),useEffect(()=>{let f=v=>{v.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r]);let c=f=>{t(f),o(false);},l=e?ec[e]:null,p=l?.color||ef;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:m,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:l?.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(gt,{children:jsxs("div",{ref:d,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(ec).map(([f,v])=>jsxs("button",{onClick:()=>c(f),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:v.color,background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsx(tf,{color:v.color}),jsx("span",{className:"font-semibold text-sm",children:v.label}),e===f&&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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},f)),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:()=>c(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: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("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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var af=[{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 rn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,d]=useState({top:0,left:0}),m=useRef(null),i=useRef(null),p=(Ao()?.themeName||"dark")==="dark",f=()=>{if(!i.current)return;let b=i.current.getBoundingClientRect(),x=window.innerHeight,N=window.innerWidth,D=320,T=380,k=4,R=b.left;R+D>N-10&&(R=N-D-10),R<10&&(R=10);let I=x-b.bottom,C=b.top,W;I>=T+k?W=b.bottom+k:C>=T+k?W=b.top-T-k:W=I>=C?b.bottom+k:Math.max(10,b.top-T-k),d({top:W,left:R}),s(true);};useEffect(()=>{let b=x=>{m.current&&!m.current.contains(x.target)&&!i.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[o]),useEffect(()=>{let b=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[o]);let v=b=>{let x=new Date,N=R=>{let I=R.getFullYear(),C=String(R.getMonth()+1).padStart(2,"0"),W=String(R.getDate()).padStart(2,"0");return `${I}-${C}-${W}`},D=N(x),T=new Date(x);T.setDate(T.getDate()+b);let k=N(T);a(D,k),s(false);},w=()=>{if(!e||!t)return "Set date";let b=T=>{if(T instanceof Date)return T;if(typeof T!="string"||!T.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=T.split("-").map(Number);if(k.length!==3||k.some(W=>isNaN(W)))return null;let R=k[0],I=k[1],C=k[2];return R===void 0||I===void 0||C===void 0?null:new Date(R,I-1,C)},x=b(e),N=b(t);if(!x||!N||isNaN(x.getTime())||isNaN(N.getTime()))return "Set date";let D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${D[x.getMonth()]} ${x.getDate()} \u2013 ${D[N.getMonth()]} ${N.getDate()}`},g=e&&t,h=(()=>{if(!t)return false;let b=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),b<x})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,onClick:()=>o?s(false):f(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:g?`${w()}`:"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:w()})]}),o&&jsx(gt,{children:jsxs("div",{ref:m,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:af.map(b=>jsx("button",{onClick:()=>v(b.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:x=>{x.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:b.label},b.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:b=>a(b.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:b=>a(e,b.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:b=>{b.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:b=>{b.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function uo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[d,m]=useState(""),[i,c]=useState({top:0,left:0}),l=useRef(null),p=useRef(null),f=()=>{if(!p.current)return;let h=p.current.getBoundingClientRect(),b=window.innerHeight,x=window.innerWidth,N=300,D=380,T=4,k=h.right-N;k<10&&(k=h.left),k+N>x-10&&(k=x-N-10);let R=b-h.bottom,I=h.top,C;R>=D+T?C=h.bottom+T:I>=D+T?C=h.top-D-T:C=R>=I?h.bottom+T:Math.max(10,h.top-D-T),c({top:C,left:k}),n(true);};useEffect(()=>{let h=b=>{l.current&&!l.current.contains(b.target)&&!p.current?.contains(b.target)&&(n(false),m(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),useEffect(()=>{let h=b=>{b.key==="Escape"&&(n(false),m(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let v=h=>{let b=e.some(x=>x.id===h.id);a(b?e.filter(x=>x.id!==h.id):[...e,h]);},w=t.filter(h=>h.name.toLowerCase().includes(d.toLowerCase())),g=e.slice(0,o),y=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:p,onClick:()=>s?n(false):f(),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:[g.map(h=>jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),y>0&&jsxs("div",{className:"asakaa-avatar",children:["+",y]})]}):jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsx(gt,{children:jsxs("div",{ref:l,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:d,onChange:h=>m(h.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:w.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"}):w.map(h=>{let b=e.some(x=>x.id===h.id);return jsxs("button",{onClick:()=>v(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:h.color,color:"#fff"},children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.initials}),jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:h.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:b?"#3b82f6":"transparent"},children:b?"\u2713":""})]},h.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 Vn(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let i=m.dependencies.map(c=>{if(typeof c=="string")return c;let l=c;return l.taskId||l.targetId||""}).filter(Boolean);r.set(m.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,d=m=>{if(!s.has(m)){s.add(m),n.add(m);let i=r.get(m)||[];for(let c of i){if(!s.has(c)&&d(c))return true;if(n.has(c))return true}}return n.delete(m),false};return d(a)}function nn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[d,m]=useState(false),[i,c]=useState(""),[l,p]=useState(t.length>0),[f,v]=useState({top:0,left:0}),[w,g]=useState(null),y=useRef(null),h=useRef(null),b=()=>{if(!h.current)return;let k=h.current.getBoundingClientRect(),R=window.innerHeight,I=window.innerWidth,C=300,W=l?380:120,B=4,Q=k.right-C;Q<10&&(Q=k.left),Q+C>I-10&&(Q=I-C-10);let S=R-k.bottom,_=k.top,oe;S>=W+B?oe=k.bottom+B:_>=W+B?oe=k.top-W-B:oe=S>=_?k.bottom+B:Math.max(10,k.top-W-B),v({top:oe,left:Q}),m(true);};useEffect(()=>{if(!d||!h.current)return;let k=h.current.getBoundingClientRect(),R=window.innerHeight,I=window.innerWidth,C=300,W=l?380:120,B=4,Q=k.right-C;Q<10&&(Q=k.left),Q+C>I-10&&(Q=I-C-10);let S=R-k.bottom,_=k.top,oe;S>=W+B?oe=k.bottom+B:_>=W+B?oe=k.top-W-B:oe=S>=_?k.bottom+B:Math.max(10,k.top-W-B),v({top:oe,left:Q});},[l,d]),useEffect(()=>{let k=R=>{y.current&&!y.current.contains(R.target)&&!h.current?.contains(R.target)&&(m(false),c(""));};if(d)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[d]),useEffect(()=>{let k=R=>{R.key==="Escape"&&(m(false),c(""));};if(d)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[d]);let x=k=>{let R=t.includes(k),I=a.find(C=>C.id===k);if(g(null),R){let C=t.filter(W=>W!==k);r(C),C.length===0&&p(false);}else {if(s&&Vn(a,k,e)){let W=`Cannot add "${I?.title||k}" as dependency - would create circular reference`;g(W),n?.(k,I?.title||k),setTimeout(()=>g(null),3e3);return}r([...t,k]),p(true);}},N=()=>{let k=!l;p(k),k||r([]);},D=a.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(i.toLowerCase())||k.id.toLowerCase().includes(i.toLowerCase())),T=t.length>0?"#3B82F6":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:h,onClick:()=>d?m(false):b(),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:T,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:T},children:t.length})]}),d&&jsx(gt,{children:jsxs("div",{ref:y,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${f.top}px`,left:`${f.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:[w&&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:w})]}),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:l?"#3b82f6":"transparent",borderColor:l?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:l&&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"})]})}),l&&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:k=>c(k.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:D.length===0?jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):D.map(k=>{let R=t.includes(k.id);return jsxs("button",{onClick:()=>x(k.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:R?"#3b82f6":"transparent",borderColor:R?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:R&&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:k.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:k.id})]})]},k.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),p(false),m(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 Ar=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:d=[],allCards:m=[]})=>{let{attributes:i,listeners:c,setNodeRef:l,transform:p,transition:f,isDragging:v}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),w={transform:Un.Transform.toString(p),transition:f};if(t)return jsx("div",{ref:l,style:w,...i,...c,onClick:()=>a?.(e),children:t(e)});let g=d.filter(x=>e.assignedUserIds?.includes(x.id)),y=e.progress===100,h=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),b={...w,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:l,style:b,className:u("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...c,onClick:x=>{x.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:x=>{x.currentTarget.style.display="none";}})}),h.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsx("img",{src:h[0].url,alt:h[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:x=>{x.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((x,N)=>jsxs("div",{className:"relative",children:[jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:D=>{D.currentTarget.style.display="none";}}),N===3&&h.length>4&&jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxs("span",{className:"text-white text-sm font-medium",children:["+",h.length-4]})})]},x.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:y?"line-through":"none",opacity:y?.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:x=>x.stopPropagation(),className:"priority-selector",children:jsx(co,{priority:e.priority,onChange:x=>n?.(e.id,{priority:x})})}),jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsx(rn,{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:(x,N)=>n?.(e.id,{startDate:x,endDate:N})})}),d.length>0&&jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsx(uo,{assignedUsers:g,availableUsers:d,onChange:x=>n?.(e.id,{assignedUserIds:x.map(N=>N.id)})})}),jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsx(nn,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:m,onChange:x=>n?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsx("span",{className:"asakaa-label",children:x},x))}),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:"#3B82F6"},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:"#3B82F6"}})})]})]})},(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&&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)));Ar.displayName="Card";var _n={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"}},cc=({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 mc({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,d]=useState({top:0,left:0}),m=useRef(null),i=useRef(null),c=[...Object.entries(_n).map(([g,y])=>({id:g,label:y.label,color:y.color,icon:y.icon})),...r.filter(g=>!Object.keys(_n).includes(g.id)).map(g=>({id:g.id,label:g.title,color:g.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let g=_n[e];if(g)return {...g,id:e};let y=r.find(h=>h.id===e);return y?{id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}:{..._n.todo,id:"todo"}},p=()=>{if(!i.current)return;let g=i.current.getBoundingClientRect(),y=window.innerHeight,h=window.innerWidth,b=180,x=280,N=4,D=g.right-b;D<10&&(D=g.left),D+b>h-10&&(D=h-b-10);let T=y-g.bottom,k=g.top,R;T>=x+N?R=g.bottom+N:k>=x+N?R=g.top-x-N:R=T>=k?g.bottom+N:Math.max(10,g.top-x-N),d({top:R,left:D}),s(true);};useEffect(()=>{let g=y=>{m.current&&!m.current.contains(y.target)&&!i.current?.contains(y.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),useEffect(()=>{let g=y=>{y.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let f=g=>{t(g),s(false);},v=l(),w=v.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:`${w}10`,boxShadow:`0 0 0 2px ${w}30 inset`},title:v.label,children:jsx(cc,{icon:v.icon,color:w})}),o&&jsx(gt,{children:jsxs("div",{ref:m,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:c.map(g=>jsxs("button",{onClick:()=>f(g.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:g.color,background:"transparent"},onMouseEnter:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsx(cc,{icon:g.icon,color:g.color}),jsx("span",{className:"font-semibold",children:g.label}),e===g.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:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g.id))})]})})]})}function uc({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=useState(false),[d,m]=useState(false),[i,c]=useState(e),[l,p]=useState({top:0,left:0}),f=useRef(null),v=useRef(null),w=useRef(null);useEffect(()=>{if(s&&v.current){let b=v.current.getBoundingClientRect();p({top:b.bottom+window.scrollY+8,left:b.left+window.scrollX});}},[s]),useEffect(()=>{let b=x=>{f.current&&!f.current.contains(x.target)&&!v.current?.contains(x.target)&&(n(false),m(false));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),useEffect(()=>{let b=x=>{x.key==="Escape"&&(n(false),m(false),c(e));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s,e]),useEffect(()=>{d&&w.current&&(w.current.focus(),w.current.select());},[d]);let g=()=>{m(true),c(e);},y=()=>{let b=i.trim();b&&b!==e&&t(b),m(false),n(false),c(e);},h=b=>{b.key==="Enter"?y():b.key==="Escape"&&(m(false),c(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:v,onClick:()=>n(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",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"})]})}),s&&jsx(gt,{children:jsx("div",{ref:f,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${l.top}px`,left:`${l.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:d?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsx("input",{ref:w,type:"text",value:i,onChange:b=>c(b.target.value),onKeyDown:h,onBlur:y,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:"Column name",maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:g,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:"Rename"})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),n(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:"Delete"})]})]})]})})})]})}var Bo=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:d,availableUsers:m,allCards:i,enableVirtualization:c,cardHeight:l=120,isCollapsed:p,onToggleCollapse:f,onColumnRename:v,onColumnDelete:w,isDeletable:g=false,className:y})=>{let{setNodeRef:h,isOver:b}=useDroppable({id:e.id,data:{type:"column",column:e}}),x=useRef(null),N=c??$d(t.length),D=useVirtualizer({count:t.length,getScrollElement:()=>x.current,estimateSize:()=>l,enabled:N});if(a)return jsx("div",{ref:h,className:y,children:a(e,t)});let k=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let C=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:C}:C>=80?{state:"warning",percentage:C}:C>=60?{state:"approaching",percentage:C}:{state:"ok",percentage:C}})(),R=k.state==="exceeded",I=()=>"asakaa-column-count";return jsxs("div",{ref:h,className:u("asakaa-column",b&&"ring-2 ring-asakaa-accent-blue",R&&"ring-2 ring-asakaa-accent-red",y),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(I()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&k.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${k.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[k.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"})]}),k.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"})]}),k.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"})}),k.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"})]})]}),(v||w)&&jsx(uc,{columnTitle:e.title,onRename:C=>v?.(e.id,C),onDelete:w?()=>w(e.id):void 0,isDeletable:g}),f&&jsx("button",{onClick:f,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),!p&&jsx("div",{ref:x,className:"asakaa-column-cards",style:{maxHeight:N?"600px":void 0},children:jsx(SortableContext,{items:t.map(C=>C.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"})}):N?jsx("div",{style:{height:`${D.getTotalSize()}px`,position:"relative"},children:D.getVirtualItems().map(C=>{let W=t[C.index];return W?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${C.start}px)`},children:jsx(Ar,{card:W,render:r,onClick:n,onUpdate:d,availableUsers:m,allCards:i})},W.id):null})}):t.map(C=>jsx(Ar,{card:C,render:r,onClick:n,onUpdate:d,availableUsers:m,allCards:i},C.id))})})]})});Bo.displayName="Column";function hi({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),d=useRef(null);useEffect(()=>{r&&d.current&&(d.current.focus(),d.current.select());},[r]);let m=()=>{let c=s.trim();c&&c!==e?t(c):n(e),o(false);},i=c=>{c.key==="Enter"?m():c.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:d,type:"text",value:s,onChange:c=>n(c.target.value),onBlur:m,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 Cf(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 yc(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(d=>{let m=d.name.toLowerCase(),i=m.replace(/\s+/g,""),c=m.split(/\s+/);return !!(i===s||m===s||c.some(l=>l===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function Tf(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Nf(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Df=["\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 vc({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:d="dark",locale:m="es",currentUser:i,enableEmoji:c=true,enableAttachments:l=true,pendingFiles:p=[],onFilesSelect:f,onRemoveFile:v,maxFileSizeMB:w=10}){let g=d==="dark",[y,h]=useState(false),[b,x]=useState([]),[N,D]=useState(0),[T,k]=useState(null),[R,I]=useState(false),C=useRef(null),W=useRef(null),B=useRef(null),Q=useRef(null),S=useCallback((E,q)=>{let ee=Cf(E,q);if(k(ee),ee){let de=r.filter(he=>he.name.toLowerCase().includes(ee.query)||he.email&&he.email.toLowerCase().includes(ee.query)).slice(0,5);x(de),h(de.length>0),D(0);}else h(false),x([]);},[r]),_=E=>{let q=E.target.value;if(t(q),S(q,E.target.selectionStart||0),C.current){C.current.style.height="24px";let ee=C.current.scrollHeight,de=280,he=Math.min(ee,de);C.current.style.height=`${he}px`,C.current.style.overflowY=ee>de?"auto":"hidden";}},oe=()=>{C.current&&S(e,C.current.selectionStart||0);},Te=useCallback(E=>{if(!T||!C.current)return;let q=e.slice(0,T.start),ee=e.slice(T.end),de=`@${E.name.replace(/\s+/g,"")} `,he=q+de+ee;t(he),h(false),k(null),setTimeout(()=>{if(C.current){let ge=T.start+de.length;C.current.selectionStart=ge,C.current.selectionEnd=ge,C.current.focus();}},0);},[T,e,t]),A=E=>{if(y&&b.length>0)switch(E.key){case "ArrowDown":E.preventDefault(),D(q=>q<b.length-1?q+1:0);break;case "ArrowUp":E.preventDefault(),D(q=>q>0?q-1:b.length-1);break;case "Enter":{E.preventDefault();let q=b[N];q&&Te(q);break}case "Tab":{E.preventDefault();let q=b[N];q&&Te(q);break}case "Escape":E.preventDefault(),h(false);break}else E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),a());};useEffect(()=>{let E=q=>{W.current&&!W.current.contains(q.target)&&C.current&&!C.current.contains(q.target)&&h(false),Q.current&&!Q.current.contains(q.target)&&I(false);};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[]);let Ee=useCallback(E=>{if(!C.current)return;let q=C.current.selectionStart||e.length,ee=e.slice(0,q)+E+e.slice(q);t(ee),I(false),setTimeout(()=>{if(C.current){let de=q+E.length;C.current.selectionStart=de,C.current.selectionEnd=de,C.current.focus();}},0);},[e,t]),L=useCallback(E=>{if(!f||!E.target.files)return;let q=Array.from(E.target.files),ee=w*1024*1024,de=q.filter(he=>he.size>ee?(console.warn(`File ${he.name} exceeds max size of ${w}MB`),false):true);de.length>0&&f(de),E.target.value="";},[f,w]),U=useCallback(E=>E.type.startsWith("image/")?Image:E.type.includes("pdf")||E.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(y&&W.current){let E=W.current.children[N];E&&E.scrollIntoView({block:"nearest"});}},[N,y]),jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:p.map(E=>{let q=U(E.file),ee=E.file.type.startsWith("image/");return jsxs("div",{className:u("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",g?"bg-white/10":"bg-gray-100"),children:[ee&&E.preview?jsx("img",{src:E.preview,alt:E.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(q,{className:u("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:u("text-xs truncate",g?"text-white":"text-gray-900"),children:E.file.name}),jsx("p",{className:u("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:Nf(E.file.size)})]}),v&&jsx("button",{onClick:()=>v(E.id),className:u("p-0.5 rounded-full transition-colors",g?"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"})})]},E.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",g?"bg-white/5":"bg-white border border-gray-200"),children:[c&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>I(!R),disabled:s||n,className:u("p-1 rounded transition-colors flex-shrink-0",g?"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:R&&jsx(motion.div,{ref:Q,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",g?"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:Df.map(E=>jsx("button",{type:"button",onClick:()=>Ee(E),className:u("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",g?"hover:bg-white/10":"hover:bg-gray-100"),children:E},E))})})})]}),l&&f&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>B.current?.click(),disabled:s||n,className:u("p-1.5 rounded transition-colors",g?"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:m==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:B,type:"file",multiple:true,onChange:L,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:C,value:e,onChange:_,onSelect:oe,onKeyDown:A,placeholder:o||(m==="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",g?"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":g?"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:y&&b.length>0&&jsx(motion.div,{ref:W,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",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:b.map((E,q)=>jsxs("button",{type:"button",onClick:()=>Te(E),className:u("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",q===N?g?"bg-white/10":"bg-gray-100":g?"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:E.color||"#8B5CF6"},children:Tf(E.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:u("text-sm font-medium truncate",g?"text-white":"text-gray-900"),children:E.name}),E.email&&jsx("p",{className:u("text-xs truncate",g?"text-[#6B7280]":"text-gray-500"),children:E.email})]})]},E.id))})})]})]})]})}function xc({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((d,m)=>d.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:d.value},m):jsx("span",{children:d.value},m))})}var Xn=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function _r({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[d,m]=useState(false),[i,c]=useState(""),[l,p]=useState(false),[f,v]=useState(Xn[10]||"#3B82F6"),[w,g]=useState({top:0,left:0}),y=useRef(null),h=useRef(null),b=useRef(null),x=useRef(null),N=t.filter(C=>C.name.toLowerCase().includes(i.toLowerCase())),D=t.some(C=>C.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(d&&h.current){let C=h.current.getBoundingClientRect();g({top:C.bottom+6,left:C.left});}},[d]),useEffect(()=>{let C=W=>{let B=W.target,Q=y.current?.contains(B),S=b.current?.contains(B);!Q&&!S&&(m(false),c(""),p(false));};if(d)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[d]),useEffect(()=>{d&&x.current&&x.current.focus();},[d]);let T=C=>{let W=e.some(B=>B.id===C.id);a(W?e.filter(B=>B.id!==C.id):[...e,C]);},k=async()=>{if(!(!r||!i.trim())){p(true);try{let C=await r(i.trim(),f);C&&(a([...e,C]),c(""),v(Xn[Math.floor(Math.random()*Xn.length)]||"#3B82F6"));}finally{p(false);}}},R=(C,W)=>{W.stopPropagation(),a(e.filter(B=>B.id!==C));},I={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:y,className:"relative",children:[jsxs("button",{ref:h,type:"button",onClick:()=>!s&&m(!d),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(C=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${C.color}20`,color:C.color},children:C.name},C.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:d&&jsxs(motion.div,{ref:b,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:w.top,left:w.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:x,type:"text",value:i,onChange:C=>c(C.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:C=>{C.key==="Enter"&&i.trim()&&!D&&r&&k();}})}),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(C=>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:`${C.color}20`,color:C.color},onClick:W=>R(C.id,W),children:[C.name,jsx(X,{className:"w-3 h-3"})]},C.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(C=>{let W=e.some(B=>B.id===C.id);return jsxs("button",{type:"button",onClick:()=>T(C),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:W?`${C.color}15`:"transparent",color:o.textPrimary},onMouseEnter:B=>{W||(B.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:B=>{W||(B.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:C.color}}),jsx("span",{className:"flex-1 text-left",children:C.name}),W&&jsx(Check,{className:"w-4 h-4",style:{color:C.color}})]},C.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()&&!D&&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:Xn.map(C=>jsx("button",{type:"button",onClick:()=>v(C),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:C,outline:f===C?`2px solid ${C}`:"none",outlineOffset:"2px"}},C))}),jsxs("button",{type:"button",onClick:k,disabled:l,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:f,color:"#FFFFFF",opacity:l?.7:1},children:[l?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 yi({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 wc({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(yi,{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 go=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{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 Cc(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 Bf(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 Rf({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 vi({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=Bf(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"},d={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},m=Cc(e.loggedMinutes),i=e.estimateMinutes?Cc(e.estimateMinutes):null,c=a&&i?`${m} / ${i}`:m;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(Rf,{className:d[t]}),jsx("span",{children:c})]})}function Nc(e){let t=e.trim().toLowerCase();if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?0:Math.round(o*60)}function Zn(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 zf(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 Uf({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function Hf({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 Dc({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 Wf({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 xi({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:d,onStopTimer:m,onDiscardTimer:i,onClose:c,className:l}){let[p,f]=useState(""),[v,w]=useState(t.estimateMinutes?Zn(t.estimateMinutes):""),[g,y]=useState(""),[h,b]=useState(false),[x,N]=useState(false),D=useRef(null);useEffect(()=>{D.current?.focus();},[]);let T=async()=>{let I=Nc(p);if(!(I<=0||!s)){b(true);try{await s({durationMinutes:I,note:g.trim()||void 0,source:"manual"}),f(""),y("");}finally{b(false);}}},k=async()=>{if(!n)return;let I=v.trim()?Nc(v):null;await n(I),N(false);},R=I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),T()),I.key==="Escape"&&c?.();};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",l),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:c,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(Dc,{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:zf(o)})]}),jsx("button",{onClick:m,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(Hf,{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(Dc,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:d,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(Uf,{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(Wf,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:D,type:"text",value:p,onChange:I=>f(I.target.value),onKeyDown:R,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:T,disabled:h||!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:g,onChange:I=>y(I.target.value),onKeyDown:R,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:Zn(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"}),x?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:v,onChange:I=>w(I.target.value),onKeyDown:I=>{I.key==="Enter"&&k(),I.key==="Escape"&&N(false);},onBlur:k,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?Zn(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:Zn(I.durationMinutes)})]},I.id))})]})]})}function jf(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function Kf(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function fo({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[d,m]=useState(Kf(r)),[i,c]=useState(""),[l,p]=useState(false),f=useRef(null);useEffect(()=>{f.current?.focus();},[]);let v=async()=>{p(true);let b=jf(d);await o(b&&b>0?b:null,i||void 0),p(false);},w=async()=>{p(true),await o(null),p(false);},g=b=>{b.key==="Enter"&&!b.shiftKey&&(b.preventDefault(),v()),b.key==="Escape"&&s();},y={estimate:t==="es"?"Duraci\xF3n estimada":"Estimated duration",quoted:t==="es"?"Tiempo ofertado":"Quoted time",log:t==="es"?"Registrar tiempo":"Log time"},h={estimate:"8 (=8h)",quoted:"8 (=8h)",log:"8 (=8h)"};return jsxs("div",{className:u("w-64 p-3 rounded-lg shadow-xl border",a?"bg-[#1F2937] border-[#374151]":"bg-white border-gray-200",n),onClick:b=>b.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:u("text-sm font-medium",a?"text-white":"text-gray-900"),children:y[e]}),jsx("button",{type:"button",onClick:s,className:u("p-1 rounded transition-colors",a?"hover:bg-white/10 text-gray-400":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsxs("div",{className:"mb-3",children:[jsx("input",{ref:f,type:"text",value:d,onChange:b=>m(b.target.value),onKeyDown:g,placeholder:h[e],className:u("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")}),jsx("p",{className:u("text-xs mt-1",a?"text-gray-500":"text-gray-400"),children:t==="es"?"Ej: 8 (=8h), 1h 30m, 45m, 2:30":"e.g. 8 (=8h), 1h 30m, 45m, 2:30"})]}),e==="log"&&jsx("div",{className:"mb-3",children:jsx("input",{type:"text",value:i,onChange:b=>c(b.target.value),onKeyDown:g,placeholder:t==="es"?"Comentario (opcional)":"Comment (optional)",className:u("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})}),jsx("button",{type:"button",onClick:v,disabled:l||!d.trim(),className:u("w-full py-2 px-3 text-sm font-medium rounded-lg transition-colors","bg-blue-600 hover:bg-blue-700 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:l?t==="es"?"Guardando...":"Saving...":t==="es"?"Guardar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:w,disabled:l,className:u("w-full mt-2 py-1.5 px-3 text-xs font-medium rounded-lg transition-colors",a?"text-gray-400 hover:text-red-400 hover:bg-red-500/10":"text-gray-500 hover:text-red-600 hover:bg-red-50"),children:t==="es"?"Quitar valor":"Clear value"})]})}function qf(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 Yf(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 Ci({summary:e,showLabel:t=false,size:a="md",className:r}){let o=qf(e.health),s=Yf(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},d=e.progressPercent??0,m=Math.min(100,d),i=d>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:`${m}%`}}),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:[d,"%"]})]})}function Ro(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 Jf(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 Zf(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 Qf(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 e0({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",d=a?"text-[#9CA3AF]":"text-gray-500",m=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",d),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:u("text-2xl font-bold",o),children:[r?"+":"",Ro(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:u("text-xs mt-1",d),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",d),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",m),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",m),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",m),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",d),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:d,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:u("font-medium",m),children:Ro(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:d,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:u("font-medium",m),children:Ro(e.totalLoggedMinutes)})]}),jsxs("div",{className:u("flex justify-between pt-1 border-t",n),children:[jsx("span",{className:d,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:u("font-medium",m),children:e.totalTasksWithEstimate})]})]})]})]})}function t0({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",d=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",d),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Ro(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:Ro(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":d),children:[o,Ro(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":d),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",Zf(e.status,a),Jf(e.status,a)),children:Qf(e.status,t)})})]})}function Ti({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",d=n?"bg-[#0F1117]":"bg-gray-50",m=n?"bg-[#1A1D25]":"bg-white",i=n?"border-white/5":"border-gray-200",c=n?"text-[#E5E7EB]":"text-gray-900",l=n?"text-[#9CA3AF]":"text-gray-500",p=n?"bg-[#0F1117]/50":"bg-gray-50",f=useMemo(()=>e?[...e.tasks].sort((v,w)=>v.varianceMinutes===null?1:w.varianceMinutes===null?-1:w.varianceMinutes-v.varianceMinutes):[],[e]);return t?jsx("div",{className:u("p-8 text-center",l,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:u("p-8 text-center",l,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:u("space-y-6 p-6",d,o),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:u("text-2xl font-bold",c),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:u("text-sm mt-1",l),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(e0,{summary:e.summary,locale:a,isDark:n}),jsx("div",{className:u("rounded-lg border overflow-hidden",m,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",l),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:"%"}),jsx("th",{className:u("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",l),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:u("divide-y",i),children:f.map(v=>jsx(t0,{task:v,locale:a,isDark:n,onClick:s},v.taskId))})]})})}),jsx("div",{className:u("text-xs text-center",l),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 Oo(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 f0(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 Rc(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 h0(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 Ir({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:d=[],availableTags:m=[],onCreateTag:i,attachments:c=[],onUploadAttachments:l,onDeleteAttachment:p,availableTasks:f=[],comments:v=[],onAddComment:w,currentUser:g,mentionableUsers:y=[],onUploadCommentAttachments:h,enableTimeTracking:b=false,timeTrackingSummary:x,timeEntries:N=[],isTimerRunning:D=false,timerElapsedSeconds:T=0,onTimeLog:k,onEstimateUpdate:R,onSoldEffortUpdate:I,onTimerStart:C,onTimerStop:W,onTimerDiscard:B,blurFinancials:Q=false}){let S=s==="dark",_={textTertiary:S?"#6B7280":"#9CA3AF",textSecondary:S?"#9CA3AF":"#6B7280",textPrimary:S?"#FFFFFF":"#111827",borderLight:S?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:S?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:S?"#1A1D25":"#FFFFFF",bgSecondary:S?"#0F1117":"#F9FAFB",hoverBg:S?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},oe=e&&"title"in e&&!("name"in e),Te=e,[A,Ee]=useState(e?Rc(e,d):null),[L,U]=useState(false),[E,q]=useState(false),[ee,de]=useState(false),[he,ge]=useState(null),[Le,re]=useState(new Date),[Qe,Ie]=useState(false),[Ke,ht]=useState(false),[bt,qe]=useState(""),[xt,ut]=useState(false),[yt,ne]=useState(false),[O,J]=useState(false),[ce,ke]=useState(false),[$e,Je]=useState(""),ot=useRef(null),ze=useRef(null),[oa,G]=useState(""),Y=useRef(null),[be,Ye]=useState(""),[we,Pe]=useState(false),[X$1,Ue]=useState([]),[H,ie]=useState(""),[Fe,Ve]=useState(false),We=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 M=Rc(e,d);console.log("\u{1F4E5} After normalizeToTask:",{taskId:M?.id,taskName:M?.name,soldEffortMinutes:M?.soldEffortMinutes,quotedMinutes:M?.quotedMinutes,effortMinutes:M?.effortMinutes,timeLoggedMinutes:M?.timeLoggedMinutes}),Ee(M),Je(M.description||""),G(M.name||"");}},[e?.id,e?.quotedMinutes,d,t]),useEffect(()=>{if(!t||!$e)return;let M=setTimeout(()=>{let ae=ze.current;ae&&(ae.style.height="auto",ae.style.height=`${Math.max(100,ae.scrollHeight)}px`);},50);return ()=>clearTimeout(M)},[t,$e]),useEffect(()=>()=>{ot.current&&clearTimeout(ot.current),Y.current&&clearTimeout(Y.current);},[]),useEffect(()=>{t&&We.current&&v.length>0&&setTimeout(()=>{We.current&&(We.current.scrollTop=We.current.scrollHeight);},100);},[t,v.length]);let Re=useCallback(M=>{Ee(M),oe&&o&&Te?o(h0(M,Te)):r&&r(M);},[oe,Te,o,r]),z=useCallback(()=>{U(false),q(false),de(false),ge(null),ht(false),qe(""),ut(false);},[]),K=useCallback((M,ae)=>{if(!A)return;let Oe={...A,[M]:ae};Re(Oe);},[A,Re]),ye=useCallback(()=>{let M=ze.current;M&&(M.style.height="auto",M.style.height=`${Math.max(100,M.scrollHeight)}px`);},[]),_e=useCallback(M=>{Je(M),setTimeout(ye,0),ot.current&&clearTimeout(ot.current),ot.current=setTimeout(()=>{if(A){let ae={...A,description:M};Re(ae);}},800);},[A,Re,ye]),Xe=useCallback(M=>{G(M),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{if(A&&M.trim()){let ae={...A,name:M.trim()};Re(ae);}},800);},[A,Re]),V=useCallback(M=>{let ae=M.map(Oe=>{let Ze={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Oe};return Oe.type.startsWith("image/")&&(Ze.preview=URL.createObjectURL(Oe)),Ze});Ue(Oe=>[...Oe,...ae]);},[]),ue=useCallback(M=>{Ue(ae=>{let Oe=ae.find(Ze=>Ze.id===M);return Oe?.preview&&URL.revokeObjectURL(Oe.preview),ae.filter(Ze=>Ze.id!==M)});},[]),Be=useCallback(async()=>{if(!(!A||!be.trim()&&X$1.length===0||!w)){Pe(true);try{let M=yc(be,y),ae=[];if(X$1.length>0&&h){let Oe=X$1.map(Ze=>Ze.file);ae=await h(Oe);}await w(A.id,be.trim(),M.length>0?M:void 0,ae.length>0?ae:void 0),Ye(""),X$1.forEach(Oe=>{Oe.preview&&URL.revokeObjectURL(Oe.preview);}),Ue([]);}finally{Pe(false);}}},[A,be,X$1,w,y,h]),Mt=useCallback(()=>{if(!A||!H.trim())return;let M={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:H.trim(),progress:0,startDate:new Date,endDate:new Date},ae=[...A.subtasks||[],M],Oe={...A,subtasks:ae};Re(Oe),ie(""),Ve(false);},[A,H,Re]),it=useCallback(M=>{if(!A?.subtasks)return;let ae=A.subtasks.map(Ze=>Ze.id===M?{...Ze,progress:Ze.progress===100?0:100}:Ze),Oe={...A,subtasks:ae};Re(Oe);},[A,Re]),kr=useCallback(M=>{if(!A?.subtasks)return;let ae=A.subtasks.filter(Ze=>Ze.id!==M),Oe={...A,subtasks:ae};Re(Oe);},[A,Re]),Za=useCallback(M=>{let ae=typeof M=="string"?new Date(M):M,Ze=new Date().getTime()-ae.getTime(),la=Math.floor(Ze/6e4),ba=Math.floor(Ze/36e5),Da=Math.floor(Ze/864e5);return la<1?n==="es"?"Ahora":"Just now":la<60?n==="es"?`Hace ${la} min`:`${la}m ago`:ba<24?n==="es"?`Hace ${ba}h`:`${ba}h ago`:Da<7?n==="es"?`Hace ${Da}d`:`${Da}d ago`:ae.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),lr=useCallback(M=>{if(!A)return;let ae=A.progress||0;M==="completed"?ae=100:M==="in-progress"&&ae===0?ae=10:M==="todo"&&(ae=0);let Oe={...A,status:M,progress:ae};Re(Oe),U(false);},[A,Re]),Qa=useCallback((M,ae)=>{if(!A)return;let Oe={...A,startDate:M,endDate:ae};Re(Oe);},[A,Re]),Ne=useCallback(()=>{let M=Le.getFullYear(),ae=Le.getMonth(),Oe=new Date(M,ae,1),la=new Date(M,ae+1,0).getDate(),ba=Oe.getDay(),Da=[],Ea=new Date(M,ae,0).getDate();for(let Fa=ba-1;Fa>=0;Fa--)Da.push({date:new Date(M,ae-1,Ea-Fa),isCurrentMonth:false});for(let Fa=1;Fa<=la;Fa++)Da.push({date:new Date(M,ae,Fa),isCurrentMonth:true});let Pa=42-Da.length;for(let Fa=1;Fa<=Pa;Fa++)Da.push({date:new Date(M,ae+1,Fa),isCurrentMonth:false});return Da},[Le]),Rt=useCallback(async M=>{if(M.preventDefault(),M.stopPropagation(),J(false),!A||!l)return;let ae=Array.from(M.dataTransfer.files);if(ae.length!==0){ke(true);try{await l(A.id,ae);}finally{ke(false);}}},[A,l]),Ot=useCallback(async M=>{if(!A||!l||!M.target.files)return;let ae=Array.from(M.target.files);if(ae.length!==0){ke(true);try{await l(A.id,ae);}finally{ke(false);}M.target.value="";}},[A,l]),Na=useCallback(M=>{M.preventDefault(),M.stopPropagation(),J(true);},[]),wr=useCallback(M=>{M.preventDefault(),M.stopPropagation(),J(false);},[]),kt=useCallback(M=>M<1024?`${M} B`:M<1024*1024?`${(M/1024).toFixed(1)} KB`:`${(M/(1024*1024)).toFixed(1)} MB`,[]),dr=useCallback(M=>M.startsWith("image/")?Image:M.includes("pdf")||M.includes("document")?FileText:File,[]);return !t||!A?null:jsx(AnimatePresence,{children:t&&A&&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",S?"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]",S?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:u("w-4 h-4",S?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:u("text-xs px-2 py-0.5 rounded",S?"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",S?"text-[#6B7280]":"text-gray-400"),children:A.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 M=A.progress===100?0:100,Oe={...A,progress:M,status:M===100?"completed":"todo"};Re(Oe);},className:u("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",A.progress===100?"bg-green-500 border-green-500":S?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:A.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:oa,onChange:M=>Xe(M.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",A.progress===100?"line-through text-[#6B7280]":S?"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",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{z(),U(!L);},className:u("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",A.progress===100||A.status==="completed"?"bg-green-500/20 text-green-400":A.progress&&A.progress>0||A.status==="in-progress"?"bg-blue-500/20 text-blue-400":S?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:A.progress===100||A.status==="completed"?n==="es"?"COMPLETADO":"DONE":A.progress&&A.progress>0||A.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:L&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>U(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]",S?"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(M=>jsxs("button",{onClick:()=>lr(M.id),className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",A.status===M.id&&(S?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",M.color)}),jsx("span",{className:S?"text-white":"text-gray-900",children:M.label})]},M.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:u("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{z(),de(!ee);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[A.assignees&&A.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[A.assignees.slice(0,3).map((M,ae)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:M.color||"#8B5CF6"},title:M.name,children:M.initials||M.name.slice(0,2).toUpperCase()},ae)),A.assignees.length>3&&jsxs("span",{className:u("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:["+",A.assignees.length-3]})]}):jsx("span",{className:u("text-sm",S?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:u("w-3 h-3",S?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:ee&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>de(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",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:d.length>0?d.map(M=>{let ae=A.assignees?.some(Oe=>Oe.name===M.name);return jsxs("button",{onClick:()=>{let Oe=A.assignees||[],Ze;ae?Ze=Oe.filter(la=>la.name!==M.name):Ze=[...Oe,M],K("assignees",Ze);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",ae&&(S?"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:M.color||"#8B5CF6"},children:M.initials||M.name.slice(0,2).toUpperCase()}),jsx("span",{className:u("flex-1",S?"text-white":"text-gray-900"),children:M.name}),ae&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},M.name)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",S?"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",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{ge(he?null:"start"),re(A.startDate||new Date);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[A.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:u("mx-1",S?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),A.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:he&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ge(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",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:M=>M.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",S?"border-white/10":"border-gray-200"),children:[(()=>{let M=new Date,ae=new Date(M);ae.setDate(M.getDate()+1);let Oe=new Date(M);Oe.setDate(M.getDate()+((6-M.getDay()+7)%7||7));let Ze=new Date(M);Ze.setDate(M.getDate()+((1-M.getDay()+7)%7||7));let la=new Date(M);la.setDate(M.getDate()+(6-M.getDay()+7)%7+7);let ba=new Date(M);ba.setDate(M.getDate()+14);let Da=new Date(M);return Da.setDate(M.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:M,display:M.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:ae,display:ae.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Oe,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:la,display:la.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:ba,display:ba.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Da,display:Da.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Pa,Fa)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",S?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(he==="start"){let tn=A.endDate&&Pa.date>A.endDate?Pa.date:A.endDate;Qa(Pa.date,tn),ge("end");}else {let tn=A.startDate&&Pa.date<A.startDate?Pa.date:A.startDate;Qa(tn,Pa.date),ge(null);}},children:[jsx("span",{children:Pa.label}),jsx("span",{className:u("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:Pa.display})]},Fa))})(),jsx("div",{className:u("border-t mt-2 pt-2",S?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{Qa(void 0,void 0),ge(null);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",S?"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",S?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:he==="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:Le.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>re(new Date),className:u("p-1 rounded text-sm transition-colors",S?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>re(new Date(Le.getFullYear(),Le.getMonth()-1)),className:u("p-1 rounded",S?"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:()=>re(new Date(Le.getFullYear(),Le.getMonth()+1)),className:u("p-1 rounded",S?"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(M=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",S?"text-[#6B7280]":"text-gray-400"),children:M},M))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:Ne().map((M,ae)=>{let Oe=M.date.toDateString()===new Date().toDateString(),Ze=A.startDate?.toDateString()===M.date.toDateString(),la=A.endDate?.toDateString()===M.date.toDateString(),ba=Ze||la,Da=A.startDate&&A.endDate&&M.date>=A.startDate&&M.date<=A.endDate;return jsx("button",{onClick:()=>{let Ea=new Date(M.date);if(he==="start"){let Pa=A.endDate&&Ea>A.endDate?Ea:A.endDate;Qa(Ea,Pa),ge("end");}else {let Pa=A.startDate&&Ea<A.startDate?Ea:A.startDate;Qa(Pa,Ea),ge(null);}},className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!M.isCurrentMonth&&(S?"text-[#4B5563]":"text-gray-300"),M.isCurrentMonth&&(S?"text-white":"text-gray-900"),Oe&&"ring-2 ring-[#3B82F6]",Ze&&"bg-[#3B82F6] text-white",la&&!Ze&&"bg-[#7C3AED] text-white",Da&&!ba&&(S?"bg-[#7C3AED]/20":"bg-purple-100"),!ba&&(S?"hover:bg-white/10":"hover:bg-gray-100")),children:M.date.getDate()},ae)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:u("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{z(),q(!E);},className:u("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",A.priority==="high"||A.priority==="urgent"?"bg-red-500/20 text-red-400":A.priority==="medium"?"bg-yellow-500/20 text-yellow-400":A.priority==="low"?"bg-green-500/20 text-green-400":S?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:A.priority?A.priority==="high"||A.priority==="urgent"?n==="es"?"Alta":"High":A.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:E&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>q(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]",S?"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(M=>jsxs("button",{onClick:()=>{K("priority",M.id),q(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",A.priority===M.id&&(S?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",M.color)}),jsx("span",{className:S?"text-white":"text-gray-900",children:M.label})]},M.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:u("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:u("text-sm",S?"text-white":"text-gray-900"),children:A.startDate&&A.endDate?`${Math.ceil((A.endDate.getTime()-A.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",S?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[Qe?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:A.progress||0,onChange:M=>{let ae=parseInt(M.target.value),Oe=A.status;ae===100?Oe="completed":ae>0?Oe="in-progress":Oe="todo";let Ze={...A,progress:ae,status:Oe};Re(Ze);},onBlur:()=>Ie(false),className:u("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",S?"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-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>Ie(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",S?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:u("h-full rounded-full transition-all",A.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${A.progress||0}%`}})}),jsxs("span",{className:u("text-sm font-medium min-w-[40px]",S?"text-white":"text-gray-900"),children:[A.progress||0,"%"]})]})]}),b&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:u("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:A.status==="completed"||A.progress===100?jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",S?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:x?.estimateMinutes?Oo(x.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):x?.estimateMinutes?jsx("button",{type:"button",onClick:()=>ne("estimate"),className:u("text-sm px-2 py-0.5 rounded",S?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Oo(x.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>ne("estimate"),className:u("text-sm",S?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:yt==="estimate"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(fo,{mode:"estimate",locale:n,isDark:S,currentValue:x?.estimateMinutes||null,onSave:async M=>{await R?.(A.id,M),ne(false);},onClose:()=>ne(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:u("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:Q?jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",S?"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"}):A.status==="completed"||A.progress===100?jsx("span",{className:u("text-sm px-2 py-0.5 cursor-not-allowed",S?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:A.quotedMinutes?Oo(A.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):A.quotedMinutes?jsx("button",{type:"button",onClick:()=>ne("quoted"),className:u("text-sm px-2 py-0.5 rounded",S?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Oo(A.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>ne("quoted"),className:u("text-sm",S?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:yt==="quoted"&&!Q&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(fo,{mode:"quoted",locale:n,isDark:S,currentValue:A.quotedMinutes||null,onSave:async M=>{I?(await I(A.id,M),Ee(ae=>ae?{...ae,quotedMinutes:M}:null)):K("quotedMinutes",M),ne(false);},onClose:()=>ne(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:u("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[A.status==="completed"||A.progress===100?jsx("div",{className:u("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",S?"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"})}):D?jsxs("button",{type:"button",onClick:()=>W?.(A.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"}),f0(T||0)]}):jsx("button",{type:"button",onClick:()=>C?.(A.id),className:u("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",S?"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"})}),A.status==="completed"||A.progress===100?jsxs("div",{className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",S?"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:()=>ne("log"),className:u("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",S?"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"]}),x&&x.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:u("text-sm font-medium",x.health==="over-budget"?"text-red-500":x.health==="at-risk"?"text-yellow-500":S?"text-white":"text-gray-900"),children:[Oo(x.loggedMinutes),x.estimateMinutes&&jsxs("span",{className:u("font-normal",S?"text-[#6B7280]":"text-gray-400"),children:[" / ",Oo(x.estimateMinutes)]})]}),x.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",x.health==="over-budget"?"bg-red-500":x.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,x.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:yt==="log"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(fo,{mode:"log",locale:n,isDark:S,currentValue:null,onSave:async(M,ae)=>{M&&await k?.(A.id,{durationMinutes:M,note:ae,source:"manual"}),ne(false);},onClose:()=>ne(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:u("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(_r,{selectedTags:A.tags||[],availableTags:m,onChange:M=>{K("tags",M);},onCreateTag:i,theme:_})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:u("w-4 h-4 mt-1.5",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0 mt-1",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[A.dependencies&&A.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:A.dependencies.map(M=>{let ae=f.find(Oe=>Oe.id===M);return jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",S?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[ae?.name||M.slice(0,8),jsx("button",{onClick:()=>{let Oe=(A.dependencies||[]).filter(Ze=>Ze!==M);K("dependencies",Oe);},className:u("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},M)})}),jsxs("button",{onClick:()=>{z(),ht(!Ke);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"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",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:Ke&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ht(false),qe("");}}),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]",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:u("p-2 border-b",S?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:bt,onChange:M=>qe(M.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:u("w-full px-3 py-2 rounded-md text-sm outline-none",S?"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:f.length>0?f.filter(M=>M.id!==A.id).filter(M=>bt===""||M.name.toLowerCase().includes(bt.toLowerCase())).map(M=>{let ae=A.dependencies?.includes(M.id);return jsxs("button",{onClick:()=>{let Oe=A.dependencies||[],Ze;ae?Ze=Oe.filter(la=>la!==M.id):Ze=[...Oe,M.id],K("dependencies",Ze);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",ae&&(S?"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",ae?"bg-blue-500 border-blue-500":S?"border-white/30":"border-gray-300"),children:ae&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:u("block truncate",S?"text-white":"text-gray-900"),children:M.name}),jsx("span",{className:u("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:M.id.slice(0,8)})]})]},M.id)}):jsx("div",{className:u("px-3 py-4 text-sm text-center",S?"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",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{z(),ut(!xt);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"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:A.color||"#6366F1"}}),jsx("span",{className:u("text-sm",S?"text-white":"text-gray-900"),children:go.find(M=>M.value===A.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:u("w-3 h-3",S?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:xt&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ut(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",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:go.map(M=>{let ae=A.color===M.value;return jsx("button",{onClick:()=>{K("color",M.value),ut(false);},className:u("w-7 h-7 rounded-full flex items-center justify-center transition-all",ae&&"ring-2 ring-offset-2",S?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:M.value,outlineColor:ae?M.value:void 0},title:M.name,children:ae&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},M.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:u("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm w-28 truncate flex-shrink-0",S?"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:A.isMilestone||false,onChange:M=>K("isMilestone",M.target.checked),className:u("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",A.isMilestone?"bg-purple-500 border-purple-500":S?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:u("text-sm",S?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:u("mt-6 pt-4 border-t",S?"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",S?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:u("text-sm font-semibold",S?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:ze,value:$e,onChange:M=>_e(M.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",S?"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",S?"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",S?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",A.subtasks&&A.subtasks.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",S?"text-[#6B7280]":"text-gray-400"),children:["(",A.subtasks.filter(M=>M.progress===100).length,"/",A.subtasks.length,")"]})]})}),A.subtasks&&A.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:A.subtasks.map(M=>jsxs("div",{className:u("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",S?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>it(M.id),className:u("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",M.progress===100?"bg-green-500 border-green-500":S?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:M.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:u("text-sm flex-1",M.progress===100?"line-through text-[#6B7280]":S?"text-white":"text-gray-900"),children:M.name}),jsx("button",{onClick:()=>kr(M.id),className:u("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",S?"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"})})]},M.id))}),Fe?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:H,onChange:M=>ie(M.target.value),onKeyDown:M=>{M.key==="Enter"&&H.trim()?Mt():M.key==="Escape"&&(Ve(false),ie(""));},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",S?"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:Mt,disabled:!H.trim(),className:u("px-3 py-2 rounded-lg text-sm font-medium transition-colors",H.trim()?"bg-blue-500 hover:bg-blue-600 text-white":S?"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:()=>{Ve(false),ie("");},className:u("p-2 rounded-lg transition-colors",S?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>Ve(true),className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",S?"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",S?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold mb-3",S?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",c.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",S?"text-[#6B7280]":"text-gray-400"),children:["(",c.length,")"]})]}),c.length>0&&jsx("div",{className:"space-y-2 mb-4",children:c.map(M=>{let ae=dr(M.type),Oe=M.type.startsWith("image/");return jsxs("div",{className:u("flex items-center gap-3 p-2 rounded-lg group transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Oe&&M.thumbnailUrl?jsx("img",{src:M.thumbnailUrl,alt:M.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:u("w-10 h-10 rounded flex items-center justify-center",S?"bg-white/10":"bg-gray-200"),children:jsx(ae,{className:u("w-5 h-5",S?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:M.url,target:"_blank",rel:"noopener noreferrer",className:u("text-sm font-medium truncate block hover:underline",S?"text-white":"text-gray-900"),children:M.name}),jsx("p",{className:u("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:kt(M.size)})]}),p&&jsx("button",{onClick:()=>p(M.id),className:u("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",S?"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"})})]},M.id)})}),jsxs("div",{onDragOver:Na,onDragLeave:wr,onDrop:Rt,className:u("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",O?S?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":S?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",ce&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:Ot,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!l||ce}),ce?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",S?"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",O?"text-blue-500":S?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:u("text-sm",S?"text-[#9CA3AF]":"text-gray-500"),children:O?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"})]})}),!l&&jsx("p",{className:u("text-xs mt-1",S?"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",S?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between h-[49px]",S?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:u("text-sm font-semibold",S?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",v.length>0&&jsxs("span",{className:u("ml-2 text-xs font-normal",S?"text-[#6B7280]":"text-gray-400"),children:["(",v.length,")"]})]}),jsx("button",{onClick:a,className:u("p-1.5 rounded transition-colors",S?"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: ${S?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
|
|
17
17
|
}
|
|
18
|
-
`}),jsx("div",{ref:He,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",S?"scrollbar-slim":"scrollbar-slim-light"),children:v.length>0?jsx("div",{className:"space-y-4",children:[...v].sort((M,oe)=>{let Re=typeof M.createdAt=="string"?new Date(M.createdAt):M.createdAt,Je=typeof oe.createdAt=="string"?new Date(oe.createdAt):oe.createdAt;return Re.getTime()-Je.getTime()}).map(M=>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:M.user?.color||"#8B5CF6"},children:M.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",S?"text-white":"text-gray-900"),children:M.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:u("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:xr(M.createdAt)})]}),jsx("div",{className:u("text-sm",S?"text-[#9CA3AF]":"text-gray-600"),children:jsx(xc,{content:M.content,theme:s})}),M.attachments&&M.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:M.attachments.map(oe=>{let Re=oe.type.startsWith("image/");return jsxs("a",{href:oe.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[Re?jsx(Image,{className:u("w-4 h-4",S?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:u("w-4 h-4",S?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:u("text-xs truncate max-w-[100px]",S?"text-white":"text-gray-900"),children:oe.name})]},oe.id)})})]})]},M.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",S?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:u("text-sm",S?"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",S?"border-white/10":"border-gray-200"),children:jsx(vc,{value:be,onChange:Ye,onSubmit:_e,users:y,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!w,isSubmitting:Te,theme:s,locale:n,currentUser:g,enableEmoji:true,enableAttachments:!!h,pendingFiles:X$1,onFilesSelect:V,onRemoveFile:le})})]})]})]})})}function Di(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function Kr({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:f,onUploadAttachments:v,onDeleteAttachment:w,comments:g,onAddComment:y,currentUser:h,mentionableUsers:b,onTaskOpen:x,onUploadCommentAttachments:N,enableTimeTracking:D,timeTrackingSummary:T,timeEntries:k,timerState:O,onLogTime:I,onUpdateEstimate:C,onUpdateSoldEffort:H,onStartTimer:R,onStopTimer:Q,onDiscardTimer:S,blurFinancials:G=false}){let[ne,Ce]=Di(),[A,Pe]=useState(null),[L,U]=useState(false),E=useRef(null),q=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),ee=o?.theme||"dark",fe=ee==="dark"||ee==="neutral",ue=fe?"dark":"",pe=useCallback((ie,B)=>{t.onCardUpdate?.(ie,B);},[t]),Oe=useCallback((ie,B)=>{t.onColumnUpdate?.(ie,{title:B});},[t]),ae=useCallback(ie=>{t.onColumnDelete?.(ie);},[t]),nt=["todo","in-progress","completed"],Fe=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),qe=useMemo(()=>{let ie=new Map;return e.columns.forEach(B=>{let Z=B.cardIds.map(ce=>e.cards.find(ke=>ke.id===ce)).filter(ce=>ce!==void 0).sort((ce,ke)=>ce.position-ke.position);ie.set(B.id,Z);}),ie},[e.cards,e.columns]);useEffect(()=>{let ie=E.current;if(!ie)return;let B=$e=>{let Xe=$e.target,at=$e.button===1,ze=Xe===ie||Xe.classList.contains("asakaa-column")&&!Xe.closest(".asakaa-card");(at||$e.button===0&&ze&&!ne.isDragging)&&($e.preventDefault(),U(true),q.current={x:$e.clientX,y:$e.clientY,scrollLeft:ie.scrollLeft,scrollTop:ie.scrollTop},ie.style.cursor="grabbing",ie.style.userSelect="none");},Z=$e=>{if(!L)return;let Xe=$e.clientX-q.current.x,at=$e.clientY-q.current.y;ie.scrollLeft=q.current.scrollLeft-Xe,ie.scrollTop=q.current.scrollTop-at;},ce=()=>{L&&(U(false),ie.style.cursor="",ie.style.userSelect="");},ke=()=>{L&&(U(false),ie.style.cursor="",ie.style.userSelect="");};return ie.addEventListener("mousedown",B),document.addEventListener("mousemove",Z),document.addEventListener("mouseup",ce),ie.addEventListener("mouseleave",ke),()=>{ie.removeEventListener("mousedown",B),document.removeEventListener("mousemove",Z),document.removeEventListener("mouseup",ce),ie.removeEventListener("mouseleave",ke);}},[L,ne.isDragging]);let ut=useMemo(()=>e.cards.map(ie=>({id:ie.id,name:ie.title,startDate:ie.startDate?new Date(ie.startDate):void 0,endDate:ie.endDate?new Date(ie.endDate):void 0,progress:ie.progress||0,status:ie.columnId,priority:ie.priority?.toLowerCase(),dependencies:Array.isArray(ie.dependencies)?ie.dependencies.map(B=>typeof B=="string"?B:B.taskId):[]})),[e.cards]),St=useCallback(ie=>{let{active:B}=ie,Z=e.cards.find(ce=>ce.id===B.id);Z&&Ce({isDragging:true,draggedCardId:Z.id,sourceColumnId:Z.columnId,targetColumnId:Z.columnId});},[e.cards,Ce]),je=useCallback(ie=>{let{active:B,over:Z}=ie;if(!Z||!e.cards.find($e=>$e.id===B.id))return;let ke=null;Z.data.current?.type==="column"?ke=Z.id:Z.data.current?.type==="card"&&(ke=e.cards.find(Xe=>Xe.id===Z.id)?.columnId||null),ke&&ke!==ne.targetColumnId&&Ce({...ne,targetColumnId:ke});},[e.cards,ne,Ce]),Ft=useCallback(async ie=>{let{active:B,over:Z}=ie;if(Ce({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!Z)return;let ce=e.cards.find(at=>at.id===B.id);if(!ce)return;let ke,$e;if(Z.data.current?.type==="column"){ke=Z.id;let at=qe.get(ke)||[];$e=ii(at,0);}else {let at=e.cards.find(W=>W.id===Z.id);if(!at)return;ke=at.columnId;let ze=qe.get(ke)||[],oa=ze.findIndex(W=>W.id===Z.id);$e=ii(ze,oa);}let Xe=e.columns.find(at=>at.id===ke);if(Xe&&Xe.wipLimit&&Xe.wipLimitType==="hard"){let at=qe.get(ke)||[];if(ce.columnId!==ke&&at.length>=Xe.wipLimit){t.onWipLimitExceeded?.(Xe,ce);return}}(ce.columnId!==ke||ce.position!==$e)&&await t.onCardMove?.(ce.id,ke,$e);},[e.cards,e.columns,qe,t,Ce]),it=useCallback(ie=>{Pe(ie),a?.(ie),x?.(ie.id);},[a,x]),pt=useCallback(ie=>{t.onCardUpdate?.(ie.id,ie),Pe(ie);},[t]);return c?jsx("div",{className:u("asakaa-board",ue,n),style:l,children:jsx(S0,{columnCount:3})}):i?jsx("div",{className:u("asakaa-board",ue,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(Yd,{themeName:ee,children:[jsxs(DndContext,{sensors:Fe,collisionDetection:closestCorners,onDragStart:St,onDragOver:je,onDragEnd:Ft,children:[jsxs("div",{ref:E,className:u("asakaa-board",ue,n),style:{...l,cursor:L?"grabbing":void 0},"data-theme":ee,children:[e.columns.sort((ie,B)=>ie.position-B.position).map(ie=>{let B=qe.get(ie.id)||[],Z=!nt.includes(ie.id);return jsx(Io,{column:ie,cards:B,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:it,onCardUpdate:pe,onColumnRename:Oe,onColumnDelete:ae,isDeletable:Z,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},ie.id)}),m]}),jsx(DragOverlay,{children:ne.draggedCardId?jsx(Mr,{card:e.cards.find(ie=>ie.id===ne.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsx(Ar,{task:A,isOpen:!!A,onClose:()=>Pe(null),onCardUpdate:pt,theme:fe?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:p,attachments:A?f?.get(A.id)||[]:[],onUploadAttachments:v,onDeleteAttachment:w,availableTasks:ut,comments:g,onAddComment:y,currentUser:h,mentionableUsers:b,onUploadCommentAttachments:N,enableTimeTracking:D,timeTrackingSummary:T,timeEntries:k,isTimerRunning:O?.isRunning,timerElapsedSeconds:O?.elapsedSeconds,onTimeLog:I,onEstimateUpdate:C,onSoldEffortUpdate:H,onTimerStart:R,onTimerStop:Q,onTimerDiscard:S,blurFinancials:G})]})}function S0({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 A0={bgGrid:"#0F1117",bgSecondary:"#1A1D25",border:"rgba(255, 255, 255, 0.1)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"#E5E7EB",textSecondary:"#9CA3AF",textTertiary:"#6B7280",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.15)",hoverBg:"rgba(255, 255, 255, 0.05)"},L0={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:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},I0={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},B0={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function R0({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, #3B82F6 0%, #2563EB 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: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 O0({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[l,c]=useState(null),i=useRef(null);if(useEffect(()=>{let f=v=>{i.current&&!i.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[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(f=>f.handler),p=async(f,v)=>{if(v){c(f);try{await v();}catch(w){console.error(`Export ${f} failed:`,w);}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((f,v)=>jsxs(motion.button,{onClick:()=>p(f.id,f.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:v<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===f.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):f.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:f.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:f.description})]})]},f.id))})})})]})}function $0({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, #3B82F6 0%, #2563EB 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:t})]})}function Ei({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:c,translations:i}){let m=r==="dark"?A0:L0,d={...o==="es"?I0:B0,...i},p=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:m.bgGrid,borderColor:m.border},children:jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxs(Fragment,{children:[jsx(O0,{theme:m,t:d,onExportCSV:n,onExportJSON:l,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),t&&(s?jsx(R0,{columns:e,onSelect:t,theme:m,t:d,createTaskLabel:a}):jsx($0,{onClick:()=>t(),label:a||d.newTask}))]})})}function Mi({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 Fi({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:l="dark",locale:c="es"}){let[i,m]=useState(false),[d,p]=useState(false),[f,v]=useState(""),[w,g]=useState([]),[y,h]=useState(""),[b,x]=useState(""),[N,D]=useState(""),[T,k]=useState(false),[O,I]=useState(false),[C,H]=useState(false),R=useRef(null),Q=useRef(null),S={placeholder:o||(c==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(c==="es"?"Agregar Tarea":"Add Task"),save:c==="es"?"Guardar":"Save",addAssignee:c==="es"?"Agregar asignado":"Add assignee",addDates:c==="es"?"Agregar fechas":"Add dates",addPriority:c==="es"?"Agregar prioridad":"Add priority",startDate:c==="es"?"Inicio":"Start",endDate:c==="es"?"Fin":"End",low:c==="es"?"Baja":"Low",medium:c==="es"?"Media":"Medium",high:c==="es"?"Alta":"High",urgent:c==="es"?"Urgente":"Urgent"},G=useCallback(()=>{v(""),g([]),h(""),x(""),D(""),k(false),I(false),H(false),m(false);},[]);useEffect(()=>{i&&R.current&&R.current.focus();},[i]),useEffect(()=>{if(!i)return;let L=U=>{Q.current&&!Q.current.contains(U.target)&&(f.trim()||G());};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[i,f,G]);let ne=useCallback(async()=>{let L=f.trim();if(!(!L||d)){p(true);try{await t({name:L,columnId:e,assigneeIds:w.length>0?w:void 0,startDate:y?new Date(y):void 0,endDate:b?new Date(b):void 0,priority:N||void 0}),v(""),g([]),h(""),x(""),D(""),k(!1),I(!1),H(!1),R.current?.focus();}catch(U){console.error("Error creating card:",U);}finally{p(false);}}},[f,e,w,y,b,N,t,d]),Ce=useCallback(L=>{L.key==="Enter"&&!L.shiftKey?(L.preventDefault(),ne()):L.key==="Escape"&&G();},[ne,G]),A=useCallback(L=>{g(U=>U.includes(L)?U.filter(E=>E!==L):[...U,L]);},[]),Pe=l==="dark";return i?jsxs("div",{ref:Q,className:u("rounded-lg overflow-hidden shadow-lg",Pe?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxs("div",{className:"p-3",children:[jsx("input",{ref:R,type:"text",value:f,onChange:L=>v(L.target.value),onKeyDown:Ce,placeholder:S.placeholder,disabled:d,className:u("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Pe?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxs("button",{onClick:()=>k(!T),className:u("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||w.length>0?"bg-emerald-500/20 text-emerald-400":Pe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.addAssignee,children:[jsxs("svg",{width:"14",height:"14",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"})]}),w.length>0&&jsx("span",{className:"ml-0.5",children:w.length})]}),jsx("button",{onClick:()=>I(!O),className:u("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",O||y||b?"bg-blue-500/20 text-blue-400":Pe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.addDates,children:jsxs("svg",{width:"14",height:"14",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("button",{onClick:()=>H(!C),className:u("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",C||N?N==="urgent"?"bg-red-500/20 text-red-400":N==="high"?"bg-orange-500/20 text-orange-400":N==="medium"?"bg-yellow-500/20 text-yellow-400":N==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Pe?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.addPriority,children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsx("div",{className:"flex-1"}),jsx("button",{onClick:ne,disabled:!f.trim()||d,className:u("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:d?jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):S.save})]})]}),T&&a.length>0&&jsx("div",{className:u("px-3 pb-3 pt-0","border-t",Pe?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(L=>jsxs("button",{onClick:()=>A(L.id),className:u("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",w.includes(L.id)?"bg-emerald-500 text-white":Pe?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[L.avatar?jsx("img",{src:L.avatar,alt:L.name,className:"w-4 h-4 rounded-full"}):jsx("div",{className:u("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",w.includes(L.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:L.name.charAt(0).toUpperCase()}),jsx("span",{children:L.name.split(" ")[0]})]},L.id))})}),O&&jsx("div",{className:u("px-3 pb-3 pt-0","border-t",Pe?"border-[#3a3a4e]":"border-gray-200"),children:jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxs("div",{children:[jsx("label",{className:u("block text-[10px] uppercase tracking-wide mb-1",Pe?"text-gray-500":"text-gray-400"),children:S.startDate}),jsx("input",{type:"date",value:y,onChange:L=>h(L.target.value),className:u("w-full px-2 py-1.5 rounded text-xs border",Pe?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxs("div",{children:[jsx("label",{className:u("block text-[10px] uppercase tracking-wide mb-1",Pe?"text-gray-500":"text-gray-400"),children:S.endDate}),jsx("input",{type:"date",value:b,onChange:L=>x(L.target.value),className:u("w-full px-2 py-1.5 rounded text-xs border",Pe?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),C&&jsx("div",{className:u("px-3 pb-3 pt-0","border-t",Pe?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(L=>jsx("button",{onClick:()=>D(N===L?"":L),className:u("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",N===L?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[L]} text-white`:Pe?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:S[L]},L))})})]}):jsxs("button",{onClick:()=>m(true),disabled:n,className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Pe?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",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"})]}),jsx("span",{className:"text-sm font-medium",children:S.buttonLabel})]})}var pn=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(Kr,{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 Xc(e={}){return new pn(e)}var $o=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 Ai(e,t){let a=r=>jsx($o,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Ii({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),[f,v]=useState(""),[w,g]=useState("home"),[y,h]=useState(""),[b,x]=useState("");useEffect(()=>{let k=O=>{(O.metaKey||O.ctrlKey)&&O.key===i&&(O.preventDefault(),p(I=>!I)),O.key==="Escape"&&(p(false),g("home"),v(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i]),useEffect(()=>{d||(g("home"),v(""),h(""),x(""));},[d]);let N=useCallback(()=>{p(false);},[]),D=useCallback(k=>{let[O,I]=k.split(":");switch(O){case "create-card":g("create-card");break;case "create-card-in":h(I||"");break;case "navigate":I?(a?.(I),N()):g("navigate");break;case "search":r?.(f),N();break;case "priority":g("priority");break;case "set-priority":b&&I&&(o?.(b,I),N());break;case "assign":g("assign");break;case "assign-user":b&&I&&(s?.(b,I),N());break;case "ai":g("ai");break;case "ai-generate-plan":n?.(),N();break;case "ai-predict-risks":l?.(),N();break;case "ai-usage":c?.(),N();break;case "back":g("home");break;}},[f,b,t,a,r,o,s,n,l,c,N]),T=useCallback(()=>{y&&f.trim()&&(t?.(y,f.trim()),N());},[y,f,t,N]);return d?jsx(ht,{children:jsx("div",{className:"command-palette-overlay",onClick:N,children:jsx("div",{className:`command-palette ${m}`,onClick:k=>k.stopPropagation(),children:jsxs(Command,{value:f,onValueChange:v,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:w==="create-card"&&y?"Type card title and press Enter...":w==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&w==="create-card"&&y&&T();}}),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."}),w==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:D,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsx("span",{children:"Create Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxs(Command.Item,{value:"navigate",onSelect:D,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 16 16 12 12 8"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsx("span",{children:"Navigate to Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxs(Command.Item,{value:"search",onSelect:D,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx("span",{children:"Search Cards"}),jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsx(Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxs(Command.Item,{value:"ai",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"AI Commands"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsx(Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(k=>jsxs(Command.Item,{value:`navigate:${k.id}`,onSelect:D,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:k.title}),k.labels&&k.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(O=>jsx("span",{className:"command-palette-item-label",children:O},O))})]},k.id))})]}),w==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(k=>jsxs(Command.Item,{value:`create-card-in:${k.id}`,onSelect:D,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsx("span",{children:k.title}),jsxs("div",{className:"command-palette-item-count",children:[k.cardIds.length," cards"]})]},k.id))})]}),w==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(k=>{let O=e.columns.find(I=>I.id===k.columnId);return jsxs(Command.Item,{value:`navigate:${k.id}`,onSelect:D,className:"command-palette-item",keywords:[k.title,k.description||"",...k.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:k.title}),jsx("div",{className:"command-palette-item-meta",children:O?.title})]}),k.labels&&k.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(I=>jsx("span",{className:"command-palette-item-label",children:I},I))})]},k.id)})})]}),w==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsxs(Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxs(Command.Item,{value:"ai-generate-plan",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"Generate Project Plan"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-predict-risks",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Predict Risks"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-usage",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsx("span",{children:"AI Usage & Costs"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxs("div",{className:"command-palette-footer",children:[jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"\u2191"}),jsx("kbd",{children:"\u2193"}),jsx("span",{children:"Navigate"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Enter"}),jsx("span",{children:"Select"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Esc"}),jsx("span",{children:"Close"})]})]})]})})})}):null}function Qc(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:We,className:u("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",S?"scrollbar-slim":"scrollbar-slim-light"),children:v.length>0?jsx("div",{className:"space-y-4",children:[...v].sort((M,ae)=>{let Oe=typeof M.createdAt=="string"?new Date(M.createdAt):M.createdAt,Ze=typeof ae.createdAt=="string"?new Date(ae.createdAt):ae.createdAt;return Oe.getTime()-Ze.getTime()}).map(M=>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:M.user?.color||"#8B5CF6"},children:M.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",S?"text-white":"text-gray-900"),children:M.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:u("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:Za(M.createdAt)})]}),jsx("div",{className:u("text-sm",S?"text-[#9CA3AF]":"text-gray-600"),children:jsx(xc,{content:M.content,theme:s})}),M.attachments&&M.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:M.attachments.map(ae=>{let Oe=ae.type.startsWith("image/");return jsxs("a",{href:ae.url,target:"_blank",rel:"noopener noreferrer",className:u("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[Oe?jsx(Image,{className:u("w-4 h-4",S?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:u("w-4 h-4",S?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:u("text-xs truncate max-w-[100px]",S?"text-white":"text-gray-900"),children:ae.name})]},ae.id)})})]})]},M.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",S?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:u("text-sm",S?"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",S?"border-white/10":"border-gray-200"),children:jsx(vc,{value:be,onChange:Ye,onSubmit:Be,users:y,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!w,isSubmitting:we,theme:s,locale:n,currentUser:g,enableEmoji:true,enableAttachments:!!h,pendingFiles:X$1,onFilesSelect:V,onRemoveFile:ue})})]})]})]})})}function Di(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function Kr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:d,isLoading:m,error:i,children:c,availableTags:l=[],onCreateTag:p,attachmentsByCard:f,onUploadAttachments:v,onDeleteAttachment:w,comments:g,onAddComment:y,currentUser:h,mentionableUsers:b,onTaskOpen:x,onUploadCommentAttachments:N,enableTimeTracking:D,timeTrackingSummary:T,timeEntries:k,timerState:R,onLogTime:I,onUpdateEstimate:C,onUpdateSoldEffort:W,onStartTimer:B,onStopTimer:Q,onDiscardTimer:S,blurFinancials:_=false}){let[oe,Te]=Di(),[A,Ee]=useState(null),[L,U]=useState(false),E=useRef(null),q=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),ee=o?.theme||"dark",de=ee==="dark"||ee==="neutral",he=de?"dark":"",ge=useCallback((ne,O)=>{t.onCardUpdate?.(ne,O);},[t]),Le=useCallback((ne,O)=>{t.onColumnUpdate?.(ne,{title:O});},[t]),re=useCallback(ne=>{t.onColumnDelete?.(ne);},[t]),Qe=["todo","in-progress","completed"],Ie=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Ke=useMemo(()=>{let ne=new Map;return e.columns.forEach(O=>{let J=O.cardIds.map(ce=>e.cards.find(ke=>ke.id===ce)).filter(ce=>ce!==void 0).sort((ce,ke)=>ce.position-ke.position);ne.set(O.id,J);}),ne},[e.cards,e.columns]);useEffect(()=>{let ne=E.current;if(!ne)return;let O=$e=>{let Je=$e.target,ot=$e.button===1,ze=Je===ne||Je.classList.contains("asakaa-column")&&!Je.closest(".asakaa-card");(ot||$e.button===0&&ze&&!oe.isDragging)&&($e.preventDefault(),U(true),q.current={x:$e.clientX,y:$e.clientY,scrollLeft:ne.scrollLeft,scrollTop:ne.scrollTop},ne.style.cursor="grabbing",ne.style.userSelect="none");},J=$e=>{if(!L)return;let Je=$e.clientX-q.current.x,ot=$e.clientY-q.current.y;ne.scrollLeft=q.current.scrollLeft-Je,ne.scrollTop=q.current.scrollTop-ot;},ce=()=>{L&&(U(false),ne.style.cursor="",ne.style.userSelect="");},ke=()=>{L&&(U(false),ne.style.cursor="",ne.style.userSelect="");};return ne.addEventListener("mousedown",O),document.addEventListener("mousemove",J),document.addEventListener("mouseup",ce),ne.addEventListener("mouseleave",ke),()=>{ne.removeEventListener("mousedown",O),document.removeEventListener("mousemove",J),document.removeEventListener("mouseup",ce),ne.removeEventListener("mouseleave",ke);}},[L,oe.isDragging]);let ht=useMemo(()=>e.cards.map(ne=>({id:ne.id,name:ne.title,startDate:ne.startDate?new Date(ne.startDate):void 0,endDate:ne.endDate?new Date(ne.endDate):void 0,progress:ne.progress||0,status:ne.columnId,priority:ne.priority?.toLowerCase(),dependencies:Array.isArray(ne.dependencies)?ne.dependencies.map(O=>typeof O=="string"?O:O.taskId):[]})),[e.cards]),bt=useCallback(ne=>{let{active:O}=ne,J=e.cards.find(ce=>ce.id===O.id);J&&Te({isDragging:true,draggedCardId:J.id,sourceColumnId:J.columnId,targetColumnId:J.columnId});},[e.cards,Te]),qe=useCallback(ne=>{let{active:O,over:J}=ne;if(!J||!e.cards.find($e=>$e.id===O.id))return;let ke=null;J.data.current?.type==="column"?ke=J.id:J.data.current?.type==="card"&&(ke=e.cards.find(Je=>Je.id===J.id)?.columnId||null),ke&&ke!==oe.targetColumnId&&Te({...oe,targetColumnId:ke});},[e.cards,oe,Te]),xt=useCallback(async ne=>{let{active:O,over:J}=ne;if(Te({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!J)return;let ce=e.cards.find(ot=>ot.id===O.id);if(!ce)return;let ke,$e;if(J.data.current?.type==="column"){ke=J.id;let ot=Ke.get(ke)||[];$e=ii(ot,0);}else {let ot=e.cards.find(G=>G.id===J.id);if(!ot)return;ke=ot.columnId;let ze=Ke.get(ke)||[],oa=ze.findIndex(G=>G.id===J.id);$e=ii(ze,oa);}let Je=e.columns.find(ot=>ot.id===ke);if(Je&&Je.wipLimit&&Je.wipLimitType==="hard"){let ot=Ke.get(ke)||[];if(ce.columnId!==ke&&ot.length>=Je.wipLimit){t.onWipLimitExceeded?.(Je,ce);return}}(ce.columnId!==ke||ce.position!==$e)&&await t.onCardMove?.(ce.id,ke,$e);},[e.cards,e.columns,Ke,t,Te]),ut=useCallback(ne=>{Ee(ne),a?.(ne),x?.(ne.id);},[a,x]),yt=useCallback(ne=>{t.onCardUpdate?.(ne.id,ne),Ee(ne);},[t]);return m?jsx("div",{className:u("asakaa-board",he,n),style:d,children:jsx(E0,{columnCount:3})}):i?jsx("div",{className:u("asakaa-board",he,n),style:d,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(Yd,{themeName:ee,children:[jsxs(DndContext,{sensors:Ie,collisionDetection:closestCorners,onDragStart:bt,onDragOver:qe,onDragEnd:xt,children:[jsxs("div",{ref:E,className:u("asakaa-board",he,n),style:{...d,cursor:L?"grabbing":void 0},"data-theme":ee,children:[e.columns.sort((ne,O)=>ne.position-O.position).map(ne=>{let O=Ke.get(ne.id)||[],J=!Qe.includes(ne.id);return jsx(Bo,{column:ne,cards:O,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:ut,onCardUpdate:ge,onColumnRename:Le,onColumnDelete:re,isDeletable:J,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},ne.id)}),c]}),jsx(DragOverlay,{children:oe.draggedCardId?jsx(Ar,{card:e.cards.find(ne=>ne.id===oe.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsx(Ir,{task:A,isOpen:!!A,onClose:()=>Ee(null),onCardUpdate:yt,theme:de?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:l,onCreateTag:p,attachments:A?f?.get(A.id)||[]:[],onUploadAttachments:v,onDeleteAttachment:w,availableTasks:ht,comments:g,onAddComment:y,currentUser:h,mentionableUsers:b,onUploadCommentAttachments:N,enableTimeTracking:D,timeTrackingSummary:T,timeEntries:k,isTimerRunning:R?.isRunning,timerElapsedSeconds:R?.elapsedSeconds,onTimeLog:I,onEstimateUpdate:C,onSoldEffortUpdate:W,onTimerStart:B,onTimerStop:Q,onTimerDiscard:S,blurFinancials:_})]})}function E0({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 L0={bgGrid:"#0F1117",bgSecondary:"#1A1D25",border:"rgba(255, 255, 255, 0.1)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"#E5E7EB",textSecondary:"#9CA3AF",textTertiary:"#6B7280",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.15)",hoverBg:"rgba(255, 255, 255, 0.05)"},I0={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:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},B0={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},R0={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function O0({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),d=useRef(null);useEffect(()=>{let i=c=>{d.current&&!d.current.contains(c.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let m=i=>{t(i),n(false);};return jsxs("div",{ref:d,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, #3B82F6 0%, #2563EB 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: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,c)=>i.position-c.position).map((i,c)=>jsxs(motion.button,{onClick:()=>m(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:c<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.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 $0({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[d,m]=useState(null),i=useRef(null);if(useEffect(()=>{let f=v=>{i.current&&!i.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]),!(a||r||o))return null;let l=[{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(f=>f.handler),p=async(f,v)=>{if(v){m(f);try{await v();}catch(w){console.error(`Export ${f} failed:`,w);}finally{m(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:l.map((f,v)=>jsxs(motion.button,{onClick:()=>p(f.id,f.handler),disabled:d!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:d===f.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):f.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:f.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:f.description})]})]},f.id))})})})]})}function z0({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, #3B82F6 0%, #2563EB 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:t})]})}function Ei({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:d,onExportExcel:m,translations:i}){let c=r==="dark"?L0:I0,l={...o==="es"?B0:R0,...i},p=n||d||m;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:c.bgGrid,borderColor:c.border},children:jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxs(Fragment,{children:[jsx($0,{theme:c,t:l,onExportCSV:n,onExportJSON:d,onExportExcel:m}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:c.borderLight}})]}),t&&(s?jsx(O0,{columns:e,onSelect:t,theme:c,t:l,createTaskLabel:a}):jsx(z0,{onClick:()=>t(),label:a||l.newTask}))]})})}function Mi({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[d,m]=useState(""),i=useCallback(()=>{let p=d.trim();p&&(e(p),m(""),n(false));},[d,e]),c=useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(m(""),n(false));},[i]),l=useCallback(()=>{setTimeout(()=>{d.trim()||n(false);},150);},[d]);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:d,onChange:p=>m(p.target.value),onKeyDown:c,onBlur:l,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!d.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:()=>{m(""),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 Fi({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:d="dark",locale:m="es"}){let[i,c]=useState(false),[l,p]=useState(false),[f,v]=useState(""),[w,g]=useState([]),[y,h]=useState(""),[b,x]=useState(""),[N,D]=useState(""),[T,k]=useState(false),[R,I]=useState(false),[C,W]=useState(false),B=useRef(null),Q=useRef(null),S={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},_=useCallback(()=>{v(""),g([]),h(""),x(""),D(""),k(false),I(false),W(false),c(false);},[]);useEffect(()=>{i&&B.current&&B.current.focus();},[i]),useEffect(()=>{if(!i)return;let L=U=>{Q.current&&!Q.current.contains(U.target)&&(f.trim()||_());};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[i,f,_]);let oe=useCallback(async()=>{let L=f.trim();if(!(!L||l)){p(true);try{await t({name:L,columnId:e,assigneeIds:w.length>0?w:void 0,startDate:y?new Date(y):void 0,endDate:b?new Date(b):void 0,priority:N||void 0}),v(""),g([]),h(""),x(""),D(""),k(!1),I(!1),W(!1),B.current?.focus();}catch(U){console.error("Error creating card:",U);}finally{p(false);}}},[f,e,w,y,b,N,t,l]),Te=useCallback(L=>{L.key==="Enter"&&!L.shiftKey?(L.preventDefault(),oe()):L.key==="Escape"&&_();},[oe,_]),A=useCallback(L=>{g(U=>U.includes(L)?U.filter(E=>E!==L):[...U,L]);},[]),Ee=d==="dark";return i?jsxs("div",{ref:Q,className:u("rounded-lg overflow-hidden shadow-lg",Ee?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxs("div",{className:"p-3",children:[jsx("input",{ref:B,type:"text",value:f,onChange:L=>v(L.target.value),onKeyDown:Te,placeholder:S.placeholder,disabled:l,className:u("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",Ee?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxs("button",{onClick:()=>k(!T),className:u("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||w.length>0?"bg-emerald-500/20 text-emerald-400":Ee?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.addAssignee,children:[jsxs("svg",{width:"14",height:"14",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"})]}),w.length>0&&jsx("span",{className:"ml-0.5",children:w.length})]}),jsx("button",{onClick:()=>I(!R),className:u("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",R||y||b?"bg-blue-500/20 text-blue-400":Ee?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.addDates,children:jsxs("svg",{width:"14",height:"14",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("button",{onClick:()=>W(!C),className:u("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",C||N?N==="urgent"?"bg-red-500/20 text-red-400":N==="high"?"bg-orange-500/20 text-orange-400":N==="medium"?"bg-yellow-500/20 text-yellow-400":N==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":Ee?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.addPriority,children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsx("div",{className:"flex-1"}),jsx("button",{onClick:oe,disabled:!f.trim()||l,className:u("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:l?jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):S.save})]})]}),T&&a.length>0&&jsx("div",{className:u("px-3 pb-3 pt-0","border-t",Ee?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(L=>jsxs("button",{onClick:()=>A(L.id),className:u("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",w.includes(L.id)?"bg-emerald-500 text-white":Ee?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[L.avatar?jsx("img",{src:L.avatar,alt:L.name,className:"w-4 h-4 rounded-full"}):jsx("div",{className:u("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",w.includes(L.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:L.name.charAt(0).toUpperCase()}),jsx("span",{children:L.name.split(" ")[0]})]},L.id))})}),R&&jsx("div",{className:u("px-3 pb-3 pt-0","border-t",Ee?"border-[#3a3a4e]":"border-gray-200"),children:jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxs("div",{children:[jsx("label",{className:u("block text-[10px] uppercase tracking-wide mb-1",Ee?"text-gray-500":"text-gray-400"),children:S.startDate}),jsx("input",{type:"date",value:y,onChange:L=>h(L.target.value),className:u("w-full px-2 py-1.5 rounded text-xs border",Ee?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxs("div",{children:[jsx("label",{className:u("block text-[10px] uppercase tracking-wide mb-1",Ee?"text-gray-500":"text-gray-400"),children:S.endDate}),jsx("input",{type:"date",value:b,onChange:L=>x(L.target.value),className:u("w-full px-2 py-1.5 rounded text-xs border",Ee?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),C&&jsx("div",{className:u("px-3 pb-3 pt-0","border-t",Ee?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(L=>jsx("button",{onClick:()=>D(N===L?"":L),className:u("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",N===L?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[L]} text-white`:Ee?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:S[L]},L))})})]}):jsxs("button",{onClick:()=>c(true),disabled:n,className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",Ee?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",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"})]}),jsx("span",{className:"text-sm font-medium",children:S.buttonLabel})]})}var gn=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(Kr,{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 Xc(e={}){return new gn(e)}var zo=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 Ai(e,t){let a=r=>jsx(zo,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Ii({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:d,onOpenAIUsage:m,shortcut:i="k",className:c=""}){let[l,p]=useState(false),[f,v]=useState(""),[w,g]=useState("home"),[y,h]=useState(""),[b,x]=useState("");useEffect(()=>{let k=R=>{(R.metaKey||R.ctrlKey)&&R.key===i&&(R.preventDefault(),p(I=>!I)),R.key==="Escape"&&(p(false),g("home"),v(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i]),useEffect(()=>{l||(g("home"),v(""),h(""),x(""));},[l]);let N=useCallback(()=>{p(false);},[]),D=useCallback(k=>{let[R,I]=k.split(":");switch(R){case "create-card":g("create-card");break;case "create-card-in":h(I||"");break;case "navigate":I?(a?.(I),N()):g("navigate");break;case "search":r?.(f),N();break;case "priority":g("priority");break;case "set-priority":b&&I&&(o?.(b,I),N());break;case "assign":g("assign");break;case "assign-user":b&&I&&(s?.(b,I),N());break;case "ai":g("ai");break;case "ai-generate-plan":n?.(),N();break;case "ai-predict-risks":d?.(),N();break;case "ai-usage":m?.(),N();break;case "back":g("home");break;}},[f,b,t,a,r,o,s,n,d,m,N]),T=useCallback(()=>{y&&f.trim()&&(t?.(y,f.trim()),N());},[y,f,t,N]);return l?jsx(gt,{children:jsx("div",{className:"command-palette-overlay",onClick:N,children:jsx("div",{className:`command-palette ${c}`,onClick:k=>k.stopPropagation(),children:jsxs(Command,{value:f,onValueChange:v,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:w==="create-card"&&y?"Type card title and press Enter...":w==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&w==="create-card"&&y&&T();}}),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."}),w==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:D,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsx("span",{children:"Create Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxs(Command.Item,{value:"navigate",onSelect:D,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 16 16 12 12 8"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsx("span",{children:"Navigate to Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxs(Command.Item,{value:"search",onSelect:D,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx("span",{children:"Search Cards"}),jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsx(Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxs(Command.Item,{value:"ai",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"AI Commands"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsx(Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(k=>jsxs(Command.Item,{value:`navigate:${k.id}`,onSelect:D,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:k.title}),k.labels&&k.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(R=>jsx("span",{className:"command-palette-item-label",children:R},R))})]},k.id))})]}),w==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(k=>jsxs(Command.Item,{value:`create-card-in:${k.id}`,onSelect:D,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsx("span",{children:k.title}),jsxs("div",{className:"command-palette-item-count",children:[k.cardIds.length," cards"]})]},k.id))})]}),w==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(k=>{let R=e.columns.find(I=>I.id===k.columnId);return jsxs(Command.Item,{value:`navigate:${k.id}`,onSelect:D,className:"command-palette-item",keywords:[k.title,k.description||"",...k.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:k.priority==="URGENT"?"#EF4444":k.priority==="HIGH"?"#F59E0B":k.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:k.title}),jsx("div",{className:"command-palette-item-meta",children:R?.title})]}),k.labels&&k.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(I=>jsx("span",{className:"command-palette-item-label",children:I},I))})]},k.id)})})]}),w==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:D,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsxs(Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxs(Command.Item,{value:"ai-generate-plan",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"Generate Project Plan"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-predict-risks",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Predict Risks"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-usage",onSelect:D,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsx("span",{children:"AI Usage & Costs"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxs("div",{className:"command-palette-footer",children:[jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"\u2191"}),jsx("kbd",{children:"\u2193"}),jsx("span",{children:"Navigate"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Enter"}),jsx("span",{children:"Select"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Esc"}),jsx("span",{children:"Close"})]})]})]})})})}):null}function Qc(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 d=document.createElement("img");d.src=e,d.alt=t,d.className="attachment-lightbox-image",d.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
|
+
`,d.onclick=l=>l.stopPropagation();let m=document.createElement("div");m.className="attachment-lightbox-hint",m.textContent="Click anywhere or press ESC to close",m.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 i=()=>{n.remove(),document.removeEventListener("keydown",
|
|
41
|
+
`;let i=()=>{n.remove(),document.removeEventListener("keydown",c);},c=l=>{if(l.key==="Escape")i();else if(l.key==="ArrowLeft"&&a.length>1){let p=r>0?r-1:a.length-1;i(),o(p);}else if(l.key==="ArrowRight"&&a.length>1){let p=r<a.length-1?r+1:0;i(),o(p);}};if(n.onclick=i,document.addEventListener("keydown",c),a.length>1){let l=document.createElement("div");l.className="attachment-lightbox-dots",l.style.cssText=`
|
|
42
42
|
position: absolute !important;
|
|
43
43
|
bottom: 48px !important;
|
|
44
44
|
left: 50% !important;
|
|
@@ -48,7 +48,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
48
48
|
padding: 8px 12px !important;
|
|
49
49
|
background: rgba(0, 0, 0, 0.4) !important;
|
|
50
50
|
border-radius: 20px !important;
|
|
51
|
-
`,
|
|
51
|
+
`,l.onclick=v=>v.stopPropagation(),a.forEach((v,w)=>{let g=document.createElement("button");g.className=`attachment-lightbox-dot ${w===r?"active":""}`,g.style.cssText=`
|
|
52
52
|
width: 8px !important;
|
|
53
53
|
height: 8px !important;
|
|
54
54
|
border-radius: 50% !important;
|
|
@@ -56,7 +56,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
56
56
|
border: none !important;
|
|
57
57
|
padding: 0 !important;
|
|
58
58
|
cursor: pointer !important;
|
|
59
|
-
`,g.onclick=y=>{y.stopPropagation(),i(),o(w);},
|
|
59
|
+
`,g.onclick=y=>{y.stopPropagation(),i(),o(w);},l.appendChild(g);});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;
|
|
@@ -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
|
-
`,f.onmouseenter=()=>{f.style.opacity="1";},f.onmouseleave=()=>{f.style.opacity="0.5";},f.onclick=v=>{v.stopPropagation();let w=r<a.length-1?r+1:0;i(),o(w);},n.appendChild(d),n.appendChild(p),n.appendChild(f);}n.appendChild(l),n.appendChild(c),document.body.appendChild(n),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function V0(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 _0(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 Ri(e){return e.startsWith("image/")}function Dr({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),f=useRef(e);f.current=e;let v=useCallback((k,O)=>{O.preventDefault(),O.stopPropagation();let I=f.current.filter(R=>Ri(R.type)),C=I.findIndex(R=>R.id===k.id),H=R=>{let Q=f.current.filter(G=>Ri(G.type)),S=Q[R];S&&Qc(S.url,S.name,Q,R,H);};Qc(k.url,k.name,I,C,H);},[]),w=useCallback(k=>{let O=[],I=[];return e.length+k.length>s?(I.push(`Maximum ${s} files allowed`),{valid:O,errors:I}):(k.forEach(C=>{if(C.size/1048576>r){I.push(`${C.name} is too large (max ${r}MB)`);return}if(o&&!o.some(R=>C.type.match(R))){I.push(`${C.name} has invalid file type`);return}O.push(C);}),{valid:O,errors:I})},[e.length,s,r,o]),g=useCallback(async k=>{let{valid:O,errors:I}=w(k);if(I.length>0){d(I.join(", ")),setTimeout(()=>d(null),5e3);return}if(O.length!==0){i(true),d(null);try{await t?.(O);}catch(C){d(C instanceof Error?C.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[w,t]),y=useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(true);},[]),h=useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(false);},[]),b=useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),x=useCallback(k=>{k.preventDefault(),k.stopPropagation(),l(false);let O=Array.from(k.dataTransfer.files);g(O);},[g]),N=useCallback(k=>{let O=k.target.files?Array.from(k.target.files):[];g(O),p.current&&(p.current.value="");},[g]),D=useCallback(()=>{p.current?.click();},[]),T=useCallback(k=>{confirm("Are you sure you want to delete this attachment?")&&a?.(k);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${c?"uploading":""}`,onDragEnter:y,onDragLeave:h,onDragOver:b,onDrop:x,onClick:D,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(k=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Ri(k.type)&&k.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:O=>v(k,O),title:"Click to view full size",children:[jsx("img",{src:k.thumbnailUrl||k.url,alt:k.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:_0(k.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:k.name,children:k.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:V0(k.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(k.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>T(k.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"})})})]},k.id))})]})}function Oi({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:f,onSuggestAssignee:v,onGenerateSubtasks:w,onEstimateEffort:g,currentUserId:y="user-1"}){let[h,b]=useState("details"),[x,N]=useState(false),[D,T]=useState({}),[k,O]=useState(""),[I,C]=useState(false),[H,R]=useState({});if(!t||!e)return null;let Q=useCallback(()=>{N(false),T({}),b("details"),O(""),R({}),a();},[a]),S=useCallback(()=>{r&&Object.keys(D).length>0&&(r(e.id,D),T({}),N(false));},[e.id,D,r]),G=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),Q());},[e.id,o,Q]),ne=useCallback(()=>{m&&k.trim()&&(m(e.id,k.trim()),O(""));},[e.id,k,m]),Ce=useCallback(async()=>{if(v){C(true);try{let E=await v(e);R(q=>({...q,assignees:E}));}catch(E){console.error("Failed to suggest assignee:",E);}finally{C(false);}}},[e,v]),A=useCallback(async()=>{if(w){C(true);try{let E=await w(e);R(q=>({...q,subtasks:E}));}catch(E){console.error("Failed to generate subtasks:",E);}finally{C(false);}}},[e,w]),Pe=useCallback(async()=>{if(g){C(true);try{let E=await g(e);R(q=>({...q,effort:E}));}catch(E){console.error("Failed to estimate effort:",E);}finally{C(false);}}},[e,g]),L={...e,...D},U=s.filter(E=>L.assignedUserIds?.includes(E.id));return jsx(ht,{children:jsx("div",{className:"card-detail-overlay",onClick:Q,children:jsxs("div",{className:"card-detail-modal",onClick:E=>E.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:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),x?jsx("input",{type:"text",value:D.title??L.title,onChange:E=>T({...D,title:E.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:L.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[x?jsxs(Fragment,{children:[jsx("button",{onClick:S,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{N(false),T({});},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:G,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:Q,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:()=>b("details"),className:`card-detail-tab ${h==="details"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxs("button",{onClick:()=>b("comments"),className:`card-detail-tab ${h==="comments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxs("button",{onClick:()=>b("activity"),className:`card-detail-tab ${h==="activity"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxs("button",{onClick:()=>b("attachments"),className:`card-detail-tab ${h==="attachments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxs("button",{onClick:()=>b("ai"),className:`card-detail-tab ${h==="ai"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxs("div",{className:"card-detail-content",children:[h==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),x?jsx("textarea",{value:D.description??L.description??"",onChange:E=>T({...D,description:E.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:L.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsx("select",{multiple:true,value:D.assignedUserIds??L.assignedUserIds??[],onChange:E=>{let q=Array.from(E.target.selectedOptions,ee=>ee.value);T({...D,assignedUserIds:q});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(E=>jsx("option",{value:E.id,children:E.name},E.id))}):jsx("div",{className:"card-detail-users",children:U.length>0?U.map(E=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:E.color},children:E.initials}),jsx("span",{children:E.name})]},E.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),x?jsxs("select",{value:D.priority??L.priority??"",onChange:E=>T({...D,priority:E.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:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:L.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:L.labels&&L.labels.length>0?L.labels.map(E=>jsx("span",{className:"card-detail-label-tag",children:E},E)):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"}),x?jsx("input",{type:"date",value:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:L.startDate?new Date(L.startDate).toISOString().split("T")[0]:"",onChange:E=>T({...D,startDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:L.startDate?new Date(L.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsx("input",{type:"date",value:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:L.endDate?new Date(L.endDate).toISOString().split("T")[0]:"",onChange:E=>T({...D,endDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:L.endDate?new Date(L.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsx("input",{type:"number",min:"0",step:"0.5",value:D.estimatedTime??L.estimatedTime??"",onChange:E=>T({...D,estimatedTime:E.target.value?parseFloat(E.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:L.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:L.dependencies&&L.dependencies.length>0?L.dependencies.map(E=>{let q=typeof E=="string"?E:E.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",q.slice(-4)]},q)}):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:L.createdAt?new Date(L.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:k,onChange:E=>O(E.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:ne,disabled:!k.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(E=>{let q=s.find(ee=>ee.id===E.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:[q&&jsx("div",{className:"card-detail-user-avatar",style:{background:q.color},children:q.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:q?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(E.createdAt).toLocaleString()})]})]}),d&&jsx("button",{onClick:()=>d(E.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:E.content})]},E.id)}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("p",{children:"No comments yet"}),jsx("span",{children:"Be the first to comment"})]})})]}),h==="activity"&&jsx("div",{className:"card-detail-activity",children:l.length>0?jsx("div",{className:"card-detail-activity-list",children:l.map(E=>{let q=s.find(ee=>ee.id===E.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[E.type.includes("CREATED")&&"\u2795",E.type.includes("UPDATED")&&"\u270F\uFE0F",E.type.includes("MOVED")&&"\u27A1\uFE0F",E.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",E.type.includes("COMMENT")&&"\u{1F4AC}",E.type.includes("ASSIGNED")&&"\u{1F464}",E.type.includes("PRIORITY")&&"\u{1F3AF}",E.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",E.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:q?.name||"Unknown"})," ",E.type.replace(/_/g," ").toLowerCase(),E.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:E.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(E.timestamp).toLocaleString()})]})]},E.id)})}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})}),h==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(Dr,{cardId:e.id,attachments:i,onUpload:p?E=>p(e.id,E):void 0,onDelete:f,currentUserId:y,maxSizeMB:10,maxFiles:20})}),h==="ai"&&jsxs("div",{className:"card-detail-ai",children:[jsxs("div",{className:"card-detail-ai-actions",children:[jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxs("button",{onClick:Ce,disabled:I||!v,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:A,disabled:I||!w,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:Pe,disabled:I||!g,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"]})]}),H.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),H.assignees.map((E,q)=>{let ee=s.find(fe=>fe.id===E.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[ee&&jsx("div",{className:"card-detail-user-avatar",style:{background:ee.color},children:ee.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:ee?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:E.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(E.confidence*100).toFixed(0),"%"]})]})]},q)})]}),H.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),H.subtasks.map((E,q)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:E.title}),E.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:E.description}),E.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",E.estimatedTime,"h"]})]},q))]}),H.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:[H.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(H.effort.confidence*100).toFixed(0),"%"]})]})]}),c.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),c.map(E=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${E.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:E.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:E.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:E.description}),E.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",E.suggestedAction]})]},E.id))]}),!H.assignees&&!H.subtasks&&!H.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 fn({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,f=window.innerWidth,v=4,w=d.left;w+o>f-10&&(w=f-o-10),w<10&&(w=10);let g=p-d.bottom,y=d.top,h;return g>=s+v?h=d.bottom+v:y>=s+v?h=d.top-s-v:g>=y?h=d.bottom+v:h=Math.max(10,d.top-s-v),{top:h,left:w}},[e,o,s]);return useEffect(()=>{t&&c(m());},[t,m]),useEffect(()=>{if(!t)return;let d=f=>{let v=f.target;i.current&&!i.current.contains(v)&&e.current&&!e.current.contains(v)&&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(ht,{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 Qe={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"#9CA3AF",dependencyHover:"#6B7280",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},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:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#4B5563",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:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},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:"#57534E",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"}};var Q0=["LOW","MEDIUM","HIGH","URGENT"],eh=["todo","in-progress","review","done"];function Ui({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:f,availableColumns:v=[],availableLabels:w=[],availableTags:g=[],onCreateTag:y,onUploadCoverImage:h,unsplashAccessKey:b,theme:x,onSubtasksChange:N,attachments:D=[],onUploadAttachments:T,onDeleteAttachment:k}){let O=Fo(),I=x||O?.themeName||"dark",[C,H]=useState(e),[R,Q]=useState(false),[S,G]=useState(e?.subtasks||[]),[ne,Ce]=useState(false),[A,Pe]=useState(""),[L,U]=useState(""),[E,q]=useState("all"),[ee,fe]=useState(false),[ue,pe]=useState(false),[Oe,ae]=useState(false),[nt,Fe]=useState(false),[qe,ut]=useState(false),[St,je]=useState(false),Ft=useRef(null),it=useRef(null),pt=useRef(null),ie=useRef(null),B=useRef(null),Z=useRef(null),ce=useRef(null),ke=useRef(null),$e=useRef(null),Xe=useRef(null),at=useRef(null),ze=useRef(null);useEffect(()=>{e&&!C?(H({...e}),G(e.subtasks||[])):e&&C&&e.id!==C.id&&(H({...e}),G(e.subtasks||[]));},[e,C]),useEffect(()=>{let V=le=>{let _e=le.target;ie.current&&!ie.current.contains(_e)&&fe(false),B.current&&!B.current.contains(_e)&&pe(false),Z.current&&!Z.current.contains(_e)&&ae(false),ce.current&&!ce.current.contains(_e)&&Fe(false);};if(ee||ue||Oe||nt)return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[ee,ue,Oe,nt]),useEffect(()=>{if(!t)return;let V=le=>{let _e=le.target,yt=_e.tagName==="INPUT"||_e.tagName==="TEXTAREA"||_e.isContentEditable;if(le.key==="Escape"){le.preventDefault(),ee||ue||Oe||nt||qe||St?(fe(false),pe(false),ae(false),Fe(false),ut(false),je(false)):yt||a();return}if(yt&&le.key!=="Escape")return;let lt=le.metaKey||le.ctrlKey;switch(le.key.toLowerCase()){case "s":le.preventDefault(),fe(true);break;case "a":le.preventDefault(),ae(true);break;case "p":le.preventDefault(),pe(true);break;case "l":le.preventDefault(),Fe(true);break;case "d":lt||(le.preventDefault(),ut(true),setTimeout(()=>ke.current?.focus(),0));break;case "e":lt||(le.preventDefault(),je(true));break;case "i":le.preventDefault(),Q(true),setTimeout(()=>it.current?.focus(),0);break;case "t":le.preventDefault(),Ce(true);break;case "c":le.preventDefault(),pt.current?.focus();break}};return window.addEventListener("keydown",V),()=>window.removeEventListener("keydown",V)},[t,a,ee,ue,Oe,nt,qe,St]);let oa=useCallback(V=>{let le=V.currentTarget.textContent?.trim()||"";if(C&&le!==C.title){let _e={...C,title:le};H(_e),r?.(C.id,{title:le});}},[C,r]),W=useCallback(V=>{V.key==="Enter"&&(V.preventDefault(),V.currentTarget.blur()),V.key==="Escape"&&(V.preventDefault(),V.currentTarget.textContent=C?.title||"",V.currentTarget.blur());},[C]),Y=useCallback(()=>{C&&e&&C.description!==e.description&&r?.(C.id,{description:C.description}),Q(false);},[C,e,r]),be=useCallback(V=>{if(C){let le={...C,columnId:V};H(le),r?.(C.id,{columnId:V}),fe(false);}},[C,r]),Ye=useCallback(V=>{if(C){let le={...C,priority:V};H(le),r?.(C.id,{priority:V}),pe(false);}},[C,r]),Te=useCallback(V=>{if(C){let le=C.assignedUserIds||[],_e=le.includes(V)?le.filter(lt=>lt!==V):[...le,V],yt={...C,assignedUserIds:_e};H(yt),r?.(C.id,{assignedUserIds:_e});}},[C,r]),De=useCallback(V=>{if(C){let le=C.labels||[],_e=le.includes(V)?le.filter(lt=>lt!==V):[...le,V],yt={...C,labels:_e};H(yt),r?.(C.id,{labels:_e});}},[C,r]),X=useCallback(V=>{if(C){let le={...C,tags:V};H(le),r?.(C.id,{tags:V});}},[C,r]),re=useCallback(V=>{if(C){let le=V.target.value,_e={...C,endDate:le};H(_e),r?.(C.id,{endDate:le}),ut(false);}},[C,r]),_=useCallback(V=>{if(C){let le={...C,estimatedTime:parseFloat(V)||0};H(le),r?.(C.id,{estimatedTime:parseFloat(V)||0});}},[C,r]),Ie=useCallback(()=>{if(A.trim()&&C){let V={id:`subtask-${Date.now()}`,title:A.trim(),completed:false,createdAt:new Date},le=[...S,V];G(le),Pe(""),Ce(false),N?.(C.id,le);}},[A,S,C,N]),Ae=useCallback(V=>{let le=S.map(_e=>_e.id===V?{..._e,completed:!_e.completed,updatedAt:new Date}:_e);G(le),C&&N?.(C.id,le);},[S,C,N]),Ge=useCallback(V=>{let le=S.filter(_e=>_e.id!==V);G(le),C&&N?.(C.id,le);},[S,C,N]),He=useCallback(()=>{L.trim()&&C&&c&&(c(C.id,L.trim()),U(""));},[L,C,c]),Be=useCallback(V=>{(V.metaKey||V.ctrlKey)&&V.key==="Enter"&&(V.preventDefault(),He());},[He]),z=V=>jsx(X0,{remarkPlugins:[J0],rehypePlugins:[Z0],components:{a:({node:le,..._e})=>jsx("a",{..._e,target:"_blank",rel:"noopener noreferrer"})},children:V}),j=l.filter(V=>E==="comments"?V.type.includes("COMMENT"):E==="history"?!V.type.includes("COMMENT"):true);if(!t||!e)return null;let ye=C||e,Ve=s.filter(V=>ye.assignedUserIds?.includes(V.id)),Ke=S.filter(V=>V.completed).length;return jsx(ht,{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:V=>V.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:Ft,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:oa,onKeyDown:W,children:ye.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:ie,children:[jsxs("button",{ref:$e,className:"modal-v2-field",onClick:()=>fe(!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("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:ye.columnId||"No status"})]}),jsx(fn,{triggerRef:$e,isOpen:ee,onClose:()=>fe(false),width:250,estimatedHeight:200,children:(v.length>0?v:eh.map(V=>({id:V,title:V}))).map(V=>jsx("button",{className:`modal-v2-popover-item ${ye.columnId===V.id?"active":""}`,onClick:()=>be(V.id),children:V.title},V.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:Z,children:[jsxs("button",{ref:Xe,className:"modal-v2-field",onClick:()=>ae(!Oe),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:Ve.length>0?jsx("div",{className:"modal-v2-avatars",children:Ve.map(V=>jsx("div",{className:"modal-v2-avatar",style:{background:V.color},title:V.name,children:V.initials},V.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(fn,{triggerRef:Xe,isOpen:Oe,onClose:()=>ae(false),width:280,estimatedHeight:300,children:s.map(V=>jsxs("button",{className:`modal-v2-popover-item ${ye.assignedUserIds?.includes(V.id)?"active":""}`,onClick:()=>Te(V.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:V.color},children:V.initials}),V.name,ye.assignedUserIds?.includes(V.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"})})]},V.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:B,children:[jsxs("button",{ref:at,className:"modal-v2-field",onClick:()=>pe(!ue),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:ye.priority||"None"})]}),jsxs(fn,{triggerRef:at,isOpen:ue,onClose:()=>pe(false),width:180,estimatedHeight:220,children:[Q0.map(V=>jsx("button",{className:`modal-v2-popover-item priority-${V.toLowerCase()} ${ye.priority===V?"active":""}`,onClick:()=>Ye(V),children:V},V)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ye(""),children:"None"})]})]}),g.length>0||y?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(_r,{selectedTags:ye.tags||[],availableTags:g,onChange:X,onCreateTag:y,theme:Qe[I]||Qe.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:ce,children:[jsxs("button",{ref:ze,className:"modal-v2-field",onClick:()=>Fe(!nt),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:ye.labels&&ye.labels.length>0?jsx("span",{children:ye.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(fn,{triggerRef:ze,isOpen:nt,onClose:()=>Fe(false),width:220,estimatedHeight:200,children:(w.length>0?w:["Bug","Feature","Enhancement","Documentation"]).map(V=>jsxs("button",{className:`modal-v2-popover-item ${ye.labels?.includes(V)?"active":""}`,onClick:()=>De(V),children:[V,ye.labels?.includes(V)&&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"})})]},V))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{ut(!qe),setTimeout(()=>ke.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:ye.endDate?new Date(ye.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:ke,type:"date",value:typeof ye.endDate=="string"?ye.endDate.split("T")[0]:ye.endDate?(()=>{let V=new Date(ye.endDate),le=V.getUTCFullYear(),_e=String(V.getUTCMonth()+1).padStart(2,"0"),yt=String(V.getUTCDate()).padStart(2,"0");return `${le}-${_e}-${yt}`})():"",onChange:re,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>je(!St),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:ye.estimatedTime?`${ye.estimatedTime}h`:"Not set"})]}),St&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ye.estimatedTime||"",onChange:V=>_(V.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>je(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"})]}),R?jsx("textarea",{className:"modal-v2-textarea",value:ye.description||"",onChange:V=>{if(C){let le={...C,description:V.target.value};H(le);}},onBlur:Y,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>Q(true),children:ye.description?jsx("div",{className:"modal-v2-markdown",children:z(ye.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"}),S.length>0&&jsxs("span",{className:"modal-v2-count",children:[Ke,"/",S.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>Ce(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:[S.map(V=>jsxs("div",{className:`modal-v2-subtask ${V.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Ae(V.id),children:V.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:V.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Ge(V.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"})]})})]},V.id)),ne&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:A,onChange:V=>Pe(V.target.value),onKeyDown:V=>{V.key==="Enter"&&Ie(),V.key==="Escape"&&(Ce(false),Pe(""));},onBlur:Ie,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(T||D.length>0)&&jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsx("h2",{children:"Attachments"}),D.length>0&&jsx("span",{className:"modal-v2-count",children:D.length})]}),jsx(Dr,{cardId:ye.id,attachments:D,onUpload:T?V=>T(ye.id,V):void 0,onDelete:k,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 ${E==="all"?"active":""}`,onClick:()=>q("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${E==="comments"?"active":""}`,onClick:()=>q("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${E==="history"?"active":""}`,onClick:()=>q("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:pt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:L,onChange:V=>U(V.target.value),onKeyDown:Be,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:He,disabled:!L.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[j.map(V=>{let le=s.find(yt=>yt.id===V.userId);if(V.type.includes("COMMENT")){let yt=n.find(lt=>lt.id===V.metadata?.commentId);return yt?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[le&&jsx("div",{className:"modal-v2-avatar",style:{background:le.color},children:le.initials}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-activity-header",children:[jsx("span",{className:"modal-v2-activity-user",children:le?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(V.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:yt.content})]})]},V.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[V.type.includes("CREATED")&&"\u2795",V.type.includes("UPDATED")&&"\u270F\uFE0F",V.type.includes("MOVED")&&"\u27A1\uFE0F",V.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",V.type.includes("ASSIGNED")&&"\u{1F464}",V.type.includes("PRIORITY")&&"\u{1F3AF}",V.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-history-text",children:[jsx("span",{className:"modal-v2-activity-user",children:le?.name||"Unknown"})," ",V.type.replace(/_/g," ").toLowerCase(),V.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:V.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(V.timestamp).toLocaleString()})]})]},V.id)}),j.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function dh({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 Wi({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(dh,{})}),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:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",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:"#3B82F6"},children:e.reduce((n,l)=>n+(l.planned||0),0)})]})]})]})}function yh({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 Gi({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(yh,{})}),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 Sh={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},lm=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Eh({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 dm({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 Vi({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||Sh[c.name]||lm[e.indexOf(c)%lm.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?Eh:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((c,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(dm,{})}),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(dm,{})}),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:"#3B82F6"},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 ls=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,f]=useState(false);if(e.length===0)return null;let v=e.map(x=>x.id),w=x=>{r.onBulkUpdate?.(v,{priority:x}),l(false);},g=x=>{r.onBulkMove?.(v,x),i(false),a();},y=x=>{r.onBulkUpdate?.(v,{assignedUserIds:x}),d(false);},h=x=>{let N=new Set;e.forEach(T=>{T.labels?.forEach(k=>N.add(k));});let D=Array.from(new Set([...N,...x]));r.onBulkUpdate?.(v,{labels:D}),f(false);},b=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(v),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(x=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>w(x),children:[jsx("span",{className:u("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),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(x=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(x.id),children:x.title},x.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(x=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([x.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>f(!p),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(x=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([x]),children:x},x))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:b,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"})})]})]})})});ls.displayName="BulkOperationsToolbar";function Lh(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(f=>{let v=a?.find(w=>w.id===f);n=`assignee-${f}`,l=v?.name||`User ${f}`,c=v?.color,i=v?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:f,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(f=>{n=`label-${f}`,l=f,c="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:f,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 _i({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),l=useMemo(()=>Lh(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(Kr,{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(f=>i.cardIds.includes(f.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(Kr,{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 ji=[{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 Ki({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),l=ji.find(i=>i.value===e)||ji[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:ji.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 hn=[{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 Rh(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 gm(e={}){let{shortcuts:t=hn,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(Rh(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 $h(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function zh(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 Uh(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=zh(e),r=t?$h(t):"";return a?`${a} + ${r}`:r}function Hh(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 qi({shortcuts:e=hn,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=Hh(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:Uh(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 Yi=[{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
|
+
`,f.onmouseenter=()=>{f.style.opacity="1";},f.onmouseleave=()=>{f.style.opacity="0.5";},f.onclick=v=>{v.stopPropagation();let w=r<a.length-1?r+1:0;i(),o(w);},n.appendChild(l),n.appendChild(p),n.appendChild(f);}n.appendChild(d),n.appendChild(m),document.body.appendChild(n),setTimeout(()=>{m.style.transition="opacity 0.5s ease",m.style.opacity="0";},2e3);}function _0(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 j0(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 Ri(e){return e.startsWith("image/")}function Er({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,d]=useState(false),[m,i]=useState(false),[c,l]=useState(null),p=useRef(null),f=useRef(e);f.current=e;let v=useCallback((k,R)=>{R.preventDefault(),R.stopPropagation();let I=f.current.filter(B=>Ri(B.type)),C=I.findIndex(B=>B.id===k.id),W=B=>{let Q=f.current.filter(_=>Ri(_.type)),S=Q[B];S&&Qc(S.url,S.name,Q,B,W);};Qc(k.url,k.name,I,C,W);},[]),w=useCallback(k=>{let R=[],I=[];return e.length+k.length>s?(I.push(`Maximum ${s} files allowed`),{valid:R,errors:I}):(k.forEach(C=>{if(C.size/1048576>r){I.push(`${C.name} is too large (max ${r}MB)`);return}if(o&&!o.some(B=>C.type.match(B))){I.push(`${C.name} has invalid file type`);return}R.push(C);}),{valid:R,errors:I})},[e.length,s,r,o]),g=useCallback(async k=>{let{valid:R,errors:I}=w(k);if(I.length>0){l(I.join(", ")),setTimeout(()=>l(null),5e3);return}if(R.length!==0){i(true),l(null);try{await t?.(R);}catch(C){l(C instanceof Error?C.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{i(false);}}},[w,t]),y=useCallback(k=>{k.preventDefault(),k.stopPropagation(),d(true);},[]),h=useCallback(k=>{k.preventDefault(),k.stopPropagation(),d(false);},[]),b=useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),x=useCallback(k=>{k.preventDefault(),k.stopPropagation(),d(false);let R=Array.from(k.dataTransfer.files);g(R);},[g]),N=useCallback(k=>{let R=k.target.files?Array.from(k.target.files):[];g(R),p.current&&(p.current.value="");},[g]),D=useCallback(()=>{p.current?.click();},[]),T=useCallback(k=>{confirm("Are you sure you want to delete this attachment?")&&a?.(k);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${m?"uploading":""}`,onDragEnter:y,onDragLeave:h,onDragOver:b,onDrop:x,onClick:D,children:[jsx("input",{ref:p,type:"file",multiple:true,onChange:N,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:m?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"]})]})})]}),c&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:c})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(k=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Ri(k.type)&&k.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:R=>v(k,R),title:"Click to view full size",children:[jsx("img",{src:k.thumbnailUrl||k.url,alt:k.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:j0(k.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:k.name,children:k.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:_0(k.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(k.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>T(k.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"})})})]},k.id))})]})}function Oi({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],aiInsights:m=[],attachments:i=[],onAddComment:c,onDeleteComment:l,onUploadAttachments:p,onDeleteAttachment:f,onSuggestAssignee:v,onGenerateSubtasks:w,onEstimateEffort:g,currentUserId:y="user-1"}){let[h,b]=useState("details"),[x,N]=useState(false),[D,T]=useState({}),[k,R]=useState(""),[I,C]=useState(false),[W,B]=useState({});if(!t||!e)return null;let Q=useCallback(()=>{N(false),T({}),b("details"),R(""),B({}),a();},[a]),S=useCallback(()=>{r&&Object.keys(D).length>0&&(r(e.id,D),T({}),N(false));},[e.id,D,r]),_=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),Q());},[e.id,o,Q]),oe=useCallback(()=>{c&&k.trim()&&(c(e.id,k.trim()),R(""));},[e.id,k,c]),Te=useCallback(async()=>{if(v){C(true);try{let E=await v(e);B(q=>({...q,assignees:E}));}catch(E){console.error("Failed to suggest assignee:",E);}finally{C(false);}}},[e,v]),A=useCallback(async()=>{if(w){C(true);try{let E=await w(e);B(q=>({...q,subtasks:E}));}catch(E){console.error("Failed to generate subtasks:",E);}finally{C(false);}}},[e,w]),Ee=useCallback(async()=>{if(g){C(true);try{let E=await g(e);B(q=>({...q,effort:E}));}catch(E){console.error("Failed to estimate effort:",E);}finally{C(false);}}},[e,g]),L={...e,...D},U=s.filter(E=>L.assignedUserIds?.includes(E.id));return jsx(gt,{children:jsx("div",{className:"card-detail-overlay",onClick:Q,children:jsxs("div",{className:"card-detail-modal",onClick:E=>E.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:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),x?jsx("input",{type:"text",value:D.title??L.title,onChange:E=>T({...D,title:E.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:L.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[x?jsxs(Fragment,{children:[jsx("button",{onClick:S,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{N(false),T({});},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:_,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:Q,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:()=>b("details"),className:`card-detail-tab ${h==="details"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxs("button",{onClick:()=>b("comments"),className:`card-detail-tab ${h==="comments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",n.length>0&&jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxs("button",{onClick:()=>b("activity"),className:`card-detail-tab ${h==="activity"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",d.length>0&&jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxs("button",{onClick:()=>b("attachments"),className:`card-detail-tab ${h==="attachments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",i.length>0&&jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxs("button",{onClick:()=>b("ai"),className:`card-detail-tab ${h==="ai"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxs("div",{className:"card-detail-content",children:[h==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),x?jsx("textarea",{value:D.description??L.description??"",onChange:E=>T({...D,description:E.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:L.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsx("select",{multiple:true,value:D.assignedUserIds??L.assignedUserIds??[],onChange:E=>{let q=Array.from(E.target.selectedOptions,ee=>ee.value);T({...D,assignedUserIds:q});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(E=>jsx("option",{value:E.id,children:E.name},E.id))}):jsx("div",{className:"card-detail-users",children:U.length>0?U.map(E=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:E.color},children:E.initials}),jsx("span",{children:E.name})]},E.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),x?jsxs("select",{value:D.priority??L.priority??"",onChange:E=>T({...D,priority:E.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:L.priority==="URGENT"?"#EF4444":L.priority==="HIGH"?"#F59E0B":L.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:L.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:L.labels&&L.labels.length>0?L.labels.map(E=>jsx("span",{className:"card-detail-label-tag",children:E},E)):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"}),x?jsx("input",{type:"date",value:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:L.startDate?new Date(L.startDate).toISOString().split("T")[0]:"",onChange:E=>T({...D,startDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:L.startDate?new Date(L.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsx("input",{type:"date",value:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:L.endDate?new Date(L.endDate).toISOString().split("T")[0]:"",onChange:E=>T({...D,endDate:E.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:L.endDate?new Date(L.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsx("input",{type:"number",min:"0",step:"0.5",value:D.estimatedTime??L.estimatedTime??"",onChange:E=>T({...D,estimatedTime:E.target.value?parseFloat(E.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:L.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:L.dependencies&&L.dependencies.length>0?L.dependencies.map(E=>{let q=typeof E=="string"?E:E.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",q.slice(-4)]},q)}):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:L.createdAt?new Date(L.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:k,onChange:E=>R(E.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:oe,disabled:!k.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(E=>{let q=s.find(ee=>ee.id===E.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:[q&&jsx("div",{className:"card-detail-user-avatar",style:{background:q.color},children:q.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:q?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(E.createdAt).toLocaleString()})]})]}),l&&jsx("button",{onClick:()=>l(E.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:E.content})]},E.id)}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("p",{children:"No comments yet"}),jsx("span",{children:"Be the first to comment"})]})})]}),h==="activity"&&jsx("div",{className:"card-detail-activity",children:d.length>0?jsx("div",{className:"card-detail-activity-list",children:d.map(E=>{let q=s.find(ee=>ee.id===E.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[E.type.includes("CREATED")&&"\u2795",E.type.includes("UPDATED")&&"\u270F\uFE0F",E.type.includes("MOVED")&&"\u27A1\uFE0F",E.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",E.type.includes("COMMENT")&&"\u{1F4AC}",E.type.includes("ASSIGNED")&&"\u{1F464}",E.type.includes("PRIORITY")&&"\u{1F3AF}",E.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",E.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:q?.name||"Unknown"})," ",E.type.replace(/_/g," ").toLowerCase(),E.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:E.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(E.timestamp).toLocaleString()})]})]},E.id)})}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})}),h==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(Er,{cardId:e.id,attachments:i,onUpload:p?E=>p(e.id,E):void 0,onDelete:f,currentUserId:y,maxSizeMB:10,maxFiles:20})}),h==="ai"&&jsxs("div",{className:"card-detail-ai",children:[jsxs("div",{className:"card-detail-ai-actions",children:[jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxs("button",{onClick:Te,disabled:I||!v,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:A,disabled:I||!w,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:Ee,disabled:I||!g,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"]})]}),W.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),W.assignees.map((E,q)=>{let ee=s.find(de=>de.id===E.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[ee&&jsx("div",{className:"card-detail-user-avatar",style:{background:ee.color},children:ee.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:ee?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:E.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(E.confidence*100).toFixed(0),"%"]})]})]},q)})]}),W.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),W.subtasks.map((E,q)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:E.title}),E.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:E.description}),E.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",E.estimatedTime,"h"]})]},q))]}),W.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:[W.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(W.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),m.map(E=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${E.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:E.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:E.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:E.description}),E.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",E.suggestedAction]})]},E.id))]}),!W.assignees&&!W.subtasks&&!W.effort&&m.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 hn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[d,m]=useState({top:0,left:0}),i=useRef(null),c=useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),p=window.innerHeight,f=window.innerWidth,v=4,w=l.left;w+o>f-10&&(w=f-o-10),w<10&&(w=10);let g=p-l.bottom,y=l.top,h;return g>=s+v?h=l.bottom+v:y>=s+v?h=l.top-s-v:g>=y?h=l.bottom+v:h=Math.max(10,l.top-s-v),{top:h,left:w}},[e,o,s]);return useEffect(()=>{t&&m(c());},[t,c]),useEffect(()=>{if(!t)return;let l=f=>{let v=f.target;i.current&&!i.current.contains(v)&&e.current&&!e.current.contains(v)&&a();},p=setTimeout(()=>{document.addEventListener("mousedown",l);},0);return ()=>{clearTimeout(p),document.removeEventListener("mousedown",l);}},[t,a,e]),useEffect(()=>{if(!t)return;let l=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),a());};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),t?jsx(gt,{children:jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${d.top}px`,left:`${d.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 tt={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"#9CA3AF",dependencyHover:"#6B7280",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},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:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#4B5563",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:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},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:"#57534E",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"}};var eh=["LOW","MEDIUM","HIGH","URGENT"],th=["todo","in-progress","review","done"];function Ui({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:d=[],onAddComment:m,onDeleteComment:i,currentUser:c,onAIGenerateDescription:l,onAICreateSubtasks:p,onAIFindSimilar:f,availableColumns:v=[],availableLabels:w=[],availableTags:g=[],onCreateTag:y,onUploadCoverImage:h,unsplashAccessKey:b,theme:x,onSubtasksChange:N,attachments:D=[],onUploadAttachments:T,onDeleteAttachment:k}){let R=Ao(),I=x||R?.themeName||"dark",[C,W]=useState(e),[B,Q]=useState(false),[S,_]=useState(e?.subtasks||[]),[oe,Te]=useState(false),[A,Ee]=useState(""),[L,U]=useState(""),[E,q]=useState("all"),[ee,de]=useState(false),[he,ge]=useState(false),[Le,re]=useState(false),[Qe,Ie]=useState(false),[Ke,ht]=useState(false),[bt,qe]=useState(false),xt=useRef(null),ut=useRef(null),yt=useRef(null),ne=useRef(null),O=useRef(null),J=useRef(null),ce=useRef(null),ke=useRef(null),$e=useRef(null),Je=useRef(null),ot=useRef(null),ze=useRef(null);useEffect(()=>{e&&!C?(W({...e}),_(e.subtasks||[])):e&&C&&e.id!==C.id&&(W({...e}),_(e.subtasks||[]));},[e,C]),useEffect(()=>{let V=ue=>{let Be=ue.target;ne.current&&!ne.current.contains(Be)&&de(false),O.current&&!O.current.contains(Be)&&ge(false),J.current&&!J.current.contains(Be)&&re(false),ce.current&&!ce.current.contains(Be)&&Ie(false);};if(ee||he||Le||Qe)return document.addEventListener("mousedown",V),()=>document.removeEventListener("mousedown",V)},[ee,he,Le,Qe]),useEffect(()=>{if(!t)return;let V=ue=>{let Be=ue.target,Mt=Be.tagName==="INPUT"||Be.tagName==="TEXTAREA"||Be.isContentEditable;if(ue.key==="Escape"){ue.preventDefault(),ee||he||Le||Qe||Ke||bt?(de(false),ge(false),re(false),Ie(false),ht(false),qe(false)):Mt||a();return}if(Mt&&ue.key!=="Escape")return;let it=ue.metaKey||ue.ctrlKey;switch(ue.key.toLowerCase()){case "s":ue.preventDefault(),de(true);break;case "a":ue.preventDefault(),re(true);break;case "p":ue.preventDefault(),ge(true);break;case "l":ue.preventDefault(),Ie(true);break;case "d":it||(ue.preventDefault(),ht(true),setTimeout(()=>ke.current?.focus(),0));break;case "e":it||(ue.preventDefault(),qe(true));break;case "i":ue.preventDefault(),Q(true),setTimeout(()=>ut.current?.focus(),0);break;case "t":ue.preventDefault(),Te(true);break;case "c":ue.preventDefault(),yt.current?.focus();break}};return window.addEventListener("keydown",V),()=>window.removeEventListener("keydown",V)},[t,a,ee,he,Le,Qe,Ke,bt]);let oa=useCallback(V=>{let ue=V.currentTarget.textContent?.trim()||"";if(C&&ue!==C.title){let Be={...C,title:ue};W(Be),r?.(C.id,{title:ue});}},[C,r]),G=useCallback(V=>{V.key==="Enter"&&(V.preventDefault(),V.currentTarget.blur()),V.key==="Escape"&&(V.preventDefault(),V.currentTarget.textContent=C?.title||"",V.currentTarget.blur());},[C]),Y=useCallback(()=>{C&&e&&C.description!==e.description&&r?.(C.id,{description:C.description}),Q(false);},[C,e,r]),be=useCallback(V=>{if(C){let ue={...C,columnId:V};W(ue),r?.(C.id,{columnId:V}),de(false);}},[C,r]),Ye=useCallback(V=>{if(C){let ue={...C,priority:V};W(ue),r?.(C.id,{priority:V}),ge(false);}},[C,r]),we=useCallback(V=>{if(C){let ue=C.assignedUserIds||[],Be=ue.includes(V)?ue.filter(it=>it!==V):[...ue,V],Mt={...C,assignedUserIds:Be};W(Mt),r?.(C.id,{assignedUserIds:Be});}},[C,r]),Pe=useCallback(V=>{if(C){let ue=C.labels||[],Be=ue.includes(V)?ue.filter(it=>it!==V):[...ue,V],Mt={...C,labels:Be};W(Mt),r?.(C.id,{labels:Be});}},[C,r]),X=useCallback(V=>{if(C){let ue={...C,tags:V};W(ue),r?.(C.id,{tags:V});}},[C,r]),Ue=useCallback(V=>{if(C){let ue=V.target.value,Be={...C,endDate:ue};W(Be),r?.(C.id,{endDate:ue}),ht(false);}},[C,r]),H=useCallback(V=>{if(C){let ue={...C,estimatedTime:parseFloat(V)||0};W(ue),r?.(C.id,{estimatedTime:parseFloat(V)||0});}},[C,r]),ie=useCallback(()=>{if(A.trim()&&C){let V={id:`subtask-${Date.now()}`,title:A.trim(),completed:false,createdAt:new Date},ue=[...S,V];_(ue),Ee(""),Te(false),N?.(C.id,ue);}},[A,S,C,N]),Fe=useCallback(V=>{let ue=S.map(Be=>Be.id===V?{...Be,completed:!Be.completed,updatedAt:new Date}:Be);_(ue),C&&N?.(C.id,ue);},[S,C,N]),Ve=useCallback(V=>{let ue=S.filter(Be=>Be.id!==V);_(ue),C&&N?.(C.id,ue);},[S,C,N]),We=useCallback(()=>{L.trim()&&C&&m&&(m(C.id,L.trim()),U(""));},[L,C,m]),Re=useCallback(V=>{(V.metaKey||V.ctrlKey)&&V.key==="Enter"&&(V.preventDefault(),We());},[We]),z=V=>jsx(J0,{remarkPlugins:[Z0],rehypePlugins:[Q0],components:{a:({node:ue,...Be})=>jsx("a",{...Be,target:"_blank",rel:"noopener noreferrer"})},children:V}),K=d.filter(V=>E==="comments"?V.type.includes("COMMENT"):E==="history"?!V.type.includes("COMMENT"):true);if(!t||!e)return null;let ye=C||e,_e=s.filter(V=>ye.assignedUserIds?.includes(V.id)),Xe=S.filter(V=>V.completed).length;return jsx(gt,{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:V=>V.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:xt,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:oa,onKeyDown:G,children:ye.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:ne,children:[jsxs("button",{ref:$e,className:"modal-v2-field",onClick:()=>de(!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("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:ye.columnId||"No status"})]}),jsx(hn,{triggerRef:$e,isOpen:ee,onClose:()=>de(false),width:250,estimatedHeight:200,children:(v.length>0?v:th.map(V=>({id:V,title:V}))).map(V=>jsx("button",{className:`modal-v2-popover-item ${ye.columnId===V.id?"active":""}`,onClick:()=>be(V.id),children:V.title},V.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:J,children:[jsxs("button",{ref:Je,className:"modal-v2-field",onClick:()=>re(!Le),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:_e.length>0?jsx("div",{className:"modal-v2-avatars",children:_e.map(V=>jsx("div",{className:"modal-v2-avatar",style:{background:V.color},title:V.name,children:V.initials},V.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(hn,{triggerRef:Je,isOpen:Le,onClose:()=>re(false),width:280,estimatedHeight:300,children:s.map(V=>jsxs("button",{className:`modal-v2-popover-item ${ye.assignedUserIds?.includes(V.id)?"active":""}`,onClick:()=>we(V.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:V.color},children:V.initials}),V.name,ye.assignedUserIds?.includes(V.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"})})]},V.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:O,children:[jsxs("button",{ref:ot,className:"modal-v2-field",onClick:()=>ge(!he),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"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:ye.priority||"None"})]}),jsxs(hn,{triggerRef:ot,isOpen:he,onClose:()=>ge(false),width:180,estimatedHeight:220,children:[eh.map(V=>jsx("button",{className:`modal-v2-popover-item priority-${V.toLowerCase()} ${ye.priority===V?"active":""}`,onClick:()=>Ye(V),children:V},V)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>Ye(""),children:"None"})]})]}),g.length>0||y?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(_r,{selectedTags:ye.tags||[],availableTags:g,onChange:X,onCreateTag:y,theme:tt[I]||tt.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:ce,children:[jsxs("button",{ref:ze,className:"modal-v2-field",onClick:()=>Ie(!Qe),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:ye.labels&&ye.labels.length>0?jsx("span",{children:ye.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(hn,{triggerRef:ze,isOpen:Qe,onClose:()=>Ie(false),width:220,estimatedHeight:200,children:(w.length>0?w:["Bug","Feature","Enhancement","Documentation"]).map(V=>jsxs("button",{className:`modal-v2-popover-item ${ye.labels?.includes(V)?"active":""}`,onClick:()=>Pe(V),children:[V,ye.labels?.includes(V)&&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"})})]},V))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{ht(!Ke),setTimeout(()=>ke.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:ye.endDate?new Date(ye.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:ke,type:"date",value:typeof ye.endDate=="string"?ye.endDate.split("T")[0]:ye.endDate?(()=>{let V=new Date(ye.endDate),ue=V.getUTCFullYear(),Be=String(V.getUTCMonth()+1).padStart(2,"0"),Mt=String(V.getUTCDate()).padStart(2,"0");return `${ue}-${Be}-${Mt}`})():"",onChange:Ue,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>qe(!bt),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:ye.estimatedTime?`${ye.estimatedTime}h`:"Not set"})]}),bt&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ye.estimatedTime||"",onChange:V=>H(V.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>qe(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"})]}),B?jsx("textarea",{className:"modal-v2-textarea",value:ye.description||"",onChange:V=>{if(C){let ue={...C,description:V.target.value};W(ue);}},onBlur:Y,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>Q(true),children:ye.description?jsx("div",{className:"modal-v2-markdown",children:z(ye.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"}),S.length>0&&jsxs("span",{className:"modal-v2-count",children:[Xe,"/",S.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>Te(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:[S.map(V=>jsxs("div",{className:`modal-v2-subtask ${V.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Fe(V.id),children:V.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:V.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Ve(V.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"})]})})]},V.id)),oe&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:A,onChange:V=>Ee(V.target.value),onKeyDown:V=>{V.key==="Enter"&&ie(),V.key==="Escape"&&(Te(false),Ee(""));},onBlur:ie,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(T||D.length>0)&&jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsx("h2",{children:"Attachments"}),D.length>0&&jsx("span",{className:"modal-v2-count",children:D.length})]}),jsx(Er,{cardId:ye.id,attachments:D,onUpload:T?V=>T(ye.id,V):void 0,onDelete:k,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 ${E==="all"?"active":""}`,onClick:()=>q("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${E==="comments"?"active":""}`,onClick:()=>q("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${E==="history"?"active":""}`,onClick:()=>q("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[c&&jsx("div",{className:"modal-v2-avatar",style:{background:c.color},children:c.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:yt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:L,onChange:V=>U(V.target.value),onKeyDown:Re,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:We,disabled:!L.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[K.map(V=>{let ue=s.find(Mt=>Mt.id===V.userId);if(V.type.includes("COMMENT")){let Mt=n.find(it=>it.id===V.metadata?.commentId);return Mt?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ue&&jsx("div",{className:"modal-v2-avatar",style:{background:ue.color},children:ue.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:ue?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(V.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:Mt.content})]})]},V.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[V.type.includes("CREATED")&&"\u2795",V.type.includes("UPDATED")&&"\u270F\uFE0F",V.type.includes("MOVED")&&"\u27A1\uFE0F",V.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",V.type.includes("ASSIGNED")&&"\u{1F464}",V.type.includes("PRIORITY")&&"\u{1F3AF}",V.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:ue?.name||"Unknown"})," ",V.type.replace(/_/g," ").toLowerCase(),V.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:V.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(V.timestamp).toLocaleString()})]})]},V.id)}),K.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function ch({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 Wi({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((d,m)=>d+m.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(ch,{})}),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:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",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,d)=>n+d.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,d)=>n+d.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:"#3B82F6"},children:e.reduce((n,d)=>n+(d.planned||0),0)})]})]})]})}function vh({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 Gi({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,d=e[e.length-1]?.ideal||0,m=s>0?(s-n)/s*100:0,i=n<=d;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(vh,{})}),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:m>=50?"#10B981":"#F59E0B"},children:[m.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 Eh={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},lm=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Ph({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,d=e+n*Math.cos(-a*(Math.PI/180)),m=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:d,y:m,fill:"white",textAnchor:d>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function dm({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 Vi({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((m,i)=>m+i.value,0),n=e.map(m=>({...m,totalValue:s,color:m.color||Eh[m.name]||lm[e.indexOf(m)%lm.length]})),d=n.map(m=>m.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?Ph:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((m,i)=>jsx(Cell,{fill:d[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(dm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,i)=>{let c=i.payload,l=s>0?(c.value/s*100).toFixed(0):"0";return `${m} (${c.value} - ${l}%)`}})]}):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(dm,{})}),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((m,i)=>jsx(Cell,{fill:d[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:"#3B82F6"},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((m,i)=>i.value>m.value?i:m).name})]})]})]})}var ds=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,d]=useState(false),[m,i]=useState(false),[c,l]=useState(false),[p,f]=useState(false);if(e.length===0)return null;let v=e.map(x=>x.id),w=x=>{r.onBulkUpdate?.(v,{priority:x}),d(false);},g=x=>{r.onBulkMove?.(v,x),i(false),a();},y=x=>{r.onBulkUpdate?.(v,{assignedUserIds:x}),l(false);},h=x=>{let N=new Set;e.forEach(T=>{T.labels?.forEach(k=>N.add(k));});let D=Array.from(new Set([...N,...x]));r.onBulkUpdate?.(v,{labels:D}),f(false);},b=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(v),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:()=>d(!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(x=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>w(x),children:[jsx("span",{className:u("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!m),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),m&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(x=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(x.id),children:x.title},x.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!c),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([x.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>f(!p),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(x=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([x]),children:x},x))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:b,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"})})]})]})})});ds.displayName="BulkOperationsToolbar";function Ih(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,d,m,i;switch(t){case "assignee":let c=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);c.length>0?c.forEach(f=>{let v=a?.find(w=>w.id===f);n=`assignee-${f}`,d=v?.name||`User ${f}`,m=v?.color,i=v?.avatar,r.has(n)||r.set(n,{id:n,title:d,groupValue:f,cardIds:[],color:m,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",d="Unassigned",m="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:d,groupValue:null,cardIds:[],color:m,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];d=p.title,m=p.color,r.has(n)||r.set(n,{id:n,title:d,groupValue:s,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(f=>{n=`label-${f}`,d=f,m="#6b7280",r.has(n)||r.set(n,{id:n,title:d,groupValue:f,cardIds:[],color:m}),r.get(n).cardIds.push(o.id);}):(n="label-none",d="No Labels",m="#6b7280",r.has(n)||r.set(n,{id:n,title:d,groupValue:null,cardIds:[],color:m}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function _i({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),d=useMemo(()=>Ih(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=useCallback(i=>{n(c=>{let l=new Set(c);return l.has(i)?l.delete(i):l.add(i),l});},[]);return t.groupBy==="none"||d.length===0?jsx(Kr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:u("asakaa-swimlane-view",o),children:[d.map(i=>{let c=s.has(i.id),l=e.cards.filter(f=>i.cardIds.includes(f.id)),p={...e,cards:l};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&&m(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":c?"Expand lane":"Collapse lane",children:c?"\u25B6":"\u25BC"})]}),!c&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(Kr,{board:p,callbacks:r,availableUsers:a})})]},i.id)}),d.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 ji=[{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 Ki({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),d=ji.find(i=>i.value===e)||ji[0];useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let m=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:d.icon}),jsx("span",{children:d.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:ji.map(i=>jsxs("button",{onClick:()=>m(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 bn=[{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 Oh(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,d=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&n&&d&&m}function gm(e={}){let{shortcuts:t=bn,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(m=>{o.current=[...o.current,m];},[]),d=useCallback(m=>{o.current=o.current.filter(i=>i.action!==m);},[]);return useEffect(()=>{function m(i){if(!s.current)return;let c=i.target;if(!((c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let l of o.current)if(Oh(i,l)){r&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:n,unregisterShortcut:d,isEnabled:a}}function zh(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Uh(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 Hh(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Uh(e),r=t?zh(t):"";return a?`${a} + ${r}`:r}function Wh(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 qi({shortcuts:e=bn,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function d(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),!o||!t)return null;let n=Wh(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(([d,m])=>m.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"}),d]}),jsx("div",{className:"space-y-3",children:m.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:Hh(i)})]},i.action))})]},d))})}),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 Yi=[{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,8 +122,8 @@ 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 Xi({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 Zi({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 f=async()=>{let w=o?.current||void 0,g=await Wd(e,c,w);Gd(g,c);},v=async w=>{let g=w.target.files?.[0];if(g){try{let y=await jd(g),h=g.name.endsWith(".json")?"json":"csv",b=_d(y,h);d(b),b.success&&r&&r(b,y);}catch(y){d({success:false,errors:[`Failed to read file: ${y instanceof Error?y.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(w=>jsxs("button",{onClick:()=>i(w),className:u("p-4 rounded-lg border-2 transition-all text-center",c===w?"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:[w==="json"&&"\u{1F4C4}",w==="csv"&&"\u{1F4CA}",w==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:w})]},w))})]}),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:f,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:v,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((w,g)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",w]},g))})]})]})]})]})]})}var jh=["URGENT","HIGH","MEDIUM","LOW"],Kh=[{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"}],qh=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Qi({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:f="none",onGroupByChange:v}){let[w,g]=useState(true),y=useCallback(D=>{a({search:D.target.value});},[a]),h=useCallback(D=>{a({dateFilter:D.target.value});},[a]),b=useCallback(D=>{r({by:D.target.value});},[r]),x=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":""} ${w?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>g(!w),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:w?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:w?"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)"]})]}),!w&&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:y,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:D=>{let T=D.target.value;a({priorities:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),jh.map(D=>jsx("option",{value:D,children:D},D))]})}),c.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:D=>{let T=D.target.value;a({assignees:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),c.map(D=>jsx("option",{value:D.id,children:D.name},D.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:D=>{let T=D.target.value;a({labels:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(D=>jsx("option",{value:D,children:D},D))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:b,className:"filter-bar__select filter-bar__select--sm",children:Kh.map(D=>jsx("option",{value:D.value,children:D.label},D.value))}),t.by!=="none"&&jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),v&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:f,onChange:D=>v(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:qh.map(D=>jsx("option",{value:D.value,children:D.label},D.value))})}),N&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function el({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 f=v=>{d.current&&!d.current.contains(v.target)&&m(false);};return i&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f);}},[i]);let p=f=>{f(),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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",f.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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 tl={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:"#3B82F6",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"}},al={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:"#2563EB",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"}},rl={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"}},yo={dark:tl,light:al,neutral:rl},cs="dark";var ms=createContext(void 0),ob="asakaa-theme";function bm({children:e,defaultTheme:t=cs,storageKey:a=ob}){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=yo[r];Object.entries(c.colors).forEach(([m,d])=>{d&&l.style.setProperty(`--theme-${nb(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:yo};return jsx(ms.Provider,{value:n,children:e})}function Wo(){let e=useContext(ms);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function nb(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function ol({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Wo();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(yo).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 ym(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Qe[e]||Qe.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",Qe[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Qe[e].bgSecondary),bgGrid:r("--theme-bg-card",Qe[e].bgGrid),bgWeekend:r("--theme-bg-hover",Qe[e].bgWeekend),border:r("--theme-border-primary",Qe[e].border),borderLight:r("--theme-border-subtle",Qe[e].borderLight),textPrimary:r("--theme-text-primary",Qe[e].textPrimary),textSecondary:r("--theme-text-secondary",Qe[e].textSecondary),textTertiary:r("--theme-text-tertiary",Qe[e].textTertiary),accent:r("--theme-accent-primary",Qe[e].accent),accentHover:r("--theme-accent-hover",Qe[e].accentHover),accentLight:r("--theme-accent-primary",Qe[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Qe[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Qe[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Qe[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Qe[e].dependency),dependencyHover:r("--theme-border-secondary",Qe[e].dependencyHover),criticalPath:r("--theme-error",Qe[e].criticalPath),criticalPathLight:r("--theme-error",Qe[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Qe[e].today):e==="neutral"?r("--theme-text-primary",Qe[e].today):r("--theme-error",Qe[e].today),todayLight:e==="light"?r("--theme-accent-primary",Qe[e].todayLight):e==="neutral"?r("--theme-text-primary",Qe[e].todayLight):r("--theme-error",Qe[e].todayLight),milestone:r("--theme-warning",Qe[e].milestone),milestoneLight:r("--theme-warning",Qe[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Qe[e].statusTodo),statusInProgress:r("--theme-accent-primary",Qe[e].statusInProgress),statusCompleted:r("--theme-success",Qe[e].statusCompleted),hoverBg:r("--theme-bg-hover",Qe[e].hoverBg),focusRing:r("--theme-accent-primary",Qe[e].focusRing)}}var us={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"},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"}},vm={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"},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"}},nl={en:us,es:vm};function xm(e){return nl[e]||nl.en}function sl(e,t){let a=xm(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 Vo=createContext(us);function Zr(){return useContext(Vo)}function Db({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=Zr();if(useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&c(false);};return l&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[l]),!(t||a||r||o||s||n))return null;let v=[{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(g=>g.handler),w=async(g,y)=>{if(y){m(g);try{await y();}catch(h){console.error(`Export ${g} failed:`,h);}finally{m(null),c(false);}}};return jsxs("div",{ref:d,className:"relative",children:[jsxs(motion.button,{onClick:()=>c(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs 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:p.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:l&&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:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:v.map((g,y)=>jsxs(motion.button,{onClick:()=>w(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<v.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 Sb({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-xs 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 Eb({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-xs 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 Pb({theme:e,value:t,onChange:a}){let[r,o]=useState(false),s=useRef(null),n=Zr();useEffect(()=>{let i=m=>{s.current&&!s.current.contains(m.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],c=l.find(i=>i.value===t)?.label||"Normal";return jsxs("div",{ref:s,className:"relative",children:[jsx(motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${c}`,children:jsx(Rows3,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&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 left-0 mt-2 w-36 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:l.map((i,m)=>{let d=t===i.value;return jsxs(motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:m<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:i.label}),d&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function Mb({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),l=useRef(null),c=Zr();useEffect(()=>{if(!s)return;let p=setTimeout(()=>{let f=w=>{l.current&&!l.current.contains(w.target)&&n(false);},v=w=>{w.key==="Escape"&&n(false);};document.addEventListener("mousedown",f),document.addEventListener("keydown",v),l._cleanup=()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(p),l._cleanup&&l._cleanup();}},[s]);let i=[{value:"all",label:c.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:c.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:c.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:c.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],m=t!=="all"||r,d=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:p=>{p.stopPropagation(),n(f=>!f);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:m?d?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${m?d?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:m?"#3B82F6":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:c.toolbar.filter||"Filters"}),m&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsx(AnimatePresence,{children:s&&jsxs(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 left-0 mt-2 w-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:d?"#0F1117":"#FFFFFF",border:`1px solid ${d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:d?"#6B7280":"#9CA3AF"},children:c.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-2",children:i.map(p=>{let f=t===p.value&&!r,v=()=>p.value==="all"?f?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):p.icon;return jsxs(motion.button,{onClick:()=>{a(p.value),o&&o(false),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:f?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsx("span",{className:`${f?p.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:p.label}),f&&jsx(Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]},p.value)})}),jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:d?"rgba(255,255,255,0.1)":"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-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?d?"#3B82F6":"#2563EB":d?"#6B7280":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:c.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]})})]})})]})}function gs({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:f="all",onTaskFilterChange:v,hideCompleted:w=false,onHideCompletedChange:g,onExportPNG:y,onExportPDF:h,onExportExcel:b,onExportCSV:x,onExportJSON:N,onExportMSProject:D}){let T=Zr(),k=y||h||b||x||N||D,O=[{value:"day",label:T.toolbar.day},{value:"week",label:T.toolbar.week},{value:"month",label:T.toolbar.month}],I=[{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"})}];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(Eb,{options:O,value:t,onChange:C=>a(C),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-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",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}}),jsx(Pb,{theme:e,value:l,onChange:c}),v&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Mb,{theme:e,value:f,onChange:v,hideCompleted:w,onHideCompletedChange:g})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[m&&p&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 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||T.toolbar.createTask})]}),(k||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),k&&jsxs(Fragment,{children:[jsx(Db,{theme:e,onExportPNG:y,onExportPDF:h,onExportExcel:b,onExportCSV:x,onExportJSON:N,onExportMSProject:D}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsx(Sb,{options:I,value:s,onChange:C=>n(C),theme:e})]})]})}function fs({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(ht,{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 _o({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,f=window.innerWidth,v=window.innerHeight,w=t,g=a;t+m+p>f&&(w=t-m,w<p&&(w=p)),a+d+p>v&&(g=v-d-p,g<p&&(g=p)),c({x:w,y:g});},[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 Rt={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 Pm({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 f=useRef(false),v=useCallback(b=>{f.current=b;},[]),w=useCallback(b=>{let x=[],N=D=>{for(let T of D)x.push(T),T.subtasks&&T.subtasks.length>0&&T.isExpanded&&N(T.subtasks);};return N(b),x},[]),g=useCallback(()=>{let b=w(e);for(let x of b)if(t.has(x.id))return x;return null},[e,t,w]),y=useCallback((b,x)=>{let N=w(e);if(N.length===0)return;let D=g();if(!D){a(N[0].id,false);return}let T=N.findIndex(I=>I.id===D.id);if(T===-1)return;let k=b==="up"?T-1:T+1;if(k<0||k>=N.length)return;let O=N[k];a(O.id,x);},[e,g,w,a]),h=useCallback(b=>{if(!p)return;let x=b.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||f.current){b.key==="Escape"&&(x.blur(),f.current=false);return}let T=navigator.platform.toUpperCase().indexOf("MAC")>=0?b.metaKey:b.ctrlKey,k=Array.from(t),O=g();if(b.key==="ArrowUp"){b.preventDefault(),y("up",b.shiftKey);return}if(b.key==="ArrowDown"){b.preventDefault(),y("down",b.shiftKey);return}if(O&&(b.key==="ArrowRight"||b.key==="ArrowLeft")){O.subtasks&&O.subtasks.length>0&&(b.preventDefault(),(b.key==="ArrowRight"&&!O.isExpanded||b.key==="ArrowLeft"&&O.isExpanded)&&m(O.id));return}if(b.altKey&&(b.key==="ArrowUp"||b.key==="ArrowDown")){k.length>0&&(b.preventDefault(),n(k,b.key==="ArrowUp"?"up":"down"));return}if(b.key==="Tab"&&!b.shiftKey){k.length>0&&(b.preventDefault(),l(k));return}if(b.key==="Tab"&&b.shiftKey){k.length>0&&(b.preventDefault(),c(k));return}if(b.key==="Enter"&&!b.shiftKey&&!T){O&&(b.preventDefault(),r(O.id,"below"));return}if(b.key==="Enter"&&b.shiftKey&&!T){O&&(b.preventDefault(),r(O.id,"above"));return}if(b.key==="Enter"&&T){O&&(b.preventDefault(),d(O.id));return}if(b.key==="F2"){O&&(b.preventDefault(),i(O.id));return}if(b.key==="Delete"||b.key==="Backspace"&&T){k.length>0&&(b.preventDefault(),o(k));return}if(b.key==="d"&&T&&!b.shiftKey){k.length>0&&(b.preventDefault(),s(k));return}},[p,t,g,y,r,o,s,n,l,c,i,m,d]);return useEffect(()=>{if(p)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[p,h]),{setIsEditing:v}}function Fm(){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 f=new Set(p);return f.has(d)?f.delete(d):f.add(d),f}),r(d);},[]),n=useCallback((d,p)=>{if(!a){o(d);return}let f=p.indexOf(a),v=p.indexOf(d);if(f===-1||v===-1){o(d);return}let w=Math.min(f,v),g=Math.max(f,v),y=p.slice(w,g+1);t(new Set(y)),r(d);},[a,o]),l=useCallback((d,p,f,v)=>{v?n(d,p):f?s(d):o(d);},[o,s,n]),c=useCallback((d,p)=>{p?t(f=>{let v=new Set(f);return v.add(d),v}):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 jo(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let l={...r[n],parentId:o,level:s,position:n};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&a(l.subtasks,l.id,s+1);}};return a(e),t}function Am(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Am(a.subtasks,t);if(r)return r}}return null}function pl(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=pl(a.subtasks,t);if(r)return r}return null}function gl(e,t){if(t.length===0)return e;let a=jo(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],n=(d,p)=>{let f=[];return {tasks:d.filter(w=>{if(p.has(w.id))return f.push(w),false;if(w.subtasks){let g=n(w.subtasks,p);w.subtasks=g.tasks,f.push(...g.removed);}return true}),removed:f}},l=(d,p,f)=>d.map(v=>v.id===p?{...v,subtasks:[...v.subtasks||[],...f],isExpanded:true}:v.subtasks?{...v,subtasks:l(v.subtasks,p,f)}:v),c=new Set(t),{tasks:i,removed:m}=n(e,c);return l(i,s.id,m)}function fl(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=pl(a,r);if(!o)continue;let s=pl(a,o.id),n=(i,m,d)=>{for(let p=0;p<i.length;p++){let f=i[p];if(f.id===m&&f.subtasks){let v=f.subtasks.findIndex(w=>w.id===d);if(v!==-1){let[w]=f.subtasks.splice(v,1);return w}}if(f.subtasks){let v=n(f.subtasks,m,d);if(v)return v}}return null},l=(i,m,d)=>{let p=i.findIndex(f=>f.id===m);if(p!==-1)return i.splice(p+1,0,d),i;for(let f of i)f.subtasks&&l(f.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 a}function hl(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]],true)};return s(r,o,a),r}function bl(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 hs(e,t){let a=[...e];for(let r of t){let o=n=>{let l=n.findIndex(m=>m.id===r);if(l===-1){for(let m of n)if(m.subtasks&&o(m.subtasks))return true;return false}let c=n[l],i={...c,id:`${c.id}-copy-${Date.now()}`,name:`${c.name} (Copy)`,subtasks:c.subtasks?s(c.subtasks):void 0};return n.splice(l+1,0,i),true},s=n=>n.map(l=>({...l,id:`${l.id}-copy-${Date.now()}`,subtasks:l.subtasks?s(l.subtasks):void 0}));o(a);}return a}function Lm(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:"#6366F1"},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 yl(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:yl(r.subtasks,t,a)}:r)}function vl(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:vl(a.subtasks,t)}:a)}function xl(e,t){let a=m=>{for(let d of m){if(d.id===t)return d;if(d.subtasks){let p=a(d.subtasks);if(p)return p}}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={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#3B82F6"},i=m=>m.map(d=>{if(d.id===t){let p=d.subtasks||[];return {...d,subtasks:[...p,c],isExpanded:true}}return d.subtasks?{...d,subtasks:i(d.subtasks)}:d});return {tasks:i(e),newTask:c}}function Im(e,t,a,r){if(t===a)return e;let o=Am(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=>l.filter(c=>c.id!==t).map(c=>c.subtasks&&c.subtasks.length>0?{...c,subtasks:s(c.subtasks)}:c),n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0});}else {let l=c=>c.map(i=>{if(i.id===a){let m=i.subtasks||[],d=r!==void 0?r:m.length,p=[...m];return p.splice(d,0,{...o,parentId:a}),{...i,subtasks:p,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function vs({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:f,onTaskIndent:v,onTaskOutdent:w,onTaskMove:g,onMultiTaskDelete:y,onTaskDuplicate:h,onTaskCreate:b,onTaskRename:x,onCreateSubtask:N,onOpenTaskModal:D,onDeleteRequest:T,onTaskReparent:k}){let O=useContext(Vo),[I,C]=useState(null),[H,R]=useState(null),[Q,S]=useState(""),G=useRef(null),[ne,Ce]=useState(null),[A,Pe]=useState(0),[L,U]=useState(0),[E,q]=useState({isOpen:false,x:0,y:0,type:"header"}),[ee,fe]=useState(null),[ue,pe]=useState(null),[Oe,ae]=useState(null),nt=useRef(0),Fe=5,qe=useRef(false),[ut,St]=useState(null),[je,Ft]=useState(false),[it,pt]=useState(null),[ie,B]=useState(false),Z=useRef(null);useEffect(()=>{function z(j){Z.current&&!Z.current.contains(j.target)&&B(false);}if(ie)return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[ie]),useEffect(()=>{H&&G.current&&(G.current.focus(),G.current.select());},[H]),useEffect(()=>{if(!ne)return;let z=ye=>{let Ve=ye.clientX-A,Ke=L+Ve;p?.(ne,Ke);},j=()=>{Ce(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",z),document.addEventListener("mouseup",j),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",j),document.body.style.cursor="",document.body.style.userSelect="";}},[ne,A,L,p]);let{selectedTaskIds:ce,handleTaskClick:ke,isTaskSelected:$e}=Fm(),{setIsEditing:Xe}=Pm({tasks:e,selectedTaskIds:ce,onTaskSelect:(z,j)=>{let Ve=jo(e).map(Ke=>Ke.id);ke(z,Ve,j||false,false);},onTaskCreate:b||(()=>{}),onTaskDelete:y||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:w||(()=>{}),onTaskRename:z=>{let j=jo(e).find(ye=>ye.id===z);j&&be(j);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:z=>{let j=jo(e).find(ye=>ye.id===z);j&&D&&D(j);},enableKeyboard:true}),at=(z,j=0)=>{let ye=[];for(let Ve of z)ye.push({task:Ve,level:j}),Ve.subtasks&&Ve.subtasks.length>0&&Ve.isExpanded&&ye.push(...at(Ve.subtasks,j+1));return ye},ze=at(e),oa=48,W=Math.max(ze.length*a,600-oa),Y=z=>!z.startDate||!z.endDate?"-":`${Math.ceil((z.endDate.getTime()-z.startDate.getTime())/(1e3*60*60*24))}d`,be=z=>{R(z.id),S(z.name),Xe(true);},Ye=z=>{Q.trim()&&Q!==e.find(j=>j.id===z)?.name&&x?.(z,Q.trim()),R(null),S(""),Xe(false);},Te=()=>{R(null),S(""),Xe(false);},De=(z,j)=>{j.stopPropagation(),N?.(z.id);},X=(z,j)=>{j.preventDefault(),nt.current=j.clientY,fe(z),qe.current=false,Ft(false),St({x:j.clientX,y:j.clientY});},re=z=>{if(!ee||(Math.abs(z.clientY-nt.current)>Fe&&!qe.current&&(qe.current=true,Ft(true)),St({x:z.clientX,y:z.clientY}),!qe.current))return;let ye=document.querySelectorAll("[data-task-row]"),Ve=null,Ke=null;ye.forEach(V=>{let le=V.getBoundingClientRect(),_e=V.getAttribute("data-task-row");if(_e&&_e!==ee&&z.clientY>=le.top&&z.clientY<=le.bottom){Ve=_e;let yt=z.clientY-le.top,lt=le.height;yt<lt*.25?Ke="above":yt>lt*.75?Ke="below":Ke="child";}}),pe(Ve),ae(Ke);},_=()=>{if(qe.current&&ee&&ue&&Oe){if(Oe==="child")k?.(ee,ue);else if(Oe==="above"||Oe==="below"){let z=(Ve,Ke,V=null)=>{for(let le of Ve){if(le.id===Ke)return V;if(le.subtasks){let _e=z(le.subtasks,Ke,le.id);if(_e!==void 0)return _e}}},j=z(e,ue,null),ye=(Ve,Ke)=>{let V=Ve.findIndex(le=>le.id===Ke);return Oe==="below"?V+1:V};if(j===null){let Ve=ye(e,ue);k?.(ee,null,Ve);}else {let Ve=ze.find(Ke=>Ke.task.id===j)?.task;if(Ve?.subtasks){let Ke=ye(Ve.subtasks,ue);k?.(ee,j,Ke);}}}}fe(null),pe(null),ae(null),St(null),qe.current=false,Ft(false);};useEffect(()=>{if(ee)return document.addEventListener("mousemove",re),document.addEventListener("mouseup",_),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",re),document.removeEventListener("mouseup",_),document.body.style.cursor="",document.body.style.userSelect="";}},[ee,ue,Oe]);let Ie=(z,j,ye)=>{switch(z.id){case "name":let Ve=H===j.id,Ke=I===j.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${ye*20}px`},children:[k&&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:Ke?1:.3},onMouseDown:Ne=>X(j.id,Ne),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),j.subtasks&&j.subtasks.length>0?jsx("button",{onClick:Ne=>{Ne.stopPropagation(),c?.(j.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:j.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 flex items-center justify-center",children:jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:j.color||"#3B82F6",opacity:j.parentId?.6:1,borderColor:j.isMilestone?t.accent:"transparent",borderWidth:j.isMilestone?"2px":"0px"},title:j.isMilestone?"Milestone":j.parentId?"Subtask":"Task"})}),Ve?jsx("input",{ref:G,type:"text",value:Q,onChange:Ne=>S(Ne.target.value),onKeyDown:Ne=>{Ne.key==="Enter"?Ye(j.id):Ne.key==="Escape"&&Te();},onBlur:()=>Ye(j.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:Ne=>Ne.stopPropagation()}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1",style:{color:j.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:j.parentId?"13px":"14px",fontWeight:j.isMilestone?600:j.parentId?400:600,letterSpacing:j.parentId?"0":"-0.01em"},title:j.name,children:j.name}),Ke&&!Ve&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:Ne=>Ne.stopPropagation(),children:[jsx("button",{onClick:Ne=>De(j,Ne),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:Ne=>{Ne.stopPropagation(),be(j);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsx(Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let le=z.id==="startDate"?"startDate":"endDate",_e=j[le],yt=it?.taskId===j.id&&it?.field===le,lt=Ne=>Ne?(typeof Ne=="string"?new Date(Ne):Ne).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:Ne=>Ne.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},onClick:Ne=>{if(yt)pt(null);else {let vt=Ne.currentTarget.getBoundingClientRect();pt({taskId:j.id,field:le,month:_e?typeof _e=="string"?new Date(_e):_e:new Date,position:{top:vt.bottom+4,left:vt.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:lt(_e)})]}),yt&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>pt(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:it?.position.top,left:it?.position.left},onClick:Ne=>Ne.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let Ne=new Date,vt=new Date(Ne);vt.setDate(Ne.getDate()+1);let At=new Date(Ne);At.setDate(Ne.getDate()+7);let Ja=new Date(Ne);return Ja.setDate(Ne.getDate()+14),[{label:"Hoy",date:Ne},{label:"Ma\xF1ana",date:vt},{label:"Pr\xF3xima semana",date:At},{label:"2 semanas",date:Ja}].map((zr,Za)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:M=>M.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:M=>M.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(j.id,{[le]:zr.date}),pt(null);},children:zr.label},Za))})(),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:Ne=>Ne.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Ne=>Ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(j.id,{[le]:void 0}),pt(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:()=>pt(Ne=>Ne?{...Ne,month:new Date(Ne.month.getFullYear(),Ne.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:it?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>pt(Ne=>Ne?{...Ne,month:new Date(Ne.month.getFullYear(),Ne.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((Ne,vt)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:Ne},vt))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Ne=it?.month||new Date,vt=Ne.getFullYear(),At=Ne.getMonth(),Ja=new Date(vt,At,1).getDay(),Et=new Date(vt,At+1,0).getDate(),zr=new Date,Za=[];for(let oe=Ja-1;oe>=0;oe--)Za.push({day:new Date(vt,At,-oe).getDate(),date:new Date(vt,At-1,new Date(vt,At,-oe).getDate()),isCurrentMonth:false});for(let oe=1;oe<=Et;oe++)Za.push({day:oe,date:new Date(vt,At,oe),isCurrentMonth:true});let M=42-Za.length;for(let oe=1;oe<=M;oe++)Za.push({day:oe,date:new Date(vt,At+1,oe),isCurrentMonth:false});return Za.map((oe,Re)=>{let Je=oe.date.toDateString()===zr.toDateString(),ha=(_e?typeof _e=="string"?new Date(_e):_e:null)?.toDateString()===oe.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:oe.isCurrentMonth?ha?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:ha?"#3B82F6":"transparent",boxShadow:Je&&!ha?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{f?.(j.id,{[le]:oe.date}),pt(null);},children:oe.day},Re)})})()})]})]})]}),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:Y(j)})});case "assignees":let sr=r.filter(Ne=>j.assignees?.some(vt=>vt.name===Ne.name||vt.initials===Ne.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:Ne=>Ne.stopPropagation(),children:jsx(uo,{assignedUsers:sr,availableUsers:r,onChange:Ne=>{let vt=Ne.map(At=>({id:At.id,name:At.name,initials:At.initials,color:At.color}));f?.(j.id,{assignees:vt.length>0?vt:void 0});}})});case "status":return jsx("div",{className:"flex items-center justify-center w-full",onClick:Ne=>Ne.stopPropagation(),children:jsx(mc,{status:j.status||"todo",onChange:Ne=>{f?.(j.id,{status:Ne,progress:Ne==="completed"?100:j.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",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:`${j.progress}%`,backgroundColor:j.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:[j.progress,"%"]})]});case "priority":let xr={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},ir={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Xa=xr[j.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:Ne=>Ne.stopPropagation(),children:jsx(co,{priority:Xa,onChange:Ne=>{Ne&&f?.(j.id,{priority:ir[Ne]||"medium"});}})});default:return null}},Ae=z=>[{id:"hide",label:"Hide Column",icon:Rt.Hide,onClick:()=>d(z),disabled:z==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Rt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Rt.SortDesc,onClick:()=>{}}],Ge=z=>z.subtasks&&z.subtasks.length>0?[{id:"addSubtask",label:O?.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{N?.(z.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:O?.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{T?T(z.id,z.name):y?.([z.id]);}}]:[{id:"edit",label:O?.contextMenu?.editTask||"Edit Task",icon:Rt.Pencil,onClick:()=>{n?.(z);}},{id:"addSubtask",label:O?.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{N?.(z.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:O?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Rt.MarkIncomplete,onClick:()=>{f?.(z.id,{status:"todo",progress:0});},disabled:z.status==="todo"},{id:"setInProgress",label:O?.contextMenu?.setInProgress||"Set In Progress",icon:Rt.SetInProgress,onClick:()=>{f?.(z.id,{status:"in-progress"});},disabled:z.status==="in-progress"},{id:"markComplete",label:O?.contextMenu?.markComplete||"Mark Complete",icon:Rt.MarkComplete,onClick:()=>{f?.(z.id,{status:"completed",progress:100});},disabled:z.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:O?.contextMenu?.duplicateTask||"Duplicate Task",icon:Rt.Duplicate,onClick:()=>{h?.([z.id]);}},{id:"split",label:O?.contextMenu?.splitTask||"Split Task",icon:Rt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:O?.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{T?T(z.id,z.name):y?.([z.id]);}}],He=m.filter(z=>z.visible),Be=He.reduce((z,j)=>z+j.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Be},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${oa}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:He.map((z,j)=>{let ye=j===He.length-1,Ve=z.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ve?"":"justify-center"}`,style:{width:`${z.width}px`,minWidth:`${z.minWidth??(Ve?200:60)}px`,maxWidth:`${z.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ye?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Ke=>{Ke.preventDefault(),q({isOpen:true,x:Ke.clientX,y:Ke.clientY,type:"header",columnId:z.id});},onMouseEnter:Ke=>{Ke.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Ke=>{Ke.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:z.label,children:z.label}),z.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:ne===z.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Ke=>{Ke.preventDefault(),Ke.stopPropagation(),Ce(z.id),Pe(Ke.clientX),U(z.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},z.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsx(fs,{columns:m,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>B(!ie),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"})}),ie&&jsxs("div",{ref:Z,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:z=>z.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:()=>B(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:W},children:ze.map(({task:z,level:j},ye)=>{let Ve=$e(z.id),Ke=ue===z.id,V=Ke&&Oe==="above",le=Ke&&Oe==="below",_e=Ke&&Oe==="child",yt={};return _e&&(yt.backgroundColor=`${t.accent}15`,yt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":z.id,className:`flex items-center cursor-pointer group ${ee===z.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ve?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ve?t.accentLight:_e?`${t.accent}15`:ye%2===0?t.bgPrimary:t.bgGrid,...yt},onMouseEnter:()=>C(z.id),onMouseLeave:()=>C(null),onClick:lt=>{let xr=jo(e).map(Ne=>Ne.id),Xa=navigator.platform.toUpperCase().indexOf("MAC")>=0?lt.metaKey:lt.ctrlKey;ke(z.id,xr,Xa,lt.shiftKey),s?.(z);},onDoubleClick:lt=>{lt.stopPropagation(),n?.(z);},onContextMenu:lt=>{lt.preventDefault(),q({isOpen:true,x:lt.clientX,y:lt.clientY,type:"task",task:z}),l?.(z,lt);},whileHover:{backgroundColor:Ve?t.accentLight:t.hoverBg},children:[V&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),le&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),He.map((lt,sr)=>{let xr=sr===He.length-1,ir=lt.id==="name";return jsx("div",{className:`px-4 flex items-center ${ir?"justify-start":"justify-center"}`,style:{width:`${lt.width}px`,minWidth:`${lt.minWidth??(ir?200:60)}px`,maxWidth:`${lt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:xr?"none":`1px solid ${I===z.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ie(lt,z,ir?j:0)},`${z.id}-${lt.id}`)})]},z.id)})}),jsx(_o,{isOpen:E.isOpen,x:E.x,y:E.y,items:E.type==="header"&&E.columnId?Ae(E.columnId):E.type==="task"&&E.task?Ge(E.task):[],onClose:()=>q({...E,isOpen:false}),theme:t}),je&&ut&&ee&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:ut.x+12,top:ut.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let z=ze.find(j=>j.task.id===ee)?.task;return z?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:z.name})}):null})()}),document.body)]})}function zm(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,l]=useState(e),[c,i]=useState(t),[m,d]=useState(null),[p,f]=useState(null),[v,w]=useState(null),[g,y]=useState(null),[h,b]=useState(0),[x,N]=useState(0),[D,T]=useState(null),[k,O]=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:f,activeZone:v,setActiveZone:w,draggedSegmentIndex:g,setDraggedSegmentIndex:y,draggedSegmentStartX:h,setDraggedSegmentStartX:b,segmentDragOffsetX:x,setSegmentDragOffsetX:N,hoveredSegmentIndex:D,setHoveredSegmentIndex:T,isHovered:k,setIsHovered:O,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(Q,S)=>{r("none"),d(null),f(null),l(Q),i(S),N(0),y(null),b(0);}}}function ks({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:f=[],onDragMove:v,onHoverChange:w}){let g=zm(t,r),y=useRef(null),h=useRef(null),b=useRef(null),{dragMode:x,setDragMode:N,dragOffset:D,setDragOffset:T,ghostX:k,setGhostX:O,ghostWidth:I,setGhostWidth:C,connectionLine:H,setConnectionLine:R,hoveredTaskId:Q,setHoveredTaskId:S,activeZone:G,setActiveZone:ne,draggedSegmentIndex:Ce,setDraggedSegmentIndex:A,draggedSegmentStartX:Pe,setDraggedSegmentStartX:L,segmentDragOffsetX:U,setSegmentDragOffsetX:E,hoveredSegmentIndex:q,setHoveredSegmentIndex:ee,isHovered:fe,setIsHovered:ue,isDragging:pe,isResizing:Oe,isConnecting:ae,resetDragState:nt}=g,Fe=24,qe=8,ut=e.endDate&&e.endDate<new Date&&e.progress<100,St=e.isCriticalPath,je=o.name==="neutral"||o.today==="#1C1917",Ft=e.status==="completed"||e.progress===100,it={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},ie=e.isCriticalPath||ut?"#DC2626":e.color?e.color:e.priority&&it[e.priority]?it[e.priority]:o.taskBarPrimary,Z=(_=>_>=80?20:_>=60?15:_>=50?12:10)(r),ce=r<50,ke=r<40;useEffect(()=>{if(w)if(fe&&!pe&&!e.segments){let _=a<100;w({task:e,x:t,y:a,width:r,height:Fe,showBelow:_});}else w(null);},[fe,pe,e,t,a,r,Fe,w]);let $e=_=>_.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Xe=()=>{let _=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${_} day${_!==1?"s":""}`},at=_=>Math.round(_/s)*s,ze=_=>{let Ie=Math.round(_/s),Ae=new Date(n);return Ae.setDate(Ae.getDate()+Ie),Ae},oa=(_,Ie)=>{for(let Ae of f){if(Ae.id===e.id)continue;let Ge=5;if(_>=Ae.x-Ge&&_<=Ae.x+Ae.width+Ge&&Ie>=Ae.y-Ge&&Ie<=Ae.y+Ae.height+Ge)return Ae.id}return null},W=useCallback((_,Ie,Ae)=>{_.preventDefault(),_.stopPropagation();let Ge=y.current?.ownerSVGElement;if(!Ge)return;let He=Ge.createSVGPoint();He.x=_.clientX,He.y=_.clientY;let Be=He.matrixTransform(Ge.getScreenCTM()?.inverse()),z=Ae!==void 0?Ae:t,j=Ie;if(!j){let ye=Be.x-z;_.shiftKey?(j="connect",R({x:t+r,y:a+Fe/2})):_.ctrlKey||_.metaKey?j="move":_.altKey?j=ye<r/2?"resize-start":"resize-end":ke?ye<r/2?j="move":j="resize-end":ce?ye<=Z/2?j="resize-start":ye>=r-Z/2?j="resize-end":j="move":ye<=Z?j="resize-start":ye>=r-Z?j="resize-end":j="move";}N(j),ue(false),ne(null),j==="move"?T(Be.x-z):j==="connect"?R({x:t+r,y:a+Fe/2}):T(0),O(z),C(r);},[t,r,a,Fe]),Y=useCallback(_=>{let Ie=y.current?.ownerSVGElement;if(!Ie)return;let Ae=Ie.closest(".gantt-timeline-scroll");if(!Ae)return;let Ge=Ae.getBoundingClientRect(),He=60,Be=15,z=0;if(_.clientX<Ge.left+He){let j=Ge.left+He-_.clientX;z=-Math.min(Be,j/2);}else if(_.clientX>Ge.right-He){let j=_.clientX-(Ge.right-He);z=Math.min(Be,j/2);}return z!==0&&(Ae.scrollLeft+=z),z!==0},[]),be=useCallback(_=>{if(x==="none")return;b.current=_;let Ie=y.current?.ownerSVGElement;if(!Ie)return;if(x==="move"||x==="resize-start"||x==="resize-end"){let He=Y(_);He&&!h.current?h.current=window.setInterval(()=>{b.current&&(Y(b.current),be(b.current));},16):!He&&h.current&&(window.clearInterval(h.current),h.current=null);}let Ae=Ie.createSVGPoint();Ae.x=_.clientX,Ae.y=_.clientY;let Ge=Ae.matrixTransform(Ie.getScreenCTM()?.inverse());if(x==="connect"){R({x:Ge.x,y:Ge.y});let He=oa(Ge.x,Ge.y);S(He);}else if(x==="move"){let He=Ge.x-D,Be=at(He);O(Be),C(r);let z=Math.round((Be-t)/s);if(v?.(e.id,z,true),e.segments&&e.segments.length>0&&Ce!==null){let j=Be-Pe;E(j);}}else if(x==="resize-start"){let He=Ge.x,Be=at(He),z=t+r-Be;z>=s&&(O(Be),C(z));}else if(x==="resize-end"){let He=Ge.x,z=at(He)-t;z>=s&&C(z);}},[x,t,r,s,D,e,at,Ce,Pe,oa,S,R,O,C,E,v,Y]),Ye=useCallback(()=>{if(h.current&&(window.clearInterval(h.current),h.current=null),b.current=null,x!=="none"){if(x==="connect")Q&&p&&p(e,Q),R(null),S(null);else {let _=e.endDate.getTime()-e.startDate.getTime(),Ie,Ae,Ge=true;if(x==="move"){if(Ie=ze(k),Ae=new Date(Ie.getTime()+_),e.segments&&e.segments.length>0&&Ce!==null){let He=Math.round(U/s),Be=e.segments.map((Ve,Ke)=>{if(Ke===Ce){let V=new Date(Ve.startDate),le=new Date(Ve.endDate);return V.setDate(V.getDate()+He),le.setDate(le.getDate()+He),{startDate:V,endDate:le}}return Ve}),z=Be.flatMap(Ve=>[Ve.startDate,Ve.endDate]),j=new Date(Math.min(...z.map(Ve=>Ve.getTime()))),ye=new Date(Math.max(...z.map(Ve=>Ve.getTime())));d?.({...e,segments:Be},j,ye),nt(t,r);return}}else x==="resize-start"?(Ie=ze(k),Ae=e.endDate,Ie>Ae&&(console.warn("Invalid date range: start date must be before or equal to end date"),Ge=false)):x==="resize-end"?(Ie=e.startDate,Ae=ze(k+I),Ae<Ie&&(console.warn("Invalid date range: end date must be after or equal to start date"),Ge=false)):Ge=false;Ge&&Ie&&Ae&&(Ae.getTime()<Ie.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,Ie,Ae));}v?.(e.id,0,false),nt(t,r);}},[x,k,I,e,d,Q,p,t,r,s,ze,U,Ce,nt,v]);useEffect(()=>{if(x==="none")return;let _=Ae=>{be(Ae);},Ie=()=>{Ye();};return window.addEventListener("mousemove",_),window.addEventListener("mouseup",Ie),()=>{window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",Ie),h.current&&(window.clearInterval(h.current),h.current=null);}},[x,be,Ye]);let Te=pe&&!ae?k:t,De=pe&&!ae?I:r,X=l.taskClass(e);return jsxs("g",{ref:y,"data-task-bar":"true",onClick:()=>!pe&&c?.(e),onDoubleClick:_=>{pe||(_.stopPropagation(),i?.(e));},onContextMenu:_=>{_.preventDefault(),m?.(e,_);},onMouseEnter:()=>!pe&&ue(true),onMouseLeave:()=>{pe||(ue(false),ne(null));},children:[jsx("rect",{x:t,y:a,width:r+24,height:Fe,fill:"transparent",style:{pointerEvents:"all"}}),fe&&!pe&&!ce&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Z,height:Fe,fill:G==="resize-start"?o.accent:"transparent",opacity:G==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-start"),onMouseDown:_=>W(_,"resize-start")}),jsx("rect",{x:t+Z,y:a,width:r-Z*2,height:Fe,fill:G==="move"?o.accent:"transparent",opacity:G==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ne("move"),onMouseDown:_=>W(_,"move")}),jsx("rect",{x:t+r-Z,y:a,width:Z,height:Fe,fill:G==="resize-end"?o.accent:"transparent",opacity:G==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-end"),onMouseDown:_=>W(_,"resize-end")})]}),fe&&!pe&&ke&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:Fe,fill:G==="move"?o.accent:"transparent",opacity:G==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ne("move"),onMouseDown:_=>W(_,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:Fe,fill:G==="resize-end"?o.accent:"transparent",opacity:G==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ne("resize-end"),onMouseDown:_=>W(_,"resize-end")}),fe&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Fe-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),pe&&!ae&&!e.segments&&jsx(motion.rect,{x:k,y:a,width:I,height:Fe,rx:qe,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsx(motion.rect,{x:Te,y:a,width:De,height:Fe,rx:qe,fill:ie,"data-task-class":X,initial:{opacity:0,scale:.95},animate:{opacity:pe&&!ae?.15:e.parentId?.6:fe?.9:.8,scale:fe&&!pe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:_=>W(_),style:{cursor:pe?ae?"crosshair":Oe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsx("rect",{x:Te,y:a,width:De*(e.progress/100),height:Fe,rx:qe,fill:ie,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((_,Ie)=>{let Ae=(_.startDate.getTime()-n.getTime())/864e5*s,He=(_.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Ae+s,Be=pe&&x==="move"&&Ce===Ie,z=q===Ie,j=Be?Ae+U:Ae;return jsxs("g",{onMouseEnter:()=>!pe&&ee(Ie),onMouseLeave:()=>!pe&&ee(null),children:[jsx(motion.rect,{x:j,y:a,width:He,height:Fe,rx:qe,fill:ie,initial:{opacity:0,scale:.95},animate:{opacity:Be||e.parentId?.6:z?.9:.8,scale:z&&!pe?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ye=>{ye.stopPropagation(),A(Ie),L(Ae),W(ye,void 0,Ae);},style:{cursor:pe?ae?"crosshair":Oe?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsx("rect",{x:j,y:a,width:He*(e.progress/100),height:Fe,rx:qe,fill:ie,opacity:1,style:{pointerEvents:"none"}})]},`segment-${Ie}`)}),je&&(ut||St)&&!e.segments&&jsxs(Fragment,{children:[St&&!ut&&jsx("rect",{x:Te,y:a,width:De,height:Fe,rx:qe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ut&&jsx("rect",{x:Te,y:a,width:De,height:Fe,rx:qe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),De>60&&!e.segments&&(()=>{let _=l.taskLabel(e),Ie=typeof _=="string"?_:e.name,Ae=Ie.length>Math.floor(De/8)?`${Ie.substring(0,Math.floor(De/8))}...`:Ie;return jsx("text",{x:Te+12,y:a+Fe/2,dominantBaseline:"middle",fill:Ft?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Ft?"line-through":"none"},children:Ae})})(),De>100&&e.progress>0&&e.progress<100&&!pe&&!e.segments&&jsxs("text",{x:Te+De-12,y:a+Fe/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,"%"]}),e.status&&De>80&&!pe&&!e.segments&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Te+De-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Te+De-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(fe||Oe)&&!ae&&!e.segments&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Te-2,y:a,width:16,height:Fe,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ne("resize-start"),onMouseLeave:()=>ne(null),onMouseDown:_=>{_.stopPropagation(),W(_,"resize-start");}}),jsx(motion.rect,{x:Te+4,y:a+8,width:3,height:Fe-16,rx:1.5,fill:G==="resize-start"||x==="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:Te+De-14,y:a,width:16,height:Fe,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ne("resize-end"),onMouseLeave:()=>ne(null),onMouseDown:_=>{_.stopPropagation(),W(_,"resize-end");}}),jsx(motion.rect,{x:Te+De-7,y:a+8,width:3,height:Fe-16,rx:1.5,fill:G==="resize-end"||x==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:fe&&!pe&&!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+Fe/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ne("connect"),onMouseLeave:()=>ne(null),onMouseDown:_=>{_.stopPropagation(),W(_,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+Fe/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:G==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),ae&&H&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+Fe/2,x2:H.x,y2:H.y,stroke:Q?o.statusCompleted:o.accent,strokeWidth:Q?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:Q?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:H.x,cy:H.y,r:Q?8:6,fill:Q?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),Q&&jsx(motion.text,{x:H.x+15,y:H.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:H.x+10},animate:{opacity:1,x:H.x+15},transition:{duration:.2},children:"Connect"})]}),(fe||pe)&&!ae&&!e.segments&&jsx(motion.rect,{x:Te-2,y:a-2,width:De+4,height:Fe+4,rx:qe+2,fill:"none",stroke:pe?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:pe?.6:.4,initial:{opacity:0},animate:{opacity:pe?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Oe&&jsxs(Fragment,{children:[jsx("line",{x1:k,y1:0,x2:k,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:k+I,y1:0,x2:k+I,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:fe&&!pe&&!e.segments&&!w&&(()=>{let Ae=a<100,Ge=Ae?a+Fe+13:a-82-13,He=Ae?`M ${Te+De/2-6} ${a+Fe+3} L ${Te+De/2} ${a+Fe+13} L ${Te+De/2+6} ${a+Fe+3}`:`M ${Te+De/2-6} ${a-13} L ${Te+De/2} ${a-3} L ${Te+De/2+6} ${a-13}`,Be=Ge+22,z=Ge+40,j=Ge+55,ye=Ge+70,Ve=Ae?Ge+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:Ae?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Ae?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:He,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Te+De/2-120,y:Ge,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:Te+De/2,y:Be,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:Te+De/2-110,y:z,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Te+De/2-70,y:z,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:$e(e.startDate)}),jsx("text",{x:Te+De/2-110,y:j,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Te+De/2-70,y:j,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:$e(e.endDate)}),jsx("text",{x:Te+De/2+10,y:z,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Te+De/2+65,y:z,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Xe()}),jsx("text",{x:Te+De/2+10,y:j,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Te+De/2+65,y:j,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:Te+De/2-110,y:ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Te+De/2-50,y:ye,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Ke=>Ke.name).join(", ").substring(0,30),e.assignees.map(Ke=>Ke.name).join(", ").length>30?"...":""]})]}),!Ae&&jsx("text",{x:Te+De/2,y:Ve,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:ke?"Left: move \u2022 Right: resize":ce?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function Wm({tooltipData:e,theme:t,locale:a="en"}){if(!e)return null;let {task:r,x:o,y:s,width:n,height:l,showBelow:c}=e,i=r.effortMinutes!=null||r.timeLoggedMinutes!=null||r.soldEffortMinutes!=null,m=i?130:82,d=13,p=c?s+l+d:s-m-d,f=c?`M ${o+n/2-6} ${s+l+3} L ${o+n/2} ${s+l+13} L ${o+n/2+6} ${s+l+3}`:`M ${o+n/2-6} ${s-13} L ${o+n/2} ${s-3} L ${o+n/2+6} ${s-13}`,v=p+22,w=p+40,g=p+55,y=p+70,h=p+90,b=p+105,x=p+120,N=C=>C.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),D=()=>{if(!r.startDate||!r.endDate)return "N/A";let C=Math.ceil((r.endDate.getTime()-r.startDate.getTime())/(1e3*60*60*24));return `${C} day${C!==1?"s":""}`},T=C=>{if(C==null||C===0)return "N/A";let H=Math.floor(C/60),R=C%60;return H===0?`${R}m`:R===0?`${H}h`:`${H}h ${R}m`},k={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:"};return jsx(AnimatePresence,{children:jsxs(motion.g,{initial:{opacity:0,y:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:f,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("rect",{x:o+n/2-120,y:p,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:o+n/2,y:v,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:r.name.length>28?`${r.name.substring(0,28)}...`:r.name}),jsx("text",{x:o+n/2-110,y:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.start}),jsx("text",{x:o+n/2-70,y:w,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.startDate?N(r.startDate):"N/A"}),jsx("text",{x:o+n/2-110,y:g,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.end}),jsx("text",{x:o+n/2-70,y:g,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.endDate?N(r.endDate):"N/A"}),jsx("text",{x:o+n/2+10,y:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.duration}),jsx("text",{x:o+n/2+65,y:w,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:D()}),jsx("text",{x:o+n/2+10,y:g,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.progress}),jsxs("text",{x:o+n/2+65,y:g,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.progress,"%"]}),r.assignees&&r.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.assignees}),jsxs("text",{x:o+n/2-50,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.assignees.map(C=>C.name).join(", ").substring(0,30),r.assignees.map(C=>C.name).join(", ").length>30?"...":""]})]}),i&&jsxs(Fragment,{children:[r.effortMinutes!=null&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.estimated}),jsx("text",{x:o+n/2-50,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:T(r.effortMinutes)})]}),r.timeLoggedMinutes!=null&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.logged}),jsx("text",{x:o+n/2-50,y:b,fill:t.accent,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",children:T(r.timeLoggedMinutes)})]}),r.soldEffortMinutes!=null&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y:x,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.quoted}),jsx("text",{x:o+n/2-50,y:x,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:T(r.soldEffortMinutes)})]})]})]})})}function Cs({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false}){let[c,i]=useState(false),[m,d]=useState(null),p=r-t,f=p>0,v=Math.abs(p)<5,w=20,g=!v&&a<=e,y,h,b=a-e,x=e+b/2;if(h=x,n==="squared")if(v)y=`M ${e} ${t} L ${a} ${r}`;else if(g){let ne=e+15,Ce=a-w,A=f?t+20:t-20;h=Ce,y=`M ${e} ${t} L ${ne} ${t} L ${ne} ${A} L ${Ce} ${A} L ${Ce} ${r} L ${a} ${r}`;}else h=a-w,y=`M ${e} ${t} L ${h} ${t} L ${h} ${r} L ${a} ${r}`;else y=`M ${e} ${t} C ${x} ${t}, ${x} ${r}, ${a} ${r}`;let N=5,D=`M ${a} ${r} L ${a-N} ${r-N*.5} M ${a} ${r} L ${a-N} ${r+N*.5}`,T=o.dependency,k=o.dependencyHover||T,O="#f87171",I="rgba(248, 113, 113, 0.15)",C=h,H=(t+r)/2;if(m)if(v)C=Math.max(e+10,Math.min(a-10,m.x)),H=t;else if(g){let G=e+15,ne=a-w,Ce=f?t+20:t-20,A=[[e,t,G,t],[G,t,G,Ce],[G,Ce,ne,Ce],[ne,Ce,ne,r],[ne,r,a,r]],Pe=1/0,L={x:C,y:H};for(let U of A){let E=R(m.x,m.y,U[0],U[1],U[2],U[3]),q=Math.hypot(m.x-E.x,m.y-E.y);q<Pe&&(Pe=q,L=E);}C=L.x,H=L.y;}else {let G=[[e,t,h,t],[h,t,h,r],[h,r,a,r]],ne=1/0,Ce={x:C,y:H};for(let A of G){let Pe=R(m.x,m.y,A[0],A[1],A[2],A[3]),L=Math.hypot(m.x-Pe.x,m.y-Pe.y);L<ne&&(ne=L,Ce=Pe);}C=Ce.x,H=Ce.y;}function R(G,ne,Ce,A,Pe,L){let U=Pe-Ce,E=L-A,q=U*U+E*E;if(q===0)return {x:Ce,y:A};let ee=((G-Ce)*U+(ne-A)*E)/q;return ee=Math.max(0,Math.min(1,ee)),{x:Ce+ee*U,y:A+ee*E}}let Q=G=>{let ne=G.currentTarget.ownerSVGElement;if(!ne)return;let Ce=ne.getBoundingClientRect();d({x:G.clientX-Ce.left,y:G.clientY-Ce.top});},S=()=>{i(false),d(null);};return l?jsxs("g",{"data-dependency-line":"true",onMouseLeave:S,onMouseMove:Q,children:[jsx("path",{d:y,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:y,fill:"none",stroke:k,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:y,fill:"none",stroke:k,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:D,fill:"none",stroke:k,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:k,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxs(motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:G=>{G.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:C,cy:H,r:9,fill:I,stroke:O,strokeWidth:1.5}),jsx("line",{x1:C-3,y1:H-3,x2:C+3,y2:H+3,stroke:O,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:C+3,y1:H-3,x2:C-3,y2:H+3,stroke:O,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:S,onMouseMove:Q,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:y,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:y,fill:"none",stroke:c?k:T,strokeWidth:c?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsx(motion.path,{d:D,fill:"none",stroke:c?k:T,strokeWidth:c?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsx(motion.circle,{cx:a,cy:r,r:c?4:3,fill:c?k:T,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),c&&s&&jsxs(motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:G=>{G.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:C,cy:H,r:9,fill:I,stroke:O,strokeWidth:1.5}),jsx("line",{x1:C-3,y1:H-3,x2:C+3,y2:H+3,stroke:O,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:C+3,y1:H-3,x2:C-3,y2:H+3,stroke:O,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Ns({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 ve={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.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ve.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ve.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ve.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=ve.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(`
|
|
126
|
-
`)},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=
|
|
125
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Xi({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),o(false);},m=e.reduce((i,c)=>{let l=c.category||"Other";return i[l]||(i[l]=[]),i[l].push(c),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(m).map(([i,c])=>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:c.map(l=>jsxs("button",{onClick:()=>d(l),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:l.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.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 Zi({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,d]=useState("export"),[m,i]=useState("json"),[c,l]=useState(null),p=useRef(null);if(!t)return null;let f=async()=>{let w=o?.current||void 0,g=await Wd(e,m,w);Gd(g,m);},v=async w=>{let g=w.target.files?.[0];if(g){try{let y=await jd(g),h=g.name.endsWith(".json")?"json":"csv",b=_d(y,h);l(b),b.success&&r&&r(b,y);}catch(y){l({success:false,errors:[`Failed to read file: ${y instanceof Error?y.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:()=>d("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:()=>d("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(w=>jsxs("button",{onClick:()=>i(w),className:u("p-4 rounded-lg border-2 transition-all text-center",m===w?"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:[w==="json"&&"\u{1F4C4}",w==="csv"&&"\u{1F4CA}",w==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:w})]},w))})]}),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:f,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:v,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"})]})]}),c&&jsxs("div",{className:u("p-4 rounded-lg",c.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",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:c.errors.map((w,g)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",w]},g))})]})]})]})]})]})}var Kh=["URGENT","HIGH","MEDIUM","LOW"],qh=[{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"}],Yh=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Qi({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:d,availableUsers:m=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:l=true,compact:p=false,groupBy:f="none",onGroupByChange:v}){let[w,g]=useState(true),y=useCallback(D=>{a({search:D.target.value});},[a]),h=useCallback(D=>{a({dateFilter:D.target.value});},[a]),b=useCallback(D=>{r({by:D.target.value});},[r]),x=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":""} ${w?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>g(!w),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:w?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:w?"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)"]})]}),!w&&jsxs("div",{className:"filter-bar__content",children:[l&&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"}),d&&jsx("button",{onClick:d,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:y,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:D=>{let T=D.target.value;a({priorities:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Kh.map(D=>jsx("option",{value:D,children:D},D))]})}),m.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:D=>{let T=D.target.value;a({assignees:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),m.map(D=>jsx("option",{value:D.id,children:D.name},D.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:D=>{let T=D.target.value;a({labels:T==="all"?[]:[T]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(D=>jsx("option",{value:D,children:D},D))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:b,className:"filter-bar__select filter-bar__select--sm",children:qh.map(D=>jsx("option",{value:D.value,children:D.label},D.value))}),t.by!=="none"&&jsx("button",{onClick:x,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),v&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:f,onChange:D=>v(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Yh.map(D=>jsx("option",{value:D.value,children:D.label},D.value))})}),N&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function el({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:d,onExportGanttCSV:m}){let[i,c]=useState(false),l=useRef(null);useEffect(()=>{let f=v=>{l.current&&!l.current.contains(v.target)&&c(false);};return i&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f);}},[i]);let p=f=>{f(),c(false);};return jsxs("div",{className:u("relative",r),ref:l,children:[jsxs("button",{onClick:()=>c(!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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",f.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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 d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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(()=>m?.()),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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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 tl={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:"#3B82F6",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"}},al={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:"#2563EB",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"}},rl={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"}},yo={dark:tl,light:al,neutral:rl},ms="dark";var us=createContext(void 0),nb="asakaa-theme";function bm({children:e,defaultTheme:t=ms,storageKey:a=nb}){let[r,o]=useState(()=>{if(typeof window<"u"){let d=localStorage.getItem(a);if(d&&(d==="dark"||d==="light"||d==="neutral"))return d}return t}),s=useCallback(d=>{o(d),typeof window<"u"&&localStorage.setItem(a,d);},[a]);useEffect(()=>{if(typeof window>"u")return;let d=document.documentElement,m=yo[r];Object.entries(m.colors).forEach(([c,l])=>{l&&d.style.setProperty(`--theme-${sb(c)}`,l);}),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(([c,l])=>{let p=m.colors[c];p&&d.style.setProperty(l,p);}),d.setAttribute("data-theme",r),d.classList.remove("theme-dark","theme-light","theme-neutral"),d.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:yo};return jsx(us.Provider,{value:n,children:e})}function Go(){let e=useContext(us);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function sb(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function ol({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Go();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(yo).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 ym(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return tt[e]||tt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",tt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",tt[e].bgSecondary),bgGrid:r("--theme-bg-card",tt[e].bgGrid),bgWeekend:r("--theme-bg-hover",tt[e].bgWeekend),border:r("--theme-border-primary",tt[e].border),borderLight:r("--theme-border-subtle",tt[e].borderLight),textPrimary:r("--theme-text-primary",tt[e].textPrimary),textSecondary:r("--theme-text-secondary",tt[e].textSecondary),textTertiary:r("--theme-text-tertiary",tt[e].textTertiary),accent:r("--theme-accent-primary",tt[e].accent),accentHover:r("--theme-accent-hover",tt[e].accentHover),accentLight:r("--theme-accent-primary",tt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",tt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",tt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",tt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",tt[e].dependency),dependencyHover:r("--theme-border-secondary",tt[e].dependencyHover),criticalPath:r("--theme-error",tt[e].criticalPath),criticalPathLight:r("--theme-error",tt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",tt[e].today):e==="neutral"?r("--theme-text-primary",tt[e].today):r("--theme-error",tt[e].today),todayLight:e==="light"?r("--theme-accent-primary",tt[e].todayLight):e==="neutral"?r("--theme-text-primary",tt[e].todayLight):r("--theme-error",tt[e].todayLight),milestone:r("--theme-warning",tt[e].milestone),milestoneLight:r("--theme-warning",tt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",tt[e].statusTodo),statusInProgress:r("--theme-accent-primary",tt[e].statusInProgress),statusCompleted:r("--theme-success",tt[e].statusCompleted),hoverBg:r("--theme-bg-hover",tt[e].hoverBg),focusRing:r("--theme-accent-primary",tt[e].focusRing)}}var ps={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"},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"}},vm={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"},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"}},nl={en:ps,es:vm};function xm(e){return nl[e]||nl.en}function sl(e,t){let a=xm(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 _o=createContext(ps);function Zr(){return useContext(_o)}function Sb({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[d,m]=useState(false),[i,c]=useState(null),l=useRef(null),p=Zr();if(useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&m(false);};return d&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[d]),!(t||a||r||o||s||n))return null;let v=[{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(g=>g.handler),w=async(g,y)=>{if(y){c(g);try{await y();}catch(h){console.error(`Export ${g} failed:`,h);}finally{c(null),m(false);}}};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>m(!d),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:d?e.accent:e.bgSecondary,border:`1px solid ${d?e.accent:e.borderLight}`,color:d?"#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:p.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:d?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:d&&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:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:v.map((g,y)=>jsxs(motion.button,{onClick:()=>w(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<v.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 Eb({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-xs 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 Pb({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-xs 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 Mb({theme:e,value:t,onChange:a}){let[r,o]=useState(false),s=useRef(null),n=Zr();useEffect(()=>{let i=c=>{s.current&&!s.current.contains(c.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],m=d.find(i=>i.value===t)?.label||"Normal";return jsxs("div",{ref:s,className:"relative",children:[jsx(motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${n.toolbar.density||"Density"}: ${m}`,children:jsx(Rows3,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&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 left-0 mt-2 w-36 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((i,c)=>{let l=t===i.value;return jsxs(motion.button,{onClick:()=>{a(i.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:c<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:i.label}),l&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function Fb({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),d=useRef(null),m=Zr();useEffect(()=>{if(!s)return;let p=setTimeout(()=>{let f=w=>{d.current&&!d.current.contains(w.target)&&n(false);},v=w=>{w.key==="Escape"&&n(false);};document.addEventListener("mousedown",f),document.addEventListener("keydown",v),d._cleanup=()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(p),d._cleanup&&d._cleanup();}},[s]);let i=[{value:"all",label:m.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:m.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:m.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:m.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],c=t!=="all"||r,l=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxs("div",{ref:d,className:"relative",children:[jsxs(motion.button,{onClick:p=>{p.stopPropagation(),n(f=>!f);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?l?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${c?l?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:c?"#3B82F6":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children:m.toolbar.filter||"Filters"}),c&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsx(AnimatePresence,{children:s&&jsxs(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 left-0 mt-2 w-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:l?"#0F1117":"#FFFFFF",border:`1px solid ${l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:l?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:l?"#6B7280":"#9CA3AF"},children:m.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-2",children:i.map(p=>{let f=t===p.value&&!r,v=()=>p.value==="all"?f?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):p.icon;return jsxs(motion.button,{onClick:()=>{a(p.value),o&&o(false),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:f?l?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsx("span",{className:`${f?p.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:l?"#FFFFFF":"#111827"},children:p.label}),f&&jsx(Check,{className:"w-4 h-4 flex-shrink-0",style:{color:l?"#3B82F6":"#2563EB"}})]},p.value)})}),jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:l?"rgba(255,255,255,0.1)":"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-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?l?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:l?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?l?"#3B82F6":"#2563EB":l?"#6B7280":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:l?"#FFFFFF":"#111827"},children:m.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-4 h-4 flex-shrink-0",style:{color:l?"#3B82F6":"#2563EB"}})]})})]})})]})}function fs({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:d,onRowDensityChange:m,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:l,onCreateTask:p,taskFilter:f="all",onTaskFilterChange:v,hideCompleted:w=false,onHideCompletedChange:g,onExportPNG:y,onExportPDF:h,onExportExcel:b,onExportCSV:x,onExportJSON:N,onExportMSProject:D}){let T=Zr(),k=y||h||b||x||N||D,R=[{value:"day",label:T.toolbar.day},{value:"week",label:T.toolbar.week},{value:"month",label:T.toolbar.month}],I=[{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"})}];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(Pb,{options:R,value:t,onChange:C=>a(C),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-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",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}}),jsx(Mb,{theme:e,value:d,onChange:m}),v&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Fb,{theme:e,value:f,onChange:v,hideCompleted:w,onHideCompletedChange:g})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[c&&p&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 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:l||T.toolbar.createTask})]}),(k||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),k&&jsxs(Fragment,{children:[jsx(Sb,{theme:e,onExportPNG:y,onExportPDF:h,onExportExcel:b,onExportCSV:x,onExportJSON:N,onExportMSProject:D}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsx(Eb,{options:I,value:s,onChange:C=>n(C),theme:e})]})]})}function hs({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),d=useRef(null),m=useRef(null);useEffect(()=>{if(!r)return;let c=l=>{d.current&&!d.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let c=m.current.getBoundingClientRect();n({x:c.left,y:c.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(gt,{children:jsx(motion.div,{ref:d,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(c=>jsxs("button",{onClick:()=>{t(c.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:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:c.label}),c.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function jo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[d,m]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let c=200,l=r.length*36+8,p=8,f=window.innerWidth,v=window.innerHeight,w=t,g=a;t+c+p>f&&(w=t-c,w<p&&(w=p)),a+l+p>v&&(g=v-l-p,g<p&&(g=p)),m({x:w,y:g});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let c=p=>{n.current&&!n.current.contains(p.target)&&o();},l=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let i=c=>c.startsWith("#")&&(c.length===7||c.length===4)?c: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:`${d.x}px`,top:`${d.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(c=>jsxs("div",{children:[c.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:l=>{c.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsx("span",{style:{color:s.textSecondary},children:c.icon}),jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},c.id))})})})}var At={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 Pm({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:d,onTaskOutdent:m,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:l,enableKeyboard:p=true}){let f=useRef(false),v=useCallback(b=>{f.current=b;},[]),w=useCallback(b=>{let x=[],N=D=>{for(let T of D)x.push(T),T.subtasks&&T.subtasks.length>0&&T.isExpanded&&N(T.subtasks);};return N(b),x},[]),g=useCallback(()=>{let b=w(e);for(let x of b)if(t.has(x.id))return x;return null},[e,t,w]),y=useCallback((b,x)=>{let N=w(e);if(N.length===0)return;let D=g();if(!D){a(N[0].id,false);return}let T=N.findIndex(I=>I.id===D.id);if(T===-1)return;let k=b==="up"?T-1:T+1;if(k<0||k>=N.length)return;let R=N[k];a(R.id,x);},[e,g,w,a]),h=useCallback(b=>{if(!p)return;let x=b.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||f.current){b.key==="Escape"&&(x.blur(),f.current=false);return}let T=navigator.platform.toUpperCase().indexOf("MAC")>=0?b.metaKey:b.ctrlKey,k=Array.from(t),R=g();if(b.key==="ArrowUp"){b.preventDefault(),y("up",b.shiftKey);return}if(b.key==="ArrowDown"){b.preventDefault(),y("down",b.shiftKey);return}if(R&&(b.key==="ArrowRight"||b.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(b.preventDefault(),(b.key==="ArrowRight"&&!R.isExpanded||b.key==="ArrowLeft"&&R.isExpanded)&&c(R.id));return}if(b.altKey&&(b.key==="ArrowUp"||b.key==="ArrowDown")){k.length>0&&(b.preventDefault(),n(k,b.key==="ArrowUp"?"up":"down"));return}if(b.key==="Tab"&&!b.shiftKey){k.length>0&&(b.preventDefault(),d(k));return}if(b.key==="Tab"&&b.shiftKey){k.length>0&&(b.preventDefault(),m(k));return}if(b.key==="Enter"&&!b.shiftKey&&!T){R&&(b.preventDefault(),r(R.id,"below"));return}if(b.key==="Enter"&&b.shiftKey&&!T){R&&(b.preventDefault(),r(R.id,"above"));return}if(b.key==="Enter"&&T){R&&(b.preventDefault(),l(R.id));return}if(b.key==="F2"){R&&(b.preventDefault(),i(R.id));return}if(b.key==="Delete"||b.key==="Backspace"&&T){k.length>0&&(b.preventDefault(),o(k));return}if(b.key==="d"&&T&&!b.shiftKey){k.length>0&&(b.preventDefault(),s(k));return}},[p,t,g,y,r,o,s,n,d,m,i,c,l]);return useEffect(()=>{if(p)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[p,h]),{setIsEditing:v}}function Fm(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(l=>{t(new Set([l])),r(l);},[]),s=useCallback(l=>{t(p=>{let f=new Set(p);return f.has(l)?f.delete(l):f.add(l),f}),r(l);},[]),n=useCallback((l,p)=>{if(!a){o(l);return}let f=p.indexOf(a),v=p.indexOf(l);if(f===-1||v===-1){o(l);return}let w=Math.min(f,v),g=Math.max(f,v),y=p.slice(w,g+1);t(new Set(y)),r(l);},[a,o]),d=useCallback((l,p,f,v)=>{v?n(l,p):f?s(l):o(l);},[o,s,n]),m=useCallback((l,p)=>{p?t(f=>{let v=new Set(f);return v.add(l),v}):o(l);},[o]),i=useCallback(()=>{t(new Set),r(null);},[]),c=useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:d,handleKeyboardSelection:m,clearSelection:i,isTaskSelected:c}}function Ko(e){let t=[],a=(r,o,s=0)=>{for(let n=0;n<r.length;n++){let d={...r[n],parentId:o,level:s,position:n};t.push(d),d.subtasks&&d.subtasks.length>0&&d.isExpanded&&a(d.subtasks,d.id,s+1);}};return a(e),t}function Am(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Am(a.subtasks,t);if(r)return r}}return null}function pl(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=pl(a.subtasks,t);if(r)return r}return null}function gl(e,t){if(t.length===0)return e;let a=Ko(e),r=t[0],o=a.findIndex(l=>l.id===r);if(o<=0)return e;let s=a[o-1],n=(l,p)=>{let f=[];return {tasks:l.filter(w=>{if(p.has(w.id))return f.push(w),false;if(w.subtasks){let g=n(w.subtasks,p);w.subtasks=g.tasks,f.push(...g.removed);}return true}),removed:f}},d=(l,p,f)=>l.map(v=>v.id===p?{...v,subtasks:[...v.subtasks||[],...f],isExpanded:true}:v.subtasks?{...v,subtasks:d(v.subtasks,p,f)}:v),m=new Set(t),{tasks:i,removed:c}=n(e,m);return d(i,s.id,c)}function fl(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=pl(a,r);if(!o)continue;let s=pl(a,o.id),n=(i,c,l)=>{for(let p=0;p<i.length;p++){let f=i[p];if(f.id===c&&f.subtasks){let v=f.subtasks.findIndex(w=>w.id===l);if(v!==-1){let[w]=f.subtasks.splice(v,1);return w}}if(f.subtasks){let v=n(f.subtasks,c,l);if(v)return v}}return null},d=(i,c,l)=>{let p=i.findIndex(f=>f.id===c);if(p!==-1)return i.splice(p+1,0,l),i;for(let f of i)f.subtasks&&d(f.subtasks,c,l);return i},m=n(a,o.id,r);m&&(s&&s.subtasks?d(s.subtasks,o.id,m):d(a,o.id,m));}return a}function hl(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,d,m)=>{let i=n.findIndex(l=>l.id===d);if(i===-1){for(let l of n)if(l.subtasks&&s(l.subtasks,d,m))return true;return false}let c=m==="up"?i-1:i+1;return c<0||c>=n.length?false:([n[i],n[c]]=[n[c],n[i]],true)};return s(r,o,a),r}function bl(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 vn(e,t){let a=[...e],r=[];for(let o of t){let s=(m,i)=>m.map((c,l)=>({...c,id:`${c.id}-copy-${Date.now()}-${l}`,parentId:i,subtasks:c.subtasks?s(c.subtasks,`${c.id}-copy-${Date.now()}-${l}`):void 0})),n=m=>{let i=m.findIndex(f=>f.id===o);if(i===-1){for(let f of m)if(f.subtasks){let v=n(f.subtasks);if(v)return v}return null}let c=m[i],l=`${c.id}-copy-${Date.now()}`,p={...c,id:l,name:`${c.name} (Copy)`,subtasks:c.subtasks?s(c.subtasks,l):void 0};return m.splice(i+1,0,p),p},d=n(a);d&&r.push(d);}return {tasks:a,duplicatedTasks:r}}function Lm(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:"#6366F1"},d=m=>{let i=m.findIndex(l=>l.id===t);if(i===-1){for(let l of m)if(l.subtasks&&d(l.subtasks))return true;return false}let c=a==="above"?i:i+1;return m.splice(c,0,n),true};return d(r),{tasks:r,newTask:n}}function yl(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:yl(r.subtasks,t,a)}:r)}function vl(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:vl(a.subtasks,t)}:a)}function xl(e,t){let a=c=>{for(let l of c){if(l.id===t)return l;if(l.subtasks){let p=a(l.subtasks);if(p)return p}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,d=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(d),color:r?.color||"#3B82F6"},i=c=>c.map(l=>{if(l.id===t){let p=l.subtasks||[];return {...l,subtasks:[...p,m],isExpanded:true}}return l.subtasks?{...l,subtasks:i(l.subtasks)}:l});return {tasks:i(e),newTask:m}}function Im(e,t,a,r){if(t===a)return e;let o=Am(e,t);if(!o)return e;if(a){let d=(m,i)=>{if(!m.subtasks)return false;for(let c of m.subtasks)if(c.id===i||d(c,i))return true;return false};if(d(o,a))return e}let s=d=>d.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),n=s(e);if(a===null){let d=r!==void 0?r:n.length;n.splice(d,0,{...o,parentId:void 0});}else {let d=m=>m.map(i=>{if(i.id===a){let c=i.subtasks||[],l=r!==void 0?r:c.length,p=[...c];return p.splice(l,0,{...o,parentId:a}),{...i,subtasks:p,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:d(i.subtasks)}:i});n=d(n);}return n}function vs({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:d,onTaskToggle:m,scrollTop:i,columns:c,onToggleColumn:l,onColumnResize:p,onTaskUpdate:f,onTaskIndent:v,onTaskOutdent:w,onTaskMove:g,onMultiTaskDelete:y,onTaskDuplicate:h,onTaskCreate:b,onTaskRename:x,onCreateSubtask:N,onOpenTaskModal:D,onDeleteRequest:T,onTaskReparent:k}){let R=useContext(_o),[I,C]=useState(null),[W,B]=useState(null),[Q,S]=useState(""),_=useRef(null),[oe,Te]=useState(null),[A,Ee]=useState(0),[L,U]=useState(0),[E,q]=useState({isOpen:false,x:0,y:0,type:"header"}),[ee,de]=useState(null),[he,ge]=useState(null),[Le,re]=useState(null),Qe=useRef(0),Ie=5,Ke=useRef(false),[ht,bt]=useState(null),[qe,xt]=useState(false),[ut,yt]=useState(null),[ne,O]=useState(false),J=useRef(null);useEffect(()=>{function z(K){J.current&&!J.current.contains(K.target)&&O(false);}if(ne)return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[ne]),useEffect(()=>{W&&_.current&&(_.current.focus(),_.current.select());},[W]),useEffect(()=>{if(!oe)return;let z=ye=>{let _e=ye.clientX-A,Xe=L+_e;p?.(oe,Xe);},K=()=>{Te(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",z),document.addEventListener("mouseup",K),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",K),document.body.style.cursor="",document.body.style.userSelect="";}},[oe,A,L,p]);let{selectedTaskIds:ce,handleTaskClick:ke,isTaskSelected:$e}=Fm(),{setIsEditing:Je}=Pm({tasks:e,selectedTaskIds:ce,onTaskSelect:(z,K)=>{let _e=Ko(e).map(Xe=>Xe.id);ke(z,_e,K||false,false);},onTaskCreate:b||(()=>{}),onTaskDelete:y||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:w||(()=>{}),onTaskRename:z=>{let K=Ko(e).find(ye=>ye.id===z);K&&be(K);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:z=>{let K=Ko(e).find(ye=>ye.id===z);K&&D&&D(K);},enableKeyboard:true}),ot=(z,K=0)=>{let ye=[];for(let _e of z)ye.push({task:_e,level:K}),_e.subtasks&&_e.subtasks.length>0&&_e.isExpanded&&ye.push(...ot(_e.subtasks,K+1));return ye},ze=ot(e),oa=48,G=Math.max(ze.length*a,600-oa),Y=z=>!z.startDate||!z.endDate?"-":`${Math.ceil((z.endDate.getTime()-z.startDate.getTime())/(1e3*60*60*24))}d`,be=z=>{B(z.id),S(z.name),Je(true);},Ye=z=>{Q.trim()&&Q!==e.find(K=>K.id===z)?.name&&x?.(z,Q.trim()),B(null),S(""),Je(false);},we=()=>{B(null),S(""),Je(false);},Pe=(z,K)=>{K.stopPropagation(),N?.(z.id);},X=(z,K)=>{K.preventDefault(),Qe.current=K.clientY,de(z),Ke.current=false,xt(false),bt({x:K.clientX,y:K.clientY});},Ue=z=>{if(!ee||(Math.abs(z.clientY-Qe.current)>Ie&&!Ke.current&&(Ke.current=true,xt(true)),bt({x:z.clientX,y:z.clientY}),!Ke.current))return;let ye=document.querySelectorAll("[data-task-row]"),_e=null,Xe=null;ye.forEach(V=>{let ue=V.getBoundingClientRect(),Be=V.getAttribute("data-task-row");if(Be&&Be!==ee&&z.clientY>=ue.top&&z.clientY<=ue.bottom){_e=Be;let Mt=z.clientY-ue.top,it=ue.height;Mt<it*.25?Xe="above":Mt>it*.75?Xe="below":Xe="child";}}),ge(_e),re(Xe);},H=()=>{if(Ke.current&&ee&&he&&Le){if(Le==="child")k?.(ee,he);else if(Le==="above"||Le==="below"){let z=(_e,Xe,V=null)=>{for(let ue of _e){if(ue.id===Xe)return V;if(ue.subtasks){let Be=z(ue.subtasks,Xe,ue.id);if(Be!==void 0)return Be}}},K=z(e,he,null),ye=(_e,Xe)=>{let V=_e.findIndex(ue=>ue.id===Xe);return Le==="below"?V+1:V};if(K===null){let _e=ye(e,he);k?.(ee,null,_e);}else {let _e=ze.find(Xe=>Xe.task.id===K)?.task;if(_e?.subtasks){let Xe=ye(_e.subtasks,he);k?.(ee,K,Xe);}}}}de(null),ge(null),re(null),bt(null),Ke.current=false,xt(false);};useEffect(()=>{if(ee)return document.addEventListener("mousemove",Ue),document.addEventListener("mouseup",H),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Ue),document.removeEventListener("mouseup",H),document.body.style.cursor="",document.body.style.userSelect="";}},[ee,he,Le]);let ie=(z,K,ye)=>{switch(z.id){case "name":let _e=W===K.id,Xe=I===K.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${ye*20}px`},children:[k&&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:Xe?1:.3},onMouseDown:Ne=>X(K.id,Ne),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),K.subtasks&&K.subtasks.length>0?jsx("button",{onClick:Ne=>{Ne.stopPropagation(),m?.(K.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:K.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 flex items-center justify-center",children:jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:K.color||"#3B82F6",opacity:K.parentId?.6:1,borderColor:K.isMilestone?t.accent:"transparent",borderWidth:K.isMilestone?"2px":"0px"},title:K.isMilestone?"Milestone":K.parentId?"Subtask":"Task"})}),_e?jsx("input",{ref:_,type:"text",value:Q,onChange:Ne=>S(Ne.target.value),onKeyDown:Ne=>{Ne.key==="Enter"?Ye(K.id):Ne.key==="Escape"&&we();},onBlur:()=>Ye(K.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:Ne=>Ne.stopPropagation()}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1",style:{color:K.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:K.parentId?"13px":"14px",fontWeight:K.isMilestone?600:K.parentId?400:600,letterSpacing:K.parentId?"0":"-0.01em"},title:K.name,children:K.name}),Xe&&!_e&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:Ne=>Ne.stopPropagation(),children:[jsx("button",{onClick:Ne=>Pe(K,Ne),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:Ne=>{Ne.stopPropagation(),be(K);},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 ue=z.id==="startDate"?"startDate":"endDate",Be=K[ue],Mt=ut?.taskId===K.id&&ut?.field===ue,it=Ne=>Ne?(typeof Ne=="string"?new Date(Ne):Ne).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:Ne=>Ne.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},onClick:Ne=>{if(Mt)yt(null);else {let Rt=Ne.currentTarget.getBoundingClientRect();yt({taskId:K.id,field:ue,month:Be?typeof Be=="string"?new Date(Be):Be:new Date,position:{top:Rt.bottom+4,left:Rt.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:it(Be)})]}),Mt&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>yt(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:ut?.position.top,left:ut?.position.left},onClick:Ne=>Ne.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let Ne=new Date,Rt=new Date(Ne);Rt.setDate(Ne.getDate()+1);let Ot=new Date(Ne);Ot.setDate(Ne.getDate()+7);let Na=new Date(Ne);return Na.setDate(Ne.getDate()+14),[{label:"Hoy",date:Ne},{label:"Ma\xF1ana",date:Rt},{label:"Pr\xF3xima semana",date:Ot},{label:"2 semanas",date:Na}].map((kt,dr)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:M=>M.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:M=>M.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(K.id,{[ue]:kt.date}),yt(null);},children:kt.label},dr))})(),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:Ne=>Ne.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Ne=>Ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(K.id,{[ue]:void 0}),yt(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:()=>yt(Ne=>Ne?{...Ne,month:new Date(Ne.month.getFullYear(),Ne.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:ut?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>yt(Ne=>Ne?{...Ne,month:new Date(Ne.month.getFullYear(),Ne.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((Ne,Rt)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:Ne},Rt))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Ne=ut?.month||new Date,Rt=Ne.getFullYear(),Ot=Ne.getMonth(),Na=new Date(Rt,Ot,1).getDay(),wr=new Date(Rt,Ot+1,0).getDate(),kt=new Date,dr=[];for(let ae=Na-1;ae>=0;ae--)dr.push({day:new Date(Rt,Ot,-ae).getDate(),date:new Date(Rt,Ot-1,new Date(Rt,Ot,-ae).getDate()),isCurrentMonth:false});for(let ae=1;ae<=wr;ae++)dr.push({day:ae,date:new Date(Rt,Ot,ae),isCurrentMonth:true});let M=42-dr.length;for(let ae=1;ae<=M;ae++)dr.push({day:ae,date:new Date(Rt,Ot+1,ae),isCurrentMonth:false});return dr.map((ae,Oe)=>{let Ze=ae.date.toDateString()===kt.toDateString(),ba=(Be?typeof Be=="string"?new Date(Be):Be:null)?.toDateString()===ae.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:ae.isCurrentMonth?ba?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:ba?"#3B82F6":"transparent",boxShadow:Ze&&!ba?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{f?.(K.id,{[ue]:ae.date}),yt(null);},children:ae.day},Oe)})})()})]})]})]}),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:Y(K)})});case "assignees":let kr=r.filter(Ne=>K.assignees?.some(Rt=>Rt.name===Ne.name||Rt.initials===Ne.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:Ne=>Ne.stopPropagation(),children:jsx(uo,{assignedUsers:kr,availableUsers:r,onChange:Ne=>{let Rt=Ne.map(Ot=>({id:Ot.id,name:Ot.name,initials:Ot.initials,color:Ot.color}));f?.(K.id,{assignees:Rt.length>0?Rt:void 0});}})});case "status":return jsx("div",{className:"flex items-center justify-center w-full",onClick:Ne=>Ne.stopPropagation(),children:jsx(mc,{status:K.status||"todo",onChange:Ne=>{f?.(K.id,{status:Ne,progress:Ne==="completed"?100:K.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",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:`${K.progress}%`,backgroundColor:K.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:[K.progress,"%"]})]});case "priority":let Za={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},lr={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Qa=Za[K.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:Ne=>Ne.stopPropagation(),children:jsx(co,{priority:Qa,onChange:Ne=>{Ne&&f?.(K.id,{priority:lr[Ne]||"medium"});}})});default:return null}},Fe=z=>[{id:"hide",label:"Hide Column",icon:At.Hide,onClick:()=>l(z),disabled:z==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:At.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:At.SortDesc,onClick:()=>{}}],Ve=z=>z.subtasks&&z.subtasks.length>0?[{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:At.Add,onClick:()=>{N?.(z.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:At.Delete,onClick:()=>{T?T(z.id,z.name):y?.([z.id]);}}]:[{id:"edit",label:R?.contextMenu?.editTask||"Edit Task",icon:At.Pencil,onClick:()=>{n?.(z);}},{id:"addSubtask",label:R?.contextMenu?.addSubtask||"Add Subtask",icon:At.Add,onClick:()=>{N?.(z.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:R?.contextMenu?.markIncomplete||"Mark Incomplete",icon:At.MarkIncomplete,onClick:()=>{f?.(z.id,{status:"todo",progress:0});},disabled:z.status==="todo"},{id:"setInProgress",label:R?.contextMenu?.setInProgress||"Set In Progress",icon:At.SetInProgress,onClick:()=>{f?.(z.id,{status:"in-progress"});},disabled:z.status==="in-progress"},{id:"markComplete",label:R?.contextMenu?.markComplete||"Mark Complete",icon:At.MarkComplete,onClick:()=>{f?.(z.id,{status:"completed",progress:100});},disabled:z.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:R?.contextMenu?.duplicateTask||"Duplicate Task",icon:At.Duplicate,onClick:()=>{h?.([z.id]);}},{id:"split",label:R?.contextMenu?.splitTask||"Split Task",icon:At.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:R?.contextMenu?.deleteTask||"Delete Task",icon:At.Delete,onClick:()=>{T?T(z.id,z.name):y?.([z.id]);}}],We=c.filter(z=>z.visible),Re=We.reduce((z,K)=>z+K.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Re},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${oa}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:We.map((z,K)=>{let ye=K===We.length-1,_e=z.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${_e?"":"justify-center"}`,style:{width:`${z.width}px`,minWidth:`${z.minWidth??(_e?200:60)}px`,maxWidth:`${z.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ye?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Xe=>{Xe.preventDefault(),q({isOpen:true,x:Xe.clientX,y:Xe.clientY,type:"header",columnId:z.id});},onMouseEnter:Xe=>{Xe.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Xe=>{Xe.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:z.label,children:z.label}),z.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:oe===z.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Xe=>{Xe.preventDefault(),Xe.stopPropagation(),Te(z.id),Ee(Xe.clientX),U(z.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},z.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsx(hs,{columns:c,onToggleColumn:l,theme:t}),jsx("button",{onClick:()=>O(!ne),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"})}),ne&&jsxs("div",{ref:J,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:z=>z.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsx("button",{onClick:()=>O(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:G},children:ze.map(({task:z,level:K},ye)=>{let _e=$e(z.id),Xe=he===z.id,V=Xe&&Le==="above",ue=Xe&&Le==="below",Be=Xe&&Le==="child",Mt={};return Be&&(Mt.backgroundColor=`${t.accent}15`,Mt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":z.id,className:`flex items-center cursor-pointer group ${ee===z.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:_e?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:_e?t.accentLight:Be?`${t.accent}15`:ye%2===0?t.bgPrimary:t.bgGrid,...Mt},onMouseEnter:()=>C(z.id),onMouseLeave:()=>C(null),onClick:it=>{let Za=Ko(e).map(Ne=>Ne.id),Qa=navigator.platform.toUpperCase().indexOf("MAC")>=0?it.metaKey:it.ctrlKey;ke(z.id,Za,Qa,it.shiftKey),s?.(z);},onDoubleClick:it=>{it.stopPropagation(),n?.(z);},onContextMenu:it=>{it.preventDefault(),q({isOpen:true,x:it.clientX,y:it.clientY,type:"task",task:z}),d?.(z,it);},whileHover:{backgroundColor:_e?t.accentLight:t.hoverBg},children:[V&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ue&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),We.map((it,kr)=>{let Za=kr===We.length-1,lr=it.id==="name";return jsx("div",{className:`px-4 flex items-center ${lr?"justify-start":"justify-center"}`,style:{width:`${it.width}px`,minWidth:`${it.minWidth??(lr?200:60)}px`,maxWidth:`${it.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Za?"none":`1px solid ${I===z.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ie(it,z,lr?K:0)},`${z.id}-${it.id}`)})]},z.id)})}),jsx(jo,{isOpen:E.isOpen,x:E.x,y:E.y,items:E.type==="header"&&E.columnId?Fe(E.columnId):E.type==="task"&&E.task?Ve(E.task):[],onClose:()=>q({...E,isOpen:false}),theme:t}),qe&&ht&&ee&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:ht.x+12,top:ht.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let z=ze.find(K=>K.task.id===ee)?.task;return z?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:z.name})}):null})()}),document.body)]})}function zm(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,d]=useState(e),[m,i]=useState(t),[c,l]=useState(null),[p,f]=useState(null),[v,w]=useState(null),[g,y]=useState(null),[h,b]=useState(0),[x,N]=useState(0),[D,T]=useState(null),[k,R]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:d,ghostWidth:m,setGhostWidth:i,connectionLine:c,setConnectionLine:l,hoveredTaskId:p,setHoveredTaskId:f,activeZone:v,setActiveZone:w,draggedSegmentIndex:g,setDraggedSegmentIndex:y,draggedSegmentStartX:h,setDraggedSegmentStartX:b,segmentDragOffsetX:x,setSegmentDragOffsetX:N,hoveredSegmentIndex:D,setHoveredSegmentIndex:T,isHovered:k,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(Q,S)=>{r("none"),l(null),f(null),d(Q),i(S),N(0),y(null),b(0);}}}function ks({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:d,onClick:m,onDoubleClick:i,onContextMenu:c,onDateChange:l,onDependencyCreate:p,allTaskPositions:f=[],onDragMove:v,onHoverChange:w}){let g=zm(t,r),y=useRef(null),h=useRef(null),b=useRef(null),{dragMode:x,setDragMode:N,dragOffset:D,setDragOffset:T,ghostX:k,setGhostX:R,ghostWidth:I,setGhostWidth:C,connectionLine:W,setConnectionLine:B,hoveredTaskId:Q,setHoveredTaskId:S,activeZone:_,setActiveZone:oe,draggedSegmentIndex:Te,setDraggedSegmentIndex:A,draggedSegmentStartX:Ee,setDraggedSegmentStartX:L,segmentDragOffsetX:U,setSegmentDragOffsetX:E,hoveredSegmentIndex:q,setHoveredSegmentIndex:ee,isHovered:de,setIsHovered:he,isDragging:ge,isResizing:Le,isConnecting:re,resetDragState:Qe}=g,Ie=24,Ke=8,ht=e.endDate&&e.endDate<new Date&&e.progress<100,bt=e.isCriticalPath,qe=o.name==="neutral"||o.today==="#1C1917",xt=e.status==="completed"||e.progress===100,ut={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},ne=e.isCriticalPath||ht?"#DC2626":e.color?e.color:e.priority&&ut[e.priority]?ut[e.priority]:o.taskBarPrimary,J=(H=>H>=80?20:H>=60?15:H>=50?12:10)(r),ce=r<50,ke=r<40;useEffect(()=>{if(w)if(de&&!ge&&!e.segments){let H=a<100;w({task:e,x:t,y:a,width:r,height:Ie,showBelow:H});}else w(null);},[de,ge,e,t,a,r,Ie,w]);let $e=H=>H.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Je=()=>{let H=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${H} day${H!==1?"s":""}`},ot=H=>Math.round(H/s)*s,ze=H=>{let ie=Math.round(H/s),Fe=new Date(n);return Fe.setDate(Fe.getDate()+ie),Fe},oa=(H,ie)=>{for(let Fe of f){if(Fe.id===e.id)continue;let Ve=5;if(H>=Fe.x-Ve&&H<=Fe.x+Fe.width+Ve&&ie>=Fe.y-Ve&&ie<=Fe.y+Fe.height+Ve)return Fe.id}return null},G=useCallback((H,ie,Fe)=>{H.preventDefault(),H.stopPropagation();let Ve=y.current?.ownerSVGElement;if(!Ve)return;let We=Ve.createSVGPoint();We.x=H.clientX,We.y=H.clientY;let Re=We.matrixTransform(Ve.getScreenCTM()?.inverse()),z=Fe!==void 0?Fe:t,K=ie;if(!K){let ye=Re.x-z;H.shiftKey?(K="connect",B({x:t+r,y:a+Ie/2})):H.ctrlKey||H.metaKey?K="move":H.altKey?K=ye<r/2?"resize-start":"resize-end":ke?ye<r/2?K="move":K="resize-end":ce?ye<=J/2?K="resize-start":ye>=r-J/2?K="resize-end":K="move":ye<=J?K="resize-start":ye>=r-J?K="resize-end":K="move";}N(K),he(false),oe(null),K==="move"?T(Re.x-z):K==="connect"?B({x:t+r,y:a+Ie/2}):T(0),R(z),C(r);},[t,r,a,Ie]),Y=useCallback(H=>{let ie=y.current?.ownerSVGElement;if(!ie)return;let Fe=ie.closest(".gantt-timeline-scroll");if(!Fe)return;let Ve=Fe.getBoundingClientRect(),We=60,Re=15,z=0;if(H.clientX<Ve.left+We){let K=Ve.left+We-H.clientX;z=-Math.min(Re,K/2);}else if(H.clientX>Ve.right-We){let K=H.clientX-(Ve.right-We);z=Math.min(Re,K/2);}return z!==0&&(Fe.scrollLeft+=z),z!==0},[]),be=useCallback(H=>{if(x==="none")return;b.current=H;let ie=y.current?.ownerSVGElement;if(!ie)return;if(x==="move"||x==="resize-start"||x==="resize-end"){let We=Y(H);We&&!h.current?h.current=window.setInterval(()=>{b.current&&(Y(b.current),be(b.current));},16):!We&&h.current&&(window.clearInterval(h.current),h.current=null);}let Fe=ie.createSVGPoint();Fe.x=H.clientX,Fe.y=H.clientY;let Ve=Fe.matrixTransform(ie.getScreenCTM()?.inverse());if(x==="connect"){B({x:Ve.x,y:Ve.y});let We=oa(Ve.x,Ve.y);S(We);}else if(x==="move"){let We=Ve.x-D,Re=ot(We);R(Re),C(r);let z=Math.round((Re-t)/s);if(v?.(e.id,z,true),e.segments&&e.segments.length>0&&Te!==null){let K=Re-Ee;E(K);}}else if(x==="resize-start"){let We=Ve.x,Re=ot(We),z=t+r-Re;z>=s&&(R(Re),C(z));}else if(x==="resize-end"){let We=Ve.x,z=ot(We)-t;z>=s&&C(z);}},[x,t,r,s,D,e,ot,Te,Ee,oa,S,B,R,C,E,v,Y]),Ye=useCallback(()=>{if(h.current&&(window.clearInterval(h.current),h.current=null),b.current=null,x!=="none"){if(x==="connect")Q&&p&&p(e,Q),B(null),S(null);else {let H=e.endDate.getTime()-e.startDate.getTime(),ie,Fe,Ve=true;if(x==="move"){if(ie=ze(k),Fe=new Date(ie.getTime()+H),e.segments&&e.segments.length>0&&Te!==null){let We=Math.round(U/s),Re=e.segments.map((_e,Xe)=>{if(Xe===Te){let V=new Date(_e.startDate),ue=new Date(_e.endDate);return V.setDate(V.getDate()+We),ue.setDate(ue.getDate()+We),{startDate:V,endDate:ue}}return _e}),z=Re.flatMap(_e=>[_e.startDate,_e.endDate]),K=new Date(Math.min(...z.map(_e=>_e.getTime()))),ye=new Date(Math.max(...z.map(_e=>_e.getTime())));l?.({...e,segments:Re},K,ye),Qe(t,r);return}}else x==="resize-start"?(ie=ze(k),Fe=e.endDate,ie>Fe&&(console.warn("Invalid date range: start date must be before or equal to end date"),Ve=false)):x==="resize-end"?(ie=e.startDate,Fe=ze(k+I),Fe<ie&&(console.warn("Invalid date range: end date must be after or equal to start date"),Ve=false)):Ve=false;Ve&&ie&&Fe&&(Fe.getTime()<ie.getTime()?console.warn("Invalid date range: end date cannot be before start date"):l?.(e,ie,Fe));}v?.(e.id,0,false),Qe(t,r);}},[x,k,I,e,l,Q,p,t,r,s,ze,U,Te,Qe,v]);useEffect(()=>{if(x==="none")return;let H=Fe=>{be(Fe);},ie=()=>{Ye();};return window.addEventListener("mousemove",H),window.addEventListener("mouseup",ie),()=>{window.removeEventListener("mousemove",H),window.removeEventListener("mouseup",ie),h.current&&(window.clearInterval(h.current),h.current=null);}},[x,be,Ye]);let we=ge&&!re?k:t,Pe=ge&&!re?I:r,X=d.taskClass(e);return jsxs("g",{ref:y,"data-task-bar":"true",onClick:()=>!ge&&m?.(e),onDoubleClick:H=>{ge||(H.stopPropagation(),i?.(e));},onContextMenu:H=>{H.preventDefault(),c?.(e,H);},onMouseEnter:()=>!ge&&he(true),onMouseLeave:()=>{ge||(he(false),oe(null));},children:[jsx("rect",{x:t,y:a,width:r+24,height:Ie,fill:"transparent",style:{pointerEvents:"all"}}),de&&!ge&&!ce&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:J,height:Ie,fill:_==="resize-start"?o.accent:"transparent",opacity:_==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>oe("resize-start"),onMouseDown:H=>G(H,"resize-start")}),jsx("rect",{x:t+J,y:a,width:r-J*2,height:Ie,fill:_==="move"?o.accent:"transparent",opacity:_==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>oe("move"),onMouseDown:H=>G(H,"move")}),jsx("rect",{x:t+r-J,y:a,width:J,height:Ie,fill:_==="resize-end"?o.accent:"transparent",opacity:_==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>oe("resize-end"),onMouseDown:H=>G(H,"resize-end")})]}),de&&!ge&&ke&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:Ie,fill:_==="move"?o.accent:"transparent",opacity:_==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>oe("move"),onMouseDown:H=>G(H,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:Ie,fill:_==="resize-end"?o.accent:"transparent",opacity:_==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>oe("resize-end"),onMouseDown:H=>G(H,"resize-end")}),de&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Ie-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ge&&!re&&!e.segments&&jsx(motion.rect,{x:k,y:a,width:I,height:Ie,rx:Ke,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsx(motion.rect,{x:we,y:a,width:Pe,height:Ie,rx:Ke,fill:ne,"data-task-class":X,initial:{opacity:0,scale:.95},animate:{opacity:ge&&!re?.15:e.parentId?.6:de?.9:.8,scale:de&&!ge?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:H=>G(H),style:{cursor:ge?re?"crosshair":Le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsx("rect",{x:we,y:a,width:Pe*(e.progress/100),height:Ie,rx:Ke,fill:ne,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((H,ie)=>{let Fe=(H.startDate.getTime()-n.getTime())/864e5*s,We=(H.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Fe+s,Re=ge&&x==="move"&&Te===ie,z=q===ie,K=Re?Fe+U:Fe;return jsxs("g",{onMouseEnter:()=>!ge&&ee(ie),onMouseLeave:()=>!ge&&ee(null),children:[jsx(motion.rect,{x:K,y:a,width:We,height:Ie,rx:Ke,fill:ne,initial:{opacity:0,scale:.95},animate:{opacity:Re||e.parentId?.6:z?.9:.8,scale:z&&!ge?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ye=>{ye.stopPropagation(),A(ie),L(Fe),G(ye,void 0,Fe);},style:{cursor:ge?re?"crosshair":Le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsx("rect",{x:K,y:a,width:We*(e.progress/100),height:Ie,rx:Ke,fill:ne,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ie}`)}),qe&&(ht||bt)&&!e.segments&&jsxs(Fragment,{children:[bt&&!ht&&jsx("rect",{x:we,y:a,width:Pe,height:Ie,rx:Ke,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ht&&jsx("rect",{x:we,y:a,width:Pe,height:Ie,rx:Ke,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Pe>60&&!e.segments&&(()=>{let H=d.taskLabel(e),ie=typeof H=="string"?H:e.name,Fe=ie.length>Math.floor(Pe/8)?`${ie.substring(0,Math.floor(Pe/8))}...`:ie;return jsx("text",{x:we+12,y:a+Ie/2,dominantBaseline:"middle",fill:xt?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:xt?"line-through":"none"},children:Fe})})(),Pe>100&&e.progress>0&&e.progress<100&&!ge&&!e.segments&&jsxs("text",{x:we+Pe-12,y:a+Ie/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&Pe>80&&!ge&&!e.segments&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:we+Pe-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:we+Pe-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(de||Le)&&!re&&!e.segments&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:we-2,y:a,width:16,height:Ie,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>oe("resize-start"),onMouseLeave:()=>oe(null),onMouseDown:H=>{H.stopPropagation(),G(H,"resize-start");}}),jsx(motion.rect,{x:we+4,y:a+8,width:3,height:Ie-16,rx:1.5,fill:_==="resize-start"||x==="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:we+Pe-14,y:a,width:16,height:Ie,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>oe("resize-end"),onMouseLeave:()=>oe(null),onMouseDown:H=>{H.stopPropagation(),G(H,"resize-end");}}),jsx(motion.rect,{x:we+Pe-7,y:a+8,width:3,height:Ie-16,rx:1.5,fill:_==="resize-end"||x==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:de&&!ge&&!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+Ie/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>oe("connect"),onMouseLeave:()=>oe(null),onMouseDown:H=>{H.stopPropagation(),G(H,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+Ie/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:_==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),re&&W&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+Ie/2,x2:W.x,y2:W.y,stroke:Q?o.statusCompleted:o.accent,strokeWidth:Q?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:Q?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:W.x,cy:W.y,r:Q?8:6,fill:Q?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),Q&&jsx(motion.text,{x:W.x+15,y:W.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:W.x+10},animate:{opacity:1,x:W.x+15},transition:{duration:.2},children:"Connect"})]}),(de||ge)&&!re&&!e.segments&&jsx(motion.rect,{x:we-2,y:a-2,width:Pe+4,height:Ie+4,rx:Ke+2,fill:"none",stroke:ge?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:ge?.6:.4,initial:{opacity:0},animate:{opacity:ge?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Le&&jsxs(Fragment,{children:[jsx("line",{x1:k,y1:0,x2:k,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:k+I,y1:0,x2:k+I,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:de&&!ge&&!e.segments&&!w&&(()=>{let Fe=a<100,Ve=Fe?a+Ie+13:a-82-13,We=Fe?`M ${we+Pe/2-6} ${a+Ie+3} L ${we+Pe/2} ${a+Ie+13} L ${we+Pe/2+6} ${a+Ie+3}`:`M ${we+Pe/2-6} ${a-13} L ${we+Pe/2} ${a-3} L ${we+Pe/2+6} ${a-13}`,Re=Ve+22,z=Ve+40,K=Ve+55,ye=Ve+70,_e=Fe?Ve+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:Fe?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Fe?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:We,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:we+Pe/2-120,y:Ve,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:we+Pe/2,y:Re,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:we+Pe/2-110,y:z,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:we+Pe/2-70,y:z,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:$e(e.startDate)}),jsx("text",{x:we+Pe/2-110,y:K,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:we+Pe/2-70,y:K,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:$e(e.endDate)}),jsx("text",{x:we+Pe/2+10,y:z,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:we+Pe/2+65,y:z,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Je()}),jsx("text",{x:we+Pe/2+10,y:K,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:we+Pe/2+65,y:K,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:we+Pe/2-110,y:ye,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:we+Pe/2-50,y:ye,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Xe=>Xe.name).join(", ").substring(0,30),e.assignees.map(Xe=>Xe.name).join(", ").length>30?"...":""]})]}),!Fe&&jsx("text",{x:we+Pe/2,y:_e,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:ke?"Left: move \u2022 Right: resize":ce?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function Wm({tooltipData:e,theme:t,locale:a="en"}){if(!e)return null;let {task:r,x:o,y:s,width:n,height:d,showBelow:m}=e,i=r.effortMinutes!=null||r.timeLoggedMinutes!=null||r.soldEffortMinutes!=null,c=i?130:82,l=13,p=m?s+d+l:s-c-l,f=m?`M ${o+n/2-6} ${s+d+3} L ${o+n/2} ${s+d+13} L ${o+n/2+6} ${s+d+3}`:`M ${o+n/2-6} ${s-13} L ${o+n/2} ${s-3} L ${o+n/2+6} ${s-13}`,v=p+22,w=p+40,g=p+55,y=p+70,h=p+90,b=p+105,x=p+120,N=C=>C.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),D=()=>{if(!r.startDate||!r.endDate)return "N/A";let C=Math.ceil((r.endDate.getTime()-r.startDate.getTime())/(1e3*60*60*24));return `${C} day${C!==1?"s":""}`},T=C=>{if(C==null||C===0)return "N/A";let W=Math.floor(C/60),B=C%60;return W===0?`${B}m`:B===0?`${W}h`:`${W}h ${B}m`},k={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:"};return jsx(AnimatePresence,{children:jsxs(motion.g,{initial:{opacity:0,y:m?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:m?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:f,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("rect",{x:o+n/2-120,y:p,width:240,height:c,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:o+n/2,y:v,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:r.name.length>28?`${r.name.substring(0,28)}...`:r.name}),jsx("text",{x:o+n/2-110,y:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.start}),jsx("text",{x:o+n/2-70,y:w,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.startDate?N(r.startDate):"N/A"}),jsx("text",{x:o+n/2-110,y:g,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.end}),jsx("text",{x:o+n/2-70,y:g,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.endDate?N(r.endDate):"N/A"}),jsx("text",{x:o+n/2+10,y:w,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.duration}),jsx("text",{x:o+n/2+65,y:w,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:D()}),jsx("text",{x:o+n/2+10,y:g,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.progress}),jsxs("text",{x:o+n/2+65,y:g,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.progress,"%"]}),r.assignees&&r.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.assignees}),jsxs("text",{x:o+n/2-50,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.assignees.map(C=>C.name).join(", ").substring(0,30),r.assignees.map(C=>C.name).join(", ").length>30?"...":""]})]}),i&&jsxs(Fragment,{children:[r.effortMinutes!=null&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.estimated}),jsx("text",{x:o+n/2-50,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:T(r.effortMinutes)})]}),r.timeLoggedMinutes!=null&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.logged}),jsx("text",{x:o+n/2-50,y:b,fill:t.accent,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",children:T(r.timeLoggedMinutes)})]}),r.soldEffortMinutes!=null&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y:x,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:k.quoted}),jsx("text",{x:o+n/2-50,y:x,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:T(r.soldEffortMinutes)})]})]})]})})}function Cs({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:d=false}){let[m,i]=useState(false),[c,l]=useState(null),p=r-t,f=p>0,v=Math.abs(p)<5,w=20,g=!v&&a<=e,y,h,b=a-e,x=e+b/2;if(h=x,n==="squared")if(v)y=`M ${e} ${t} L ${a} ${r}`;else if(g){let oe=e+15,Te=a-w,A=f?t+20:t-20;h=Te,y=`M ${e} ${t} L ${oe} ${t} L ${oe} ${A} L ${Te} ${A} L ${Te} ${r} L ${a} ${r}`;}else h=a-w,y=`M ${e} ${t} L ${h} ${t} L ${h} ${r} L ${a} ${r}`;else y=`M ${e} ${t} C ${x} ${t}, ${x} ${r}, ${a} ${r}`;let N=5,D=`M ${a} ${r} L ${a-N} ${r-N*.5} M ${a} ${r} L ${a-N} ${r+N*.5}`,T=o.dependency,k=o.dependencyHover||T,R="#f87171",I="rgba(248, 113, 113, 0.15)",C=h,W=(t+r)/2;if(c)if(v)C=Math.max(e+10,Math.min(a-10,c.x)),W=t;else if(g){let _=e+15,oe=a-w,Te=f?t+20:t-20,A=[[e,t,_,t],[_,t,_,Te],[_,Te,oe,Te],[oe,Te,oe,r],[oe,r,a,r]],Ee=1/0,L={x:C,y:W};for(let U of A){let E=B(c.x,c.y,U[0],U[1],U[2],U[3]),q=Math.hypot(c.x-E.x,c.y-E.y);q<Ee&&(Ee=q,L=E);}C=L.x,W=L.y;}else {let _=[[e,t,h,t],[h,t,h,r],[h,r,a,r]],oe=1/0,Te={x:C,y:W};for(let A of _){let Ee=B(c.x,c.y,A[0],A[1],A[2],A[3]),L=Math.hypot(c.x-Ee.x,c.y-Ee.y);L<oe&&(oe=L,Te=Ee);}C=Te.x,W=Te.y;}function B(_,oe,Te,A,Ee,L){let U=Ee-Te,E=L-A,q=U*U+E*E;if(q===0)return {x:Te,y:A};let ee=((_-Te)*U+(oe-A)*E)/q;return ee=Math.max(0,Math.min(1,ee)),{x:Te+ee*U,y:A+ee*E}}let Q=_=>{let oe=_.currentTarget.ownerSVGElement;if(!oe)return;let Te=oe.getBoundingClientRect();l({x:_.clientX-Te.left,y:_.clientY-Te.top});},S=()=>{i(false),l(null);};return d?jsxs("g",{"data-dependency-line":"true",onMouseLeave:S,onMouseMove:Q,children:[jsx("path",{d:y,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:y,fill:"none",stroke:k,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:y,fill:"none",stroke:k,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:D,fill:"none",stroke:k,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:k,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxs(motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:_=>{_.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:C,cy:W,r:9,fill:I,stroke:R,strokeWidth:1.5}),jsx("line",{x1:C-3,y1:W-3,x2:C+3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:C+3,y1:W-3,x2:C-3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:()=>i(true),onMouseLeave:S,onMouseMove:Q,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:y,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:y,fill:"none",stroke:m?k:T,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}}}),jsx(motion.path,{d:D,fill:"none",stroke:m?k:T,strokeWidth:m?2.5:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3}}),jsx(motion.circle,{cx:a,cy:r,r:m?4:3,fill:m?k:T,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15}}),m&&s&&jsxs(motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:_=>{_.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:C,cy:W,r:9,fill:I,stroke:R,strokeWidth:1.5}),jsx("line",{x1:C-3,y1:W-3,x2:C+3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:C+3,y1:W-3,x2:C-3,y2:W+3,stroke:R,strokeWidth:1.5,strokeLinecap:"round"})]})]})}function Ns({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=useState(false),d=16,m=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:d+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-d/2,y:a+16-d/2,width:d,height:d,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-(d+4)/2,y:a+16-(d+4)/2,width:d+4,height:d+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:m(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 xe={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(c=>{c.dependencies&&r.set(c.id,c.dependencies),c.subtasks&&o(c.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,d=new Set,m=i=>{if(!n.has(i)){n.add(i),d.add(i);let c=r.get(i)||[];for(let l of c){if(!n.has(l)&&m(l))return true;if(d.has(l))return true}}return d.delete(i),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=xe.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=xe.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=xe.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=xe.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(`
|
|
126
|
+
`)},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=xe.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=xe.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)=>xe.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=xe.findTaskById(e,t);return !a||!a.dependencies?[]:xe.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>xe.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>xe.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=xe.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=>xe.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=xe.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"]],d=s.map(m=>{let i=m.startDate&&m.endDate?xe.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?xe.formatDate(m.startDate):"N/A",m.endDate?xe.formatDate(m.endDate):"N/A",i>0?`${i} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:n,body:d,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="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=xe.flattenTasks(e).map(m=>{let i=m.startDate&&m.endDate?xe.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?xe.formatDate(m.startDate):"","End Date":m.endDate?xe.formatDate(m.endDate):"","Duration (days)":i>0?i:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(c=>c.name).join(", ")||"",Dependencies:m.dependencies?.join(", ")||"","Is Milestone":m.isMilestone?"Yes":"No","Parent ID":m.parentId||"",Level:m.level||0}}),s=a.utils.json_to_sheet(o),n=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=n;let d=a.utils.book_new();a.utils.book_append_sheet(d,s,"Gantt Tasks"),a.writeFile(d,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=xe.flattenTasks(e),o=new Map;r.forEach((p,f)=>{o.set(p.id,f+1);});let s=p=>p.toISOString().replace("Z",""),n=xe.getEarliestStartDate(e)||new Date,d=xe.getLatestEndDate(e)||new Date,m=r.map((p,f)=>{let v=o.get(p.id),w=p.startDate&&p.endDate?xe.calculateDuration(p.startDate,p.endDate):0,g=(p.dependencies||[]).filter(y=>o.has(y)).map(y=>`
|
|
127
127
|
<PredecessorLink>
|
|
128
128
|
<PredecessorUID>${o.get(y)}</PredecessorUID>
|
|
129
129
|
<Type>1</Type>
|
|
@@ -215,7 +215,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
215
215
|
<LastSaved>${s(new Date)}</LastSaved>
|
|
216
216
|
<ScheduleFromStart>1</ScheduleFromStart>
|
|
217
217
|
<StartDate>${s(n)}</StartDate>
|
|
218
|
-
<FinishDate>${s(
|
|
218
|
+
<FinishDate>${s(d)}</FinishDate>
|
|
219
219
|
<FYStartDate>1</FYStartDate>
|
|
220
220
|
<CriticalSlackLimit>0</CriticalSlackLimit>
|
|
221
221
|
<CurrencyDigits>2</CurrencyDigits>
|
|
@@ -351,11 +351,11 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
351
351
|
</WeekDays>
|
|
352
352
|
</Calendar>
|
|
353
353
|
</Calendars>
|
|
354
|
-
<Tasks>${
|
|
354
|
+
<Tasks>${m}
|
|
355
355
|
</Tasks>
|
|
356
|
-
</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=ve.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?ve.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let f of i.dependencies){let v=t.find(w=>w.id===f);if(v){o(v);let w=r.get(f)?.ef||0;d=Math.max(d,w);}}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?ve.calculateDuration(i.startDate,i.endDate):0,d=t.filter(v=>v.dependencies&&v.dependencies.includes(i.id)),p=s;if(d.length>0)for(let v of d){l(v);let w=n.get(v.id)?.ls||0;p=Math.min(p,w);}let f=p-m;n.set(i.id,{ls:f,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},calculateSlack:(e,t)=>{let a=ve.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ve.calculateCriticalPath(e).includes(t))return 0;let o=ve.getDependentTasks(e,t);if(o.length===0){let l=ve.getLatestEndDate(e);if(!l)return null;let c=ve.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=ve.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>ve.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ve.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ve.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let l=ve.calculateDuration(n.startDate,n.endDate),c;a!==void 0?(c=new Date(n.startDate),c.setDate(c.getDate()+a)):(c=new Date(r.endDate),c.setDate(c.getDate()+1));let i=ve.calculateEndDate(c,l),m=d=>d.map(p=>p.id===n.id?{...p,startDate:c,endDate:i}:p.subtasks?{...p,subtasks:m(p.subtasks)}:p);s=m(s),s=ve.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let c=[],i=o.getTime(),m=1e3*60*60*24,d=ve.findTaskById(e,t);if(!d||!d.endDate)return [];let p=(f,v,w=new Set)=>{if(w.has(f))return;w.add(f);let g=ve.getDependentTasks(e,f);for(let y of g){if(!y.startDate||!y.endDate)continue;let h=r.findIndex(C=>C.id===y.id);if(h===-1)continue;let b=y.startDate.getTime(),N=(y.endDate.getTime()-b)/m,T=(b-i)/m*s,k=T+v*s,O=Math.max(N*s,s),I=l+h*n+12;c.push({taskId:y.id,taskName:y.name,originalX:T,previewX:k,width:O,y:I,rowIndex:h,daysDelta:v,color:y.color}),p(y.id,v,w);}};return p(t,a),c},splitTask:(e,t,a,r=3)=>{let o=ve.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 Ss({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:c,dependencyLineStyle:i="curved",onTaskClick:m,onTaskDblClick:d,onTaskContextMenu:p,onTaskDateChange:f,onDependencyCreate:v,onDependencyDelete:w}){let y=Zr(),[h,b]=useState([]),[x,N]=useState(null),D=useCallback(L=>{N(L);},[]),T=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),k=r==="day"?60:r==="week"?20:8,O=T*k*n,I=L=>{let U=new Date(Date.UTC(L.getFullYear(),L.getMonth(),L.getDate())),E=U.getUTCDay()||7;U.setUTCDate(U.getUTCDate()+4-E);let q=new Date(Date.UTC(U.getUTCFullYear(),0,1));return Math.ceil(((U.getTime()-q.getTime())/864e5+1)/7)},C=L=>{let U=L.getDay();return U===0||U===6},H=useCallback(L=>{let U=Math.round(L/(k*n)),E=new Date(o);return E.setDate(E.getDate()+U),E},[o,k,n]),R=useCallback((L,U)=>{if(U.startDate&&U.endDate)return;let E=L.currentTarget.ownerSVGElement;if(!E)return;let q=E.createSVGPoint();q.x=L.clientX,q.y=L.clientY;let ee=q.matrixTransform(E.getScreenCTM()?.inverse()),fe=H(ee.x),ue=new Date(fe);ue.setDate(ue.getDate()+1),f?.(U,fe,ue);},[H,f]),Q=useMemo(()=>{let L=ee=>ee.map(fe=>{if(fe.subtasks&&fe.subtasks.length>0){let ue=L(fe.subtasks),pe=ue.filter(Oe=>Oe.startDate&&Oe.endDate);if(pe.length>0){let Oe=pe.map(qe=>qe.startDate.getTime()),ae=pe.map(qe=>qe.endDate.getTime()),nt=new Date(Math.min(...Oe)),Fe=new Date(Math.max(...ae));return {...fe,subtasks:ue,startDate:nt,endDate:Fe}}return {...fe,subtasks:ue}}return fe}),U=(ee,fe=[])=>{for(let ue of ee)fe.push(ue),ue.subtasks&&ue.subtasks.length>0&&(ue.isExpanded===void 0||ue.isExpanded)&&U(ue.subtasks,fe);return fe},E=L(e);return U(E)},[e]),S=useCallback(L=>{if(!L.startDate||!L.endDate)return {x:0,width:0};let U=L.startDate.getTime(),E=L.endDate.getTime(),q=o.getTime(),ee=(U-q)/(1e3*60*60*24),fe=(E-U)/(1e3*60*60*24),ue=ee*k*n,pe=Math.max(k*n,40),Oe=Math.max(fe*k*n,pe);return {x:ue,width:Oe}},[o,k,n]),G=useMemo(()=>Q.filter(L=>L.startDate&&L.endDate).map(L=>{let{x:U,width:E}=S(L),ee=Q.findIndex(fe=>fe.id===L.id)*a+14;return {id:L.id,x:U,y:ee,width:E,height:24}}),[Q,S]),ne=useCallback((L,U,E)=>{if(!E||U===0){b([]);return}let q=ve.calculateCascadePreview(e,L,U,Q,o,k*n,a,48);b(q);},[e,Q,o,k,n,a,48]),Ce=useMemo(()=>{let L=[],U=new Date(o);for(;U<=s;){let ee=(U.getTime()-o.getTime())/864e5*k*n;if(r==="day")L.push({date:new Date(U),label:U.toLocaleDateString(l,{day:"numeric",month:"short"}),x:ee}),U.setDate(U.getDate()+1);else if(r==="week"){let fe=I(U);L.push({date:new Date(U),label:`${y.labels.week} ${fe}`,x:ee}),U.setDate(U.getDate()+7);}else L.push({date:new Date(U),label:U.toLocaleDateString(l,{month:"short",year:"numeric"}),x:ee}),U.setMonth(U.getMonth()+1);}return L},[o,s,r,k,n,l,y.labels.week]),A=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*k*n,[o,k,n]),Pe=Math.max(Q.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.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(O,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(O,1e3),height:48,fill:t.bgGrid}),Ce.map((L,U)=>jsxs("g",{children:[U>0&&jsx("line",{x1:L.x,y1:0,x2:L.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:L.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:L.label})]},`header-${U}`)),A>=0&&A<=O&&jsx("circle",{cx:A,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxs("svg",{width:Math.max(O,1e3),height:Pe,style:{display:"block",flexShrink:0,overflow:"visible"},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("rect",{x:0,y:0,width:Math.max(O,1e3),height:Pe,fill:t.bgPrimary}),Ce.map((L,U)=>{let E=Ce[U+1]?.x||O,q=C(L.date);return jsxs("g",{children:[q&&jsx("rect",{x:L.x,y:0,width:E-L.x,height:Q.length*a,fill:t.bgWeekend,opacity:1}),U>0&&jsx("line",{x1:L.x,y1:0,x2:L.x,y2:Q.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},U)}),Q.map((L,U)=>{let E=L.startDate&&L.endDate;return jsxs("g",{children:[jsx("rect",{x:0,y:U*a,width:O,height:a,fill:U%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${L.id}`),!E&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:U*a,width:O,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:q=>R(q,L),onMouseEnter:q=>{q.currentTarget.setAttribute("fill",t.accentLight),q.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:q=>{q.currentTarget.setAttribute("fill","transparent"),q.currentTarget.setAttribute("opacity","1");}},`clickable-${L.id}`),jsx("text",{x:A>0?A:100,y:U*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:y.labels.clickToSetDates},`placeholder-${L.id}`)]})]},`row-group-${L.id}`)}),Q.map((L,U)=>{if(!L.startDate||!L.endDate)return null;let{x:E,width:q}=S(L),ee=U*a+14,fe=L.subtasks&&L.subtasks.length>0&&!L.isMilestone;return L.isMilestone?jsx(Ns,{task:L,x:E+q/2,y:ee+12,theme:t,onClick:m},L.id):fe?jsxs("g",{onClick:()=>m?.(L),onContextMenu:ue=>{ue.preventDefault(),ue.stopPropagation(),p?.(L,ue);},style:{cursor:"default"},children:[jsx("rect",{x:E,y:ee,width:q,height:32,fill:t.primary,opacity:.25,rx:6}),jsx("line",{x1:E,y1:ee,x2:E+q,y2:ee,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:E,y1:ee,x2:E,y2:ee+24,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:E+q,y1:ee,x2:E+q,y2:ee+24,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:E,y1:ee+24,x2:E+q,y2:ee+24,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),q>60&&jsx("text",{x:E+12,y:ee+12,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:L.name})]},L.id):jsx(ks,{task:L,x:E,y:ee,width:q,theme:t,dayWidth:k*n,startDate:o,templates:c,onClick:m,onDoubleClick:d,onContextMenu:p,onDateChange:f,onDependencyCreate:v,allTaskPositions:G,onDragMove:ne,onHoverChange:D},L.id)}),Q.map((L,U)=>!L.dependencies||L.dependencies.length===0||!L.startDate||!L.endDate?null:L.dependencies.map(E=>{let q=Q.find(Fe=>Fe.id===E);if(!q||!q.startDate||!q.endDate)return null;let ee=Q.findIndex(Fe=>Fe.id===E),fe=S(q),ue=S(L),pe=fe.x+fe.width,Oe=ee*a+26,ae=ue.x,nt=U*a+26;return jsx(Cs,{x1:pe,y1:Oe,x2:ae,y2:nt,theme:t,lineStyle:i,onDelete:()=>w?.(L.id,E)},`dep-${E}-${L.id}`)})),h.map(L=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:L.previewX,y:L.y-48,width:L.width,height:32,rx:8,fill:L.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(L.daysDelta)>0&&jsx("text",{x:L.previewX+L.width/2,y:L.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:L.daysDelta>0?`+${L.daysDelta}d`:`${L.daysDelta}d`})]},`cascade-preview-${L.taskId}`)),A>=0&&A<=O&&jsx("line",{x1:A,y1:0,x2:A,y2:Pe,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),x&&jsx(Wm,{tooltipData:x,theme:t,locale:l==="es"?"es":"en"})]})]})}var vy=['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"'],jm=()=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsx("circle",{cx:"12",cy:"12",r:"4"})]}),xy=()=>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"})}),ky=()=>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"})}),wy=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Cy=()=>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 Es({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),[f,v]=useState([]),[w,g]=useState(""),[y,h]=useState(false),[b,x]=useState(true),N=useRef(null),D=useRef(null),T=useRef(null),{enabled:k=true,placeholder:O='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:I="bottom-right",onCommand:C,suggestions:H=vy,maxHistory:R=50,persistHistory:Q}=a,S=Q?.storageKey||"gantt-ai-history",G=Q?.maxMessages??5;useEffect(()=>{if(Q?.enabled)try{let U=localStorage.getItem(S);if(U){let q=JSON.parse(U).map(ee=>({...ee,timestamp:new Date(ee.timestamp)}));v(q.slice(-G));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[Q?.enabled,S,G]),useEffect(()=>{if(Q?.enabled&&f.length>0)try{let U=f.filter(E=>!E.isLoading).slice(-G);localStorage.setItem(S,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[f,Q?.enabled,S,G]),useEffect(()=>{D.current&&D.current.scrollIntoView({behavior:"smooth"});},[f]),useEffect(()=>{i&&!d&&N.current&&setTimeout(()=>N.current?.focus(),100);},[i,d]);let ne=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]),Ce=useCallback(async U=>{if(!U.trim()||y)return;let E={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};v(ee=>[...ee.slice(-(R-1)),E]),g(""),x(false),h(true);let q={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(ee=>[...ee,q]);try{if(C){let ee=await C(U,e);v(fe=>{let ue=fe.filter(Oe=>!Oe.isLoading),pe={id:`assistant-${Date.now()}`,role:"assistant",content:ee.message,timestamp:new Date,command:ee};return [...ue,pe]}),ne(ee);}else v(ee=>[...ee.filter(ue=>!ue.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(ee){v(fe=>[...fe.filter(pe=>!pe.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${ee instanceof Error?ee.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[y,R,C,e,ne]),A=U=>{U.preventDefault(),Ce(w);},Pe=U=>{g(U),N.current?.focus();};if(useEffect(()=>{let U=E=>{(E.metaKey||E.ctrlKey)&&E.key==="k"&&(E.preventDefault(),m(q=>!q),i||p(false)),E.key==="Escape"&&i&&m(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[i]),useEffect(()=>{if(!i)return;let U=q=>{let ee=q.target;T.current&&!T.current.contains(ee)&&m(false);},E=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(E),document.removeEventListener("mousedown",U);}},[i]),!k)return null;let L={"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(ht,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${L[I]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>m(true),children:[jsx(jm,{}),jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:T,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 ${L[I]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsx(jm,{}),jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>p(U=>!U),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(wy,{})}),jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(ky,{})})]})]}),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:[f.length===0&&b&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:H.slice(0,4).map((U,E)=>jsx("button",{onClick:()=>Pe(U),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:U.length>30?U.slice(0,30)+"...":U},E))})]}),f.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"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:U.role==="user"?"white":t.textPrimary},children:[U.isLoading?jsx(Cy,{}):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.2)":"rgba(239, 68, 68, 0.2)",color:U.command.success?"#10B981":"#EF4444"},children:[U.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:U.command.type.replace(/_/g," ")})]})]})},U.id)),jsx("div",{ref:D})]}),jsxs("form",{onSubmit:A,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsx("input",{ref:N,type:"text",value:w,onChange:U=>g(U.target.value),placeholder:O,disabled:y,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsx("button",{type:"submit",disabled:!w.trim()||y,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:w.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:w.trim()?"white":t.textSecondary},children:jsx(xy,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Km(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 f=[...d.past,d.present];return f.length>t&&f.shift(),{past:f,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 qm({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 Sy={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ve.formatDate(e.startDate)} - ${ve.formatDate(e.endDate)}`);let a=ve.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=>ve.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Ym(e){return {...Sy,...e}}var By=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Zm=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:c=true,showExportButton:i=true,availableUsers:m=[],templates:d,enableAutoCriticalPath:p=true,persistExpandedState:f,persistFilter:v,clearFiltersKey:w,aiAssistant:g,locale:y="en",customTranslations:h,showCreateTaskButton:b=false,createTaskLabel:x,onCreateTask:N,taskFilter:D,onTaskFilterChange:T,onThemeChange:k,onTaskClick:O,onTaskDblClick:I,onTaskContextMenu:C,onTaskUpdate:H,onProgressChange:R,onTaskEdit:Q,onTaskAddSubtask:S,onTaskMarkIncomplete:G,onTaskSetInProgress:ne,onDependencyCreate:Ce,onDependencyDelete:A,onBeforeTaskAdd:Pe,onAfterTaskAdd:L,onBeforeTaskUpdate:U,onAfterTaskUpdate:E,onBeforeTaskDelete:q,onAfterTaskDelete:ee}=a,ue=useContext(ms)?.theme,[pe,Oe]=useState(ue||s||"dark"),[ae,nt]=useState(n),[Fe,qe]=useState(l),[ut,St]=useState(1),je=useCallback(()=>v?typeof v=="string"?v:"gantt-filter-state":null,[v]),[Ft,it]=useState(()=>{if(!v)return "all";try{let P=typeof v=="string"?v:"gantt-filter-state",F=localStorage.getItem(P);if(F){let K=JSON.parse(F);if(K.taskFilter)return K.taskFilter}}catch(P){console.warn("[GanttBoard] Error loading filter state from localStorage:",P);}return "all"}),pt=D??Ft,ie=T??it,[B,Z]=useState(()=>{if(!v)return false;try{let P=typeof v=="string"?v:"gantt-filter-state",F=localStorage.getItem(P);if(F){let K=JSON.parse(F);if(typeof K.hideCompleted=="boolean")return K.hideCompleted}}catch(P){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",P);}return false});useEffect(()=>{let P=je();if(P)try{let F={taskFilter:pt,hideCompleted:B};localStorage.setItem(P,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving filter state to localStorage:",F);}},[pt,B,je]);let ce=useRef(w);useEffect(()=>{if(ce.current!==w&&w!==void 0){it("all"),Z(false);let P=je();if(P)try{localStorage.removeItem(P);}catch(F){console.warn("[GanttBoard] Error clearing filter state from localStorage:",F);}}ce.current=w;},[w,je]);let[ke,$e]=useState(0),[Xe,at]=useState(false),[ze,oa]=useState(null),[W,Y]=useState({isOpen:false,x:0,y:0,task:null}),[be,Ye]=useState(null),[Te,De]=useState(null);useEffect(()=>{ue&&ue!==pe&&Oe(ue);},[ue]),useEffect(()=>{s&&s!==pe&&Oe(s);},[s]);let X=useCallback(P=>{Oe(P),k?.(P);},[k]),{state:re,setState:_,undo:Ie,redo:Ae,canUndo:Ge,canRedo:He,clearHistory:Be}=Km(t,50),z=useCallback(()=>f?typeof f=="string"?f:"gantt-expanded-tasks":null,[f]),j=useRef(new Map),ye=useRef(false);if(!ye.current&&f){ye.current=true;let P=typeof f=="string"?f:"gantt-expanded-tasks";try{let F=localStorage.getItem(P);if(F){let K=JSON.parse(F);Array.isArray(K)&&(j.current=new Map(K));}}catch(F){console.warn("[GanttBoard] Error loading expanded state from localStorage:",F);}}let Ve=useCallback(()=>{let P=z();if(P)try{let F=Array.from(j.current.entries());localStorage.setItem(P,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving expanded state to localStorage:",F);}},[z]);useEffect(()=>{let P=K=>{let se=new Map;for(let me of K){let xe=me.id;se.get(xe)||se.set(xe,me);}return Array.from(se.values())},F=K=>K.map(se=>{let me=j.current.get(se.id),xe=me!==void 0?{...se,isExpanded:me}:se;if(xe.subtasks?.length){let Tt=P(xe.subtasks);return {...xe,subtasks:F(Tt)}}return xe});if(j.current.size>0)_(F(t));else {let K=se=>se.map(me=>me.subtasks?.length?{...me,subtasks:P(K(me.subtasks))}:me);_(K(t));}},[t,_]);let Ke=useRef(t),V=useRef(true);useEffect(()=>{if(V.current){V.current=false,Ke.current=re;return}if(!r)return;let P=JSON.stringify(Ke.current),F=JSON.stringify(re);P!==F&&(Ke.current=re,r(re));},[re,r]);let le=useMemo(()=>sl(y,h),[y,h]),_e=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}],[]),[yt,lt]=useState(()=>_e(le));useEffect(()=>{lt(P=>P.map(F=>({...F,label:le.columns[F.id==="name"?"taskName":F.id]||F.label})));},[le]);let sr=useMemo(()=>yt.filter(F=>F.visible).reduce((F,K)=>F+K.width,0),[yt]),xr=useRef(yt.filter(P=>P.visible).map(P=>P.id).join(","));useEffect(()=>{let P=yt.filter(se=>se.visible),F=P.map(se=>se.id).join(","),K=xr.current;if(F!==K){let se=P.some(xe=>xe.id!=="name"),me=K.includes(",");se?!me&&se&&oa(null):oa(null),xr.current=F;}},[yt]);let ir=60,Xa=.6,Ne=useMemo(()=>{let F=sr+ir,K=typeof window<"u"?window.innerWidth*Xa:800,se=Math.max(F,K);return ze!==null?Math.max(200,Math.min(ze,se)):Math.max(200,F)},[ze,sr]),vt=useRef(null),At=useRef(null),Ja=useRef(null),Et=useMemo(()=>ym(pe),[pe]),zr=useMemo(()=>({theme:Et,themeName:pe}),[Et,pe]),Za=useMemo(()=>Ym(d),[d]),M=useMemo(()=>{if(!p)return re;let P=ve.calculateCriticalPath(re),F=K=>K.map(se=>({...se,isCriticalPath:P.includes(se.id),subtasks:se.subtasks?F(se.subtasks):void 0}));return F(re)},[re,p]),oe=useMemo(()=>{if(pt==="all"&&!B)return M;let P=F=>{let K=[];for(let se of F){let me=se.subtasks?.length?P(se.subtasks):void 0,xe=false;if(B)xe=se.progress<100;else switch(pt){case "all":xe=true;break;case "incomplete":xe=se.progress<100;break;case "in_progress":xe=se.progress>0&&se.progress<100;break;case "completed":xe=se.progress===100;break}(xe||me&&me.length>0)&&K.push({...se,subtasks:me});}return K};return P(M)},[M,pt,B]),Re=By(Fe);qm({undo:Ie,redo:Ae,canUndo:Ge,canRedo:He,enabled:true}),useImperativeHandle(o,()=>({getTask:P=>ve.findTaskById(re,P),addTask:(P,F)=>{_(K=>{if(!F)return [...K,{...P,level:0}];let se=me=>me.map(xe=>xe.id===F?{...xe,subtasks:[...xe.subtasks||[],{...P,parentId:F,level:(xe.level||0)+1}],isExpanded:true}:xe.subtasks?{...xe,subtasks:se(xe.subtasks)}:xe);return se(K)});},updateTask:(P,F)=>{_(K=>{let se=me=>me.map(xe=>xe.id===P?{...xe,...F}:xe.subtasks?{...xe,subtasks:se(xe.subtasks)}:xe);return se(K)});},deleteTask:P=>{_(F=>{let K=se=>se.filter(me=>me.id===P?false:(me.subtasks&&(me.subtasks=K(me.subtasks)),true));return K(F)});},deleteTasks:P=>{_(F=>bl(F,P));},duplicateTask:P=>{_(F=>hs(F,[P]));},splitTask:(P,F,K=3)=>{_(se=>ve.splitTask(se,P,F,K));},calculateEndDate:ve.calculateEndDate,calculateDuration:ve.calculateDuration,validateDependency:(P,F)=>!ve.validateDependencies(re,P,F),getAllTasks:()=>ve.flattenTasks(re),getTasksByStatus:P=>ve.flattenTasks(re).filter(F=>F.status===P),getTasksByParent:P=>P?ve.findTaskById(re,P)?.subtasks||[]:re.filter(K=>!K.parentId),getCriticalPath:()=>ve.flattenTasks(re).filter(P=>P.isCriticalPath),indentTask:P=>{_(F=>gl(F,[P]));},outdentTask:P=>{_(F=>fl(F,[P]));},moveTask:(P,F)=>{_(K=>hl(K,[P],F));},createSubtask:async P=>{let{tasks:F,newTask:K}=xl(re,P);if(Pe){let se=Pe({...K,parentId:P});if((se instanceof Promise?await se:se)===false)return}_(F),L&&L({...K,parentId:P});},scrollToTask:P=>{let K=ve.flattenTasks(re).findIndex(se=>se.id===P);if(K!==-1&&vt.current){let se=K*Re;vt.current.scrollTo({top:se,behavior:"smooth"}),At.current&&At.current.scrollTo({top:se,behavior:"smooth"});}},highlightTask:(P,F=2e3)=>{},expandTask:P=>{_(F=>{let K=se=>se.map(me=>me.id===P?{...me,isExpanded:true}:me.subtasks?{...me,subtasks:K(me.subtasks)}:me);return K(F)});},collapseTask:P=>{_(F=>{let K=se=>se.map(me=>me.id===P?{...me,isExpanded:false}:me.subtasks?{...me,subtasks:K(me.subtasks)}:me);return K(F)});},expandAll:()=>{_(P=>{let F=K=>K.map(se=>({...se,isExpanded:true,subtasks:se.subtasks?F(se.subtasks):void 0}));return F(P)});},collapseAll:()=>{_(P=>{let F=K=>K.map(se=>({...se,isExpanded:false,subtasks:se.subtasks?F(se.subtasks):void 0}));return F(P)});},undo:Ie,redo:Ae,canUndo:()=>Ge,canRedo:()=>He,clearHistory:Be,exportToPNG:async()=>{if(!Ja.current||!vt.current||!At.current)throw new Error("Gantt container not found");let P=Ja.current,F=vt.current.querySelector(".gantt-grid-scroll"),K=At.current,se=F?.scrollTop||0,me=K.scrollTop,xe=P.style.overflow,Tt=P.style.height;try{let gt=F?.querySelector(".gantt-taskgrid-content"),jt=K.querySelector("svg"),Da=gt?.scrollHeight||F?.scrollHeight||600,Pa=jt?.getBoundingClientRect().height||K.scrollHeight,so=(P.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(Da,Pa)+20;F&&(F.scrollTop=0),K.scrollTop=0,P.style.overflow="visible",P.style.height=`${so}px`,await new Promise(Hr=>setTimeout(Hr,100));let kr=await Jm(P,{backgroundColor:Et.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:Hr=>{let Mo=window.getComputedStyle(Hr),io=parseInt(Mo.zIndex,10);return !isNaN(io)&&io>=50||Mo.position==="fixed"}});return new Promise((Hr,Mo)=>{kr.toBlob(io=>{io?Hr(io):Mo(new Error("Failed to create blob from canvas"));},"image/png");})}finally{P.style.overflow=xe,P.style.height=Tt,F&&(F.scrollTop=se),K.scrollTop=me;}},exportToPDF:async P=>{await ve.exportToPDF(re,P);},exportToExcel:async P=>{await ve.exportToExcel(re,P);},exportToJSON:()=>ve.exportToJSON(re),exportToCSV:()=>ve.exportToCSV(re),importFromJSON:P=>{let F=ve.importFromJSON(P);_(F);},getTasks:()=>re,refresh:()=>{_(P=>[...P]);},clearAll:()=>{_([]);}}),[re,Ie,Ae,Ge,He,Be,Et,Re]);let Je=useCallback(P=>{lt(F=>F.map(K=>K.id===P?{...K,visible:!K.visible}:K));},[]),la=useCallback((P,F)=>{lt(K=>K.map(se=>{if(se.id!==P)return se;let me=se.minWidth??100,xe=se.maxWidth??800,Tt=Math.max(me,Math.min(xe,F));return {...se,width:Tt}}));},[]),ha=useCallback(P=>{_(F=>{let K=vl(F,P),se=me=>{for(let xe of me){if(xe.id===P){j.current.set(P,xe.isExpanded??true);return}xe.subtasks?.length&&se(xe.subtasks);}};return se(K),Ve(),K}),a.onTaskToggleExpand?.(P);},[a,Ve]),Zt=useCallback((P,F)=>{if(U&&U(P,F)===false)return;let se=ve.findTaskById(re,P)?.progress,me=Tt=>Tt.map(gt=>gt.id===P?{...gt,...F}:gt.subtasks?{...gt,subtasks:me(gt.subtasks)}:gt);_(me(re));let xe=ve.findTaskById(me(re),P);xe&&(H?.(xe),E?.(xe),F.progress!==void 0&&se!==void 0&&F.progress!==se&&R?.(P,se,F.progress));},[re,H,U,E,R]),lr=useCallback(P=>{P.length!==0&&(_(F=>gl(F,P)),a.onTaskIndent?.(P[0]));},[a]),Na=useCallback(P=>{P.length!==0&&(_(F=>fl(F,P)),a.onTaskOutdent?.(P[0]));},[a]),Ea=useCallback((P,F,K)=>{_(se=>Im(se,P,F,K)),a.onTaskReparent?.(P,F,K);},[a]),en=useCallback((P,F)=>{P.length!==0&&(_(K=>hl(K,P,F)),a.onTaskMove?.(P[0],F));},[a]),Qs=useCallback(async P=>{let F=[];for(let K of P)q&&await Promise.resolve(q(K))===false||F.push(K);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(_(K=>bl(K,F)),F.forEach(K=>a.onTaskDelete?.(K))),ee&&F.forEach(K=>ee(K)));},[a,q,ee]),hg=useCallback(P=>{_(F=>hs(F,P)),P.forEach(F=>a.onTaskDuplicate?.(F));},[a]),bg=useCallback((P,F)=>{_(K=>{let{tasks:se,newTask:me}=Lm(K,P,F);return Pe&&Pe(me)===false?K:(a.onTaskCreate?.(me.parentId,me.position||0),L?.(me),se)});},[a,Pe,L]),yg=useCallback((P,F)=>{_(K=>yl(K,P,F)),a.onTaskRename?.(P,F);},[a]),ei=useCallback(P=>{_(F=>{let{tasks:K}=xl(F,P);return a.onTaskCreate?.(P,0),K});},[a]),vg=useCallback((P,F,K)=>{let se=P.startDate?Math.round((F.getTime()-P.startDate.getTime())/864e5):0,me=gt=>gt.map(jt=>jt.id===P.id?{...jt,startDate:F,endDate:K,...P.segments&&{segments:P.segments}}:jt.subtasks?{...jt,subtasks:me(jt.subtasks)}:jt),xe=me(re);xe=ve.autoScheduleDependents(xe,P.id,se),_(xe);let Tt={...P,startDate:F,endDate:K};H?.(Tt);},[re,H]),xg=useCallback((P,F)=>{C?.(P,F),Y({isOpen:true,x:F.clientX,y:F.clientY,task:P});},[C]),kg=useCallback((P,F)=>{let K=ve.splitTask(re,P.id,F);_(K),Y({isOpen:false,x:0,y:0,task:null});},[re]),Pd=useCallback(P=>{let F=ve.findTaskById(re,P.id)||P;I?.(F),Q||Ye(F);},[re,I,Q]),Md=useCallback((P,F,K)=>{let se=new Map,me=Da=>{Da.forEach(Pa=>{Pa.dependencies&&se.set(Pa.id,Pa.dependencies),Pa.subtasks&&me(Pa.subtasks);});};me(K);let xe=se.get(F)||[];se.set(F,[...xe,P]);let Tt=new Set,gt=new Set,jt=Da=>{if(!Tt.has(Da)){Tt.add(Da),gt.add(Da);let Pa=se.get(Da)||[];for(let Ur of Pa){if(!Tt.has(Ur)&&jt(Ur))return true;if(gt.has(Ur))return true}}return gt.delete(Da),false};return jt(F)},[]),Fd=useCallback((P,F)=>{if(Md(P.id,F,re)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
356
|
+
</Project>`,c=new Blob([i],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(c),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=xe.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 c=i.startDate&&i.endDate?xe.calculateDuration(i.startDate,i.endDate):0,l=0;if(i.dependencies&&i.dependencies.length>0)for(let f of i.dependencies){let v=t.find(w=>w.id===f);if(v){o(v);let w=r.get(f)?.ef||0;l=Math.max(l,w);}}let p=l+c;r.set(i.id,{es:l,ef:p});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,d=i=>{if(n.has(i.id))return;let c=i.startDate&&i.endDate?xe.calculateDuration(i.startDate,i.endDate):0,l=t.filter(v=>v.dependencies&&v.dependencies.includes(i.id)),p=s;if(l.length>0)for(let v of l){d(v);let w=n.get(v.id)?.ls||0;p=Math.min(p,w);}let f=p-c;n.set(i.id,{ls:f,lf:p});};a.forEach(d);let m=[];for(let i of a){let c=r.get(i.id),l=n.get(i.id);if(c&&l){let p=l.ls-c.es;Math.abs(p)<.01&&m.push(i.id);}}return m},calculateSlack:(e,t)=>{let a=xe.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(xe.calculateCriticalPath(e).includes(t))return 0;let o=xe.getDependentTasks(e,t);if(o.length===0){let d=xe.getLatestEndDate(e);if(!d)return null;let m=xe.calculateDuration(a.endDate,d);return Math.max(0,m)}let s=o.filter(d=>d.startDate).map(d=>d.startDate.getTime()).sort((d,m)=>d-m)[0];if(!s)return null;let n=xe.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>xe.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=xe.findTaskById(e,t);if(!r||!r.endDate)return e;let o=xe.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let d=xe.calculateDuration(n.startDate,n.endDate),m;a!==void 0?(m=new Date(n.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let i=xe.calculateEndDate(m,d),c=l=>l.map(p=>p.id===n.id?{...p,startDate:m,endDate:i}:p.subtasks?{...p,subtasks:c(p.subtasks)}:p);s=c(s),s=xe.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,d)=>{if(a===0)return [];let m=[],i=o.getTime(),c=1e3*60*60*24,l=xe.findTaskById(e,t);if(!l||!l.endDate)return [];let p=(f,v,w=new Set)=>{if(w.has(f))return;w.add(f);let g=xe.getDependentTasks(e,f);for(let y of g){if(!y.startDate||!y.endDate)continue;let h=r.findIndex(C=>C.id===y.id);if(h===-1)continue;let b=y.startDate.getTime(),N=(y.endDate.getTime()-b)/c,T=(b-i)/c*s,k=T+v*s,R=Math.max(N*s,s),I=d+h*n+12;m.push({taskId:y.id,taskName:y.name,originalX:T,previewX:k,width:R,y:I,rowIndex:h,daysDelta:v,color:y.color}),p(y.id,v,w);}};return p(t,a),m},splitTask:(e,t,a,r=3)=>{let o=xe.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 d=new Date(o.endDate);d.setDate(d.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:d}],i=c=>c.map(l=>l.id===o.id?{...l,endDate:d,segments:m}:l.subtasks?{...l,subtasks:i(l.subtasks)}:l);return i(e)}};function Ss({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:d="en",templates:m,dependencyLineStyle:i="curved",onTaskClick:c,onTaskDblClick:l,onTaskContextMenu:p,onTaskDateChange:f,onDependencyCreate:v,onDependencyDelete:w}){let y=Zr(),[h,b]=useState([]),[x,N]=useState(null),D=useCallback(L=>{N(L);},[]),T=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),k=r==="day"?60:r==="week"?20:8,R=T*k*n,I=L=>{let U=new Date(Date.UTC(L.getFullYear(),L.getMonth(),L.getDate())),E=U.getUTCDay()||7;U.setUTCDate(U.getUTCDate()+4-E);let q=new Date(Date.UTC(U.getUTCFullYear(),0,1));return Math.ceil(((U.getTime()-q.getTime())/864e5+1)/7)},C=L=>{let U=L.getDay();return U===0||U===6},W=useCallback(L=>{let U=Math.round(L/(k*n)),E=new Date(o);return E.setDate(E.getDate()+U),E},[o,k,n]),B=useCallback((L,U)=>{if(U.startDate&&U.endDate)return;let E=L.currentTarget.ownerSVGElement;if(!E)return;let q=E.createSVGPoint();q.x=L.clientX,q.y=L.clientY;let ee=q.matrixTransform(E.getScreenCTM()?.inverse()),de=W(ee.x),he=new Date(de);he.setDate(he.getDate()+1),f?.(U,de,he);},[W,f]),Q=useMemo(()=>{let L=ee=>ee.map(de=>{if(de.subtasks&&de.subtasks.length>0){let he=L(de.subtasks),ge=he.filter(Le=>Le.startDate&&Le.endDate);if(ge.length>0){let Le=ge.map(Ke=>Ke.startDate.getTime()),re=ge.map(Ke=>Ke.endDate.getTime()),Qe=new Date(Math.min(...Le)),Ie=new Date(Math.max(...re));return {...de,subtasks:he,startDate:Qe,endDate:Ie}}return {...de,subtasks:he}}return de}),U=(ee,de=[])=>{for(let he of ee)de.push(he),he.subtasks&&he.subtasks.length>0&&(he.isExpanded===void 0||he.isExpanded)&&U(he.subtasks,de);return de},E=L(e);return U(E)},[e]),S=useCallback(L=>{if(!L.startDate||!L.endDate)return {x:0,width:0};let U=L.startDate.getTime(),E=L.endDate.getTime(),q=o.getTime(),ee=(U-q)/(1e3*60*60*24),de=(E-U)/(1e3*60*60*24),he=ee*k*n,ge=Math.max(k*n,40),Le=Math.max(de*k*n,ge);return {x:he,width:Le}},[o,k,n]),_=useMemo(()=>Q.filter(L=>L.startDate&&L.endDate).map(L=>{let{x:U,width:E}=S(L),ee=Q.findIndex(de=>de.id===L.id)*a+14;return {id:L.id,x:U,y:ee,width:E,height:24}}),[Q,S]),oe=useCallback((L,U,E)=>{if(!E||U===0){b([]);return}let q=xe.calculateCascadePreview(e,L,U,Q,o,k*n,a,48);b(q);},[e,Q,o,k,n,a,48]),Te=useMemo(()=>{let L=[],U=new Date(o);for(;U<=s;){let ee=(U.getTime()-o.getTime())/864e5*k*n;if(r==="day")L.push({date:new Date(U),label:U.toLocaleDateString(d,{day:"numeric",month:"short"}),x:ee}),U.setDate(U.getDate()+1);else if(r==="week"){let de=I(U);L.push({date:new Date(U),label:`${y.labels.week} ${de}`,x:ee}),U.setDate(U.getDate()+7);}else L.push({date:new Date(U),label:U.toLocaleDateString(d,{month:"short",year:"numeric"}),x:ee}),U.setMonth(U.getMonth()+1);}return L},[o,s,r,k,n,d,y.labels.week]),A=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*k*n,[o,k,n]),Ee=Math.max(Q.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.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(R,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(R,1e3),height:48,fill:t.bgGrid}),Te.map((L,U)=>jsxs("g",{children:[U>0&&jsx("line",{x1:L.x,y1:0,x2:L.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:L.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:L.label})]},`header-${U}`)),A>=0&&A<=R&&jsx("circle",{cx:A,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxs("svg",{width:Math.max(R,1e3),height:Ee,style:{display:"block",flexShrink:0,overflow:"visible"},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("rect",{x:0,y:0,width:Math.max(R,1e3),height:Ee,fill:t.bgPrimary}),Te.map((L,U)=>{let E=Te[U+1]?.x||R,q=C(L.date);return jsxs("g",{children:[q&&jsx("rect",{x:L.x,y:0,width:E-L.x,height:Q.length*a,fill:t.bgWeekend,opacity:1}),U>0&&jsx("line",{x1:L.x,y1:0,x2:L.x,y2:Q.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},U)}),Q.map((L,U)=>{let E=L.startDate&&L.endDate;return jsxs("g",{children:[jsx("rect",{x:0,y:U*a,width:R,height:a,fill:U%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${L.id}`),!E&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:U*a,width:R,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:q=>B(q,L),onMouseEnter:q=>{q.currentTarget.setAttribute("fill",t.accentLight),q.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:q=>{q.currentTarget.setAttribute("fill","transparent"),q.currentTarget.setAttribute("opacity","1");}},`clickable-${L.id}`),jsx("text",{x:A>0?A:100,y:U*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:y.labels.clickToSetDates},`placeholder-${L.id}`)]})]},`row-group-${L.id}`)}),Q.map((L,U)=>{if(!L.startDate||!L.endDate)return null;let{x:E,width:q}=S(L),ee=U*a+14,de=L.subtasks&&L.subtasks.length>0&&!L.isMilestone;return L.isMilestone?jsx(Ns,{task:L,x:E+q/2,y:ee+12,theme:t,onClick:c},L.id):de?jsxs("g",{onClick:()=>c?.(L),onContextMenu:he=>{he.preventDefault(),he.stopPropagation(),p?.(L,he);},style:{cursor:"default"},children:[jsx("rect",{x:E,y:ee,width:q,height:32,fill:t.primary,opacity:.25,rx:6}),jsx("line",{x1:E,y1:ee,x2:E+q,y2:ee,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:E,y1:ee,x2:E,y2:ee+24,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:E+q,y1:ee,x2:E+q,y2:ee+24,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:E,y1:ee+24,x2:E+q,y2:ee+24,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),q>60&&jsx("text",{x:E+12,y:ee+12,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:L.name})]},L.id):jsx(ks,{task:L,x:E,y:ee,width:q,theme:t,dayWidth:k*n,startDate:o,templates:m,onClick:c,onDoubleClick:l,onContextMenu:p,onDateChange:f,onDependencyCreate:v,allTaskPositions:_,onDragMove:oe,onHoverChange:D},L.id)}),Q.map((L,U)=>!L.dependencies||L.dependencies.length===0||!L.startDate||!L.endDate?null:L.dependencies.map(E=>{let q=Q.find(Ie=>Ie.id===E);if(!q||!q.startDate||!q.endDate)return null;let ee=Q.findIndex(Ie=>Ie.id===E),de=S(q),he=S(L),ge=de.x+de.width,Le=ee*a+26,re=he.x,Qe=U*a+26;return jsx(Cs,{x1:ge,y1:Le,x2:re,y2:Qe,theme:t,lineStyle:i,onDelete:()=>w?.(L.id,E)},`dep-${E}-${L.id}`)})),h.map(L=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:L.previewX,y:L.y-48,width:L.width,height:32,rx:8,fill:L.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(L.daysDelta)>0&&jsx("text",{x:L.previewX+L.width/2,y:L.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:L.daysDelta>0?`+${L.daysDelta}d`:`${L.daysDelta}d`})]},`cascade-preview-${L.taskId}`)),A>=0&&A<=R&&jsx("line",{x1:A,y1:0,x2:A,y2:Ee,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),x&&jsx(Wm,{tooltipData:x,theme:t,locale:d==="es"?"es":"en"})]})]})}var xy=['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"'],jm=()=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsx("circle",{cx:"12",cy:"12",r:"4"})]}),ky=()=>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"})}),wy=()=>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"})}),Cy=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Ty=()=>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 Es({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:d,onDependencyDelete:m}){let[i,c]=useState(false),[l,p]=useState(false),[f,v]=useState([]),[w,g]=useState(""),[y,h]=useState(false),[b,x]=useState(true),N=useRef(null),D=useRef(null),T=useRef(null),{enabled:k=true,placeholder:R='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:I="bottom-right",onCommand:C,suggestions:W=xy,maxHistory:B=50,persistHistory:Q}=a,S=Q?.storageKey||"gantt-ai-history",_=Q?.maxMessages??5;useEffect(()=>{if(Q?.enabled)try{let U=localStorage.getItem(S);if(U){let q=JSON.parse(U).map(ee=>({...ee,timestamp:new Date(ee.timestamp)}));v(q.slice(-_));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[Q?.enabled,S,_]),useEffect(()=>{if(Q?.enabled&&f.length>0)try{let U=f.filter(E=>!E.isLoading).slice(-_);localStorage.setItem(S,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[f,Q?.enabled,S,_]),useEffect(()=>{D.current&&D.current.scrollIntoView({behavior:"smooth"});},[f]),useEffect(()=>{i&&!l&&N.current&&setTimeout(()=>N.current?.focus(),100);},[i,l]);let oe=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&&d?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&m?.(U.taskId,U.dependencyFrom);break}},[o,s,n,d,m]),Te=useCallback(async U=>{if(!U.trim()||y)return;let E={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};v(ee=>[...ee.slice(-(B-1)),E]),g(""),x(false),h(true);let q={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(ee=>[...ee,q]);try{if(C){let ee=await C(U,e);v(de=>{let he=de.filter(Le=>!Le.isLoading),ge={id:`assistant-${Date.now()}`,role:"assistant",content:ee.message,timestamp:new Date,command:ee};return [...he,ge]}),oe(ee);}else v(ee=>[...ee.filter(he=>!he.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(ee){v(de=>[...de.filter(ge=>!ge.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${ee instanceof Error?ee.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[y,B,C,e,oe]),A=U=>{U.preventDefault(),Te(w);},Ee=U=>{g(U),N.current?.focus();};if(useEffect(()=>{let U=E=>{(E.metaKey||E.ctrlKey)&&E.key==="k"&&(E.preventDefault(),c(q=>!q),i||p(false)),E.key==="Escape"&&i&&c(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[i]),useEffect(()=>{if(!i)return;let U=q=>{let ee=q.target;T.current&&!T.current.contains(ee)&&c(false);},E=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(E),document.removeEventListener("mousedown",U);}},[i]),!k)return null;let L={"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(gt,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${L[I]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>c(true),children:[jsx(jm,{}),jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:T,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${L[I]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsx(jm,{}),jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>p(U=>!U),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(Cy,{})}),jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(wy,{})})]})]}),jsx(AnimatePresence,{children:!l&&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:[f.length===0&&b&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:W.slice(0,4).map((U,E)=>jsx("button",{onClick:()=>Ee(U),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:U.length>30?U.slice(0,30)+"...":U},E))})]}),f.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"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:U.role==="user"?"white":t.textPrimary},children:[U.isLoading?jsx(Ty,{}):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.2)":"rgba(239, 68, 68, 0.2)",color:U.command.success?"#10B981":"#EF4444"},children:[U.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:U.command.type.replace(/_/g," ")})]})]})},U.id)),jsx("div",{ref:D})]}),jsxs("form",{onSubmit:A,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsx("input",{ref:N,type:"text",value:w,onChange:U=>g(U.target.value),placeholder:R,disabled:y,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsx("button",{type:"submit",disabled:!w.trim()||y,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:w.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:w.trim()?"white":t.textSecondary},children:jsx(ky,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Km(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((i,c=true)=>{r(l=>{let p=typeof i=="function"?i(l.present):i;if(o.current)return {...l,present:p};if(!c)return {...l,present:p};let f=[...l.past,l.present];return f.length>t&&f.shift(),{past:f,present:p,future:[]}});},[t]),n=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let c=i.past[i.past.length-1],l=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:c,future:[i.present,...i.future]}});},[]),d=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let c=i.future[0],l=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:c,future:l}});},[]),m=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:d,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function qm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let d=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=d?n.metaKey:n.ctrlKey;if(m&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!d&&m&&n.key==="y"){n.preventDefault(),t();return}if(d&&m&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Ey={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${xe.formatDate(e.startDate)} - ${xe.formatDate(e.endDate)}`);let a=xe.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=>xe.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Ym(e){return {...Ey,...e}}var Ry=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Zm=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:d="comfortable",showThemeSelector:m=true,showExportButton:i=true,availableUsers:c=[],templates:l,enableAutoCriticalPath:p=true,persistExpandedState:f,persistFilter:v,clearFiltersKey:w,aiAssistant:g,locale:y="en",customTranslations:h,showCreateTaskButton:b=false,createTaskLabel:x,onCreateTask:N,taskFilter:D,onTaskFilterChange:T,onThemeChange:k,onTaskClick:R,onTaskDblClick:I,onTaskContextMenu:C,onTaskUpdate:W,onProgressChange:B,onTaskEdit:Q,onTaskAddSubtask:S,onTaskMarkIncomplete:_,onTaskSetInProgress:oe,onDependencyCreate:Te,onDependencyDelete:A,onBeforeTaskAdd:Ee,onAfterTaskAdd:L,onBeforeTaskUpdate:U,onAfterTaskUpdate:E,onBeforeTaskDelete:q,onAfterTaskDelete:ee,permissions:de}=a,ge=useContext(us)?.theme,[Le,re]=useState(ge||s||"dark"),[Qe,Ie]=useState(n),[Ke,ht]=useState(d),[bt,qe]=useState(1),xt=useCallback(()=>v?typeof v=="string"?v:"gantt-filter-state":null,[v]),[ut,yt]=useState(()=>{if(!v)return "all";try{let P=typeof v=="string"?v:"gantt-filter-state",F=localStorage.getItem(P);if(F){let j=JSON.parse(F);if(j.taskFilter)return j.taskFilter}}catch(P){console.warn("[GanttBoard] Error loading filter state from localStorage:",P);}return "all"}),ne=D??ut,O=T??yt,[J,ce]=useState(()=>{if(!v)return false;try{let P=typeof v=="string"?v:"gantt-filter-state",F=localStorage.getItem(P);if(F){let j=JSON.parse(F);if(typeof j.hideCompleted=="boolean")return j.hideCompleted}}catch(P){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",P);}return false});useEffect(()=>{let P=xt();if(P)try{let F={taskFilter:ne,hideCompleted:J};localStorage.setItem(P,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving filter state to localStorage:",F);}},[ne,J,xt]);let ke=useRef(w);useEffect(()=>{if(ke.current!==w&&w!==void 0){yt("all"),ce(false);let P=xt();if(P)try{localStorage.removeItem(P);}catch(F){console.warn("[GanttBoard] Error clearing filter state from localStorage:",F);}}ke.current=w;},[w,xt]);let[$e,Je]=useState(0),[ot,ze]=useState(false),[oa,G]=useState(null),[Y,be]=useState({isOpen:false,x:0,y:0,task:null}),[Ye,we]=useState(null),[Pe,X]=useState(null);useEffect(()=>{ge&&ge!==Le&&re(ge);},[ge]),useEffect(()=>{s&&s!==Le&&re(s);},[s]);let Ue=useCallback(P=>{re(P),k?.(P);},[k]),{state:H,setState:ie,undo:Fe,redo:Ve,canUndo:We,canRedo:Re,clearHistory:z}=Km(t,50),K=useCallback(()=>f?typeof f=="string"?f:"gantt-expanded-tasks":null,[f]),ye=useRef(new Map),_e=useRef(false);if(!_e.current&&f){_e.current=true;let P=typeof f=="string"?f:"gantt-expanded-tasks";try{let F=localStorage.getItem(P);if(F){let j=JSON.parse(F);Array.isArray(j)&&(ye.current=new Map(j));}}catch(F){console.warn("[GanttBoard] Error loading expanded state from localStorage:",F);}}let Xe=useCallback(()=>{let P=K();if(P)try{let F=Array.from(ye.current.entries());localStorage.setItem(P,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving expanded state to localStorage:",F);}},[K]);useEffect(()=>{let P=j=>{let se=new Map;for(let me of j){let ve=me.id;se.get(ve)||se.set(ve,me);}return Array.from(se.values())},F=j=>j.map(se=>{let me=ye.current.get(se.id),ve=me!==void 0?{...se,isExpanded:me}:se;if(ve.subtasks?.length){let wt=P(ve.subtasks);return {...ve,subtasks:F(wt)}}return ve});if(ye.current.size>0)ie(F(t));else {let j=se=>se.map(me=>me.subtasks?.length?{...me,subtasks:P(j(me.subtasks))}:me);ie(j(t));}},[t,ie]);let V=useRef(t),ue=useRef(true);useEffect(()=>{if(ue.current){ue.current=false,V.current=H;return}if(!r)return;let P=JSON.stringify(V.current),F=JSON.stringify(H);P!==F&&(V.current=H,r(H));},[H,r]);let Be=useMemo(()=>sl(y,h),[y,h]),Mt=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}],[]),[it,kr]=useState(()=>Mt(Be));useEffect(()=>{kr(P=>P.map(F=>({...F,label:Be.columns[F.id==="name"?"taskName":F.id]||F.label})));},[Be]);let Za=useMemo(()=>it.filter(F=>F.visible).reduce((F,j)=>F+j.width,0),[it]),lr=useRef(it.filter(P=>P.visible).map(P=>P.id).join(","));useEffect(()=>{let P=it.filter(se=>se.visible),F=P.map(se=>se.id).join(","),j=lr.current;if(F!==j){let se=P.some(ve=>ve.id!=="name"),me=j.includes(",");se?!me&&se&&G(null):G(null),lr.current=F;}},[it]);let Qa=60,Ne=.6,Rt=useMemo(()=>{let F=Za+Qa,j=typeof window<"u"?window.innerWidth*Ne:800,se=Math.max(F,j);return oa!==null?Math.max(200,Math.min(oa,se)):Math.max(200,F)},[oa,Za]),Ot=useRef(null),Na=useRef(null),wr=useRef(null),kt=useMemo(()=>ym(Le),[Le]),dr=useMemo(()=>({theme:kt,themeName:Le}),[kt,Le]),M=useMemo(()=>Ym(l),[l]),ae=useMemo(()=>{if(!p)return H;let P=xe.calculateCriticalPath(H),F=j=>j.map(se=>({...se,isCriticalPath:P.includes(se.id),subtasks:se.subtasks?F(se.subtasks):void 0}));return F(H)},[H,p]),Oe=useMemo(()=>{if(ne==="all"&&!J)return ae;let P=F=>{let j=[];for(let se of F){let me=se.subtasks?.length?P(se.subtasks):void 0,ve=false;if(J)ve=se.progress<100;else switch(ne){case "all":ve=true;break;case "incomplete":ve=se.progress<100;break;case "in_progress":ve=se.progress>0&&se.progress<100;break;case "completed":ve=se.progress===100;break}(ve||me&&me.length>0)&&j.push({...se,subtasks:me});}return j};return P(ae)},[ae,ne,J]),Ze=Ry(Ke);qm({undo:Fe,redo:Ve,canUndo:We,canRedo:Re,enabled:true}),useImperativeHandle(o,()=>({getTask:P=>xe.findTaskById(H,P),addTask:(P,F)=>{ie(j=>{if(!F)return [...j,{...P,level:0}];let se=me=>me.map(ve=>ve.id===F?{...ve,subtasks:[...ve.subtasks||[],{...P,parentId:F,level:(ve.level||0)+1}],isExpanded:true}:ve.subtasks?{...ve,subtasks:se(ve.subtasks)}:ve);return se(j)});},updateTask:(P,F)=>{ie(j=>{let se=me=>me.map(ve=>ve.id===P?{...ve,...F}:ve.subtasks?{...ve,subtasks:se(ve.subtasks)}:ve);return se(j)});},deleteTask:P=>{ie(F=>{let j=se=>se.filter(me=>me.id===P?false:(me.subtasks&&(me.subtasks=j(me.subtasks)),true));return j(F)});},deleteTasks:P=>{ie(F=>bl(F,P));},duplicateTask:P=>{if(a.onTaskDuplicate){let F=xe.findTaskById(H,P);F&&a.onTaskDuplicate(F);}else ie(F=>vn(F,[P]).tasks);},splitTask:(P,F,j=3)=>{ie(se=>xe.splitTask(se,P,F,j));},calculateEndDate:xe.calculateEndDate,calculateDuration:xe.calculateDuration,validateDependency:(P,F)=>!xe.validateDependencies(H,P,F),getAllTasks:()=>xe.flattenTasks(H),getTasksByStatus:P=>xe.flattenTasks(H).filter(F=>F.status===P),getTasksByParent:P=>P?xe.findTaskById(H,P)?.subtasks||[]:H.filter(j=>!j.parentId),getCriticalPath:()=>xe.flattenTasks(H).filter(P=>P.isCriticalPath),indentTask:P=>{ie(F=>gl(F,[P]));},outdentTask:P=>{ie(F=>fl(F,[P]));},moveTask:(P,F)=>{ie(j=>hl(j,[P],F));},createSubtask:async P=>{let{tasks:F,newTask:j}=xl(H,P);if(Ee){let se=Ee({...j,parentId:P});if((se instanceof Promise?await se:se)===false)return}ie(F),L&&L({...j,parentId:P});},scrollToTask:P=>{let j=xe.flattenTasks(H).findIndex(se=>se.id===P);if(j!==-1&&Ot.current){let se=j*Ze;Ot.current.scrollTo({top:se,behavior:"smooth"}),Na.current&&Na.current.scrollTo({top:se,behavior:"smooth"});}},highlightTask:(P,F=2e3)=>{},expandTask:P=>{ie(F=>{let j=se=>se.map(me=>me.id===P?{...me,isExpanded:true}:me.subtasks?{...me,subtasks:j(me.subtasks)}:me);return j(F)});},collapseTask:P=>{ie(F=>{let j=se=>se.map(me=>me.id===P?{...me,isExpanded:false}:me.subtasks?{...me,subtasks:j(me.subtasks)}:me);return j(F)});},expandAll:()=>{ie(P=>{let F=j=>j.map(se=>({...se,isExpanded:true,subtasks:se.subtasks?F(se.subtasks):void 0}));return F(P)});},collapseAll:()=>{ie(P=>{let F=j=>j.map(se=>({...se,isExpanded:false,subtasks:se.subtasks?F(se.subtasks):void 0}));return F(P)});},undo:Fe,redo:Ve,canUndo:()=>We,canRedo:()=>Re,clearHistory:z,exportToPNG:async()=>{if(!wr.current||!Ot.current||!Na.current)throw new Error("Gantt container not found");let P=wr.current,F=Ot.current.querySelector(".gantt-grid-scroll"),j=Na.current,se=F?.scrollTop||0,me=j.scrollTop,ve=P.style.overflow,wt=P.style.height;try{let je=F?.querySelector(".gantt-taskgrid-content"),Vt=j.querySelector("svg"),Ft=je?.scrollHeight||F?.scrollHeight||600,pa=Vt?.getBoundingClientRect().height||j.scrollHeight,so=(P.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(Ft,pa)+20;F&&(F.scrollTop=0),j.scrollTop=0,P.style.overflow="visible",P.style.height=`${so}px`,await new Promise(Hr=>setTimeout(Hr,100));let Cr=await Jm(P,{backgroundColor:kt.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:Hr=>{let Fo=window.getComputedStyle(Hr),io=parseInt(Fo.zIndex,10);return !isNaN(io)&&io>=50||Fo.position==="fixed"}});return new Promise((Hr,Fo)=>{Cr.toBlob(io=>{io?Hr(io):Fo(new Error("Failed to create blob from canvas"));},"image/png");})}finally{P.style.overflow=ve,P.style.height=wt,F&&(F.scrollTop=se),j.scrollTop=me;}},exportToPDF:async P=>{await xe.exportToPDF(H,P);},exportToExcel:async P=>{await xe.exportToExcel(H,P);},exportToJSON:()=>xe.exportToJSON(H),exportToCSV:()=>xe.exportToCSV(H),importFromJSON:P=>{let F=xe.importFromJSON(P);ie(F);},getTasks:()=>H,refresh:()=>{ie(P=>[...P]);},clearAll:()=>{ie([]);}}),[H,Fe,Ve,We,Re,z,kt,Ze]);let la=useCallback(P=>{kr(F=>F.map(j=>j.id===P?{...j,visible:!j.visible}:j));},[]),ba=useCallback((P,F)=>{kr(j=>j.map(se=>{if(se.id!==P)return se;let me=se.minWidth??100,ve=se.maxWidth??800,wt=Math.max(me,Math.min(ve,F));return {...se,width:wt}}));},[]),Da=useCallback(P=>{ie(F=>{let j=vl(F,P),se=me=>{for(let ve of me){if(ve.id===P){ye.current.set(P,ve.isExpanded??true);return}ve.subtasks?.length&&se(ve.subtasks);}};return se(j),Xe(),j}),a.onTaskToggleExpand?.(P);},[a,Xe]),Ea=useCallback((P,F)=>{if(U&&U(P,F)===false)return;let se=xe.findTaskById(H,P)?.progress,me=wt=>wt.map(je=>je.id===P?{...je,...F}:je.subtasks?{...je,subtasks:me(je.subtasks)}:je);ie(me(H));let ve=xe.findTaskById(me(H),P);ve&&(W?.(ve),E?.(ve),F.progress!==void 0&&se!==void 0&&F.progress!==se&&B?.(P,se,F.progress));},[H,W,U,E,B]),Pa=useCallback(P=>{P.length!==0&&(ie(F=>gl(F,P)),a.onTaskIndent?.(P[0]));},[a]),Fa=useCallback(P=>{P.length!==0&&(ie(F=>fl(F,P)),a.onTaskOutdent?.(P[0]));},[a]),tn=useCallback((P,F,j)=>{ie(se=>Im(se,P,F,j)),a.onTaskReparent?.(P,F,j);},[a]),hg=useCallback((P,F)=>{P.length!==0&&(ie(j=>hl(j,P,F)),a.onTaskMove?.(P[0],F));},[a]),Qs=useCallback(async P=>{let F=[];for(let j of P)q&&await Promise.resolve(q(j))===false||F.push(j);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(ie(j=>bl(j,F)),F.forEach(j=>a.onTaskDelete?.(j))),ee&&F.forEach(j=>ee(j)));},[a,q,ee]),bg=useCallback(P=>{a.onTaskDuplicate?P.forEach(F=>{let j=xe.findTaskById(H,F);j&&a.onTaskDuplicate(j);}):ie(F=>vn(F,P).tasks);},[a,H]),yg=useCallback((P,F)=>{ie(j=>{let{tasks:se,newTask:me}=Lm(j,P,F);return Ee&&Ee(me)===false?j:(a.onTaskCreate?.(me.parentId,me.position||0),L?.(me),se)});},[a,Ee,L]),vg=useCallback((P,F)=>{ie(j=>yl(j,P,F)),a.onTaskRename?.(P,F);},[a]),ei=useCallback(P=>{ie(F=>{let{tasks:j}=xl(F,P);return a.onTaskCreate?.(P,0),j});},[a]),xg=useCallback((P,F,j)=>{let se=P.startDate?Math.round((F.getTime()-P.startDate.getTime())/864e5):0,me=je=>je.map(Vt=>Vt.id===P.id?{...Vt,startDate:F,endDate:j,...P.segments&&{segments:P.segments}}:Vt.subtasks?{...Vt,subtasks:me(Vt.subtasks)}:Vt),ve=me(H);ve=xe.autoScheduleDependents(ve,P.id,se),ie(ve);let wt={...P,startDate:F,endDate:j};W?.(wt);},[H,W]),kg=useCallback((P,F)=>{C?.(P,F),be({isOpen:true,x:F.clientX,y:F.clientY,task:P});},[C]),wg=useCallback((P,F)=>{let j=xe.splitTask(H,P.id,F);ie(j),be({isOpen:false,x:0,y:0,task:null});},[H]),Pd=useCallback(P=>{let F=xe.findTaskById(H,P.id)||P;I?.(F),Q||we(F);},[H,I,Q]),Md=useCallback((P,F,j)=>{let se=new Map,me=Ft=>{Ft.forEach(pa=>{pa.dependencies&&se.set(pa.id,pa.dependencies),pa.subtasks&&me(pa.subtasks);});};me(j);let ve=se.get(F)||[];se.set(F,[...ve,P]);let wt=new Set,je=new Set,Vt=Ft=>{if(!wt.has(Ft)){wt.add(Ft),je.add(Ft);let pa=se.get(Ft)||[];for(let er of pa){if(!wt.has(er)&&Vt(er))return true;if(je.has(er))return true}}return je.delete(Ft),false};return Vt(F)},[]),Fd=useCallback((P,F)=>{if(Md(P.id,F,H)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
357
357
|
|
|
358
|
-
Task dependencies must flow in one direction only.`);return}let K=se=>se.map(me=>{if(me.id===F){let xe=me.dependencies||[];if(!xe.includes(P.id))return {...me,dependencies:[...xe,P.id]}}return me.subtasks?{...me,subtasks:K(me.subtasks)}:me});_(K(re)),Ce?.(P.id,F);},[re,Ce,Md]),Ad=useCallback((P,F)=>{let K=se=>se.map(me=>{if(me.id===P&&me.dependencies){let xe=me.dependencies.filter(Tt=>Tt!==F);return {...me,dependencies:xe}}return me.subtasks?{...me,subtasks:K(me.subtasks)}:me});_(K(re)),A?.(P,F);},[re,A]),{startDate:Rn,endDate:wg}=useMemo(()=>{let P=re.filter(xe=>xe.startDate&&xe.endDate);if(P.length===0){let xe=new Date,Tt=new Date(xe);Tt.setDate(Tt.getDate()-30);let gt=new Date(xe);return gt.setDate(gt.getDate()+60),{startDate:Tt,endDate:gt}}let F=P.flatMap(xe=>[xe.startDate,xe.endDate]).filter(xe=>xe!==void 0),K=new Date(Math.min(...F.map(xe=>xe.getTime()))),se=new Date(Math.max(...F.map(xe=>xe.getTime()))),me=ae==="day"?7:ae==="week"?14:30;return K.setDate(K.getDate()-me),se.setDate(se.getDate()+me),{startDate:K,endDate:se}},[re,ae]),Cg=useCallback(async()=>{if(!Ja.current||!vt.current||!At.current)return;await new Promise(so=>setTimeout(so,200));let P=Ja.current,F=vt.current.querySelector(".gantt-grid-scroll"),K=At.current,se=F?.scrollTop||0,me=F?.scrollLeft||0,xe=K.scrollTop,Tt=K.scrollLeft,gt=P.style.overflow,jt=P.style.height,Da=F?.style.overflow||"",Pa=K.style.overflow,Ur=P.style.width,On=K.style.width;try{let so=F?.querySelector(".gantt-taskgrid-content"),kr=K.querySelector("svg"),Hr=kr?.getAttribute("height")?parseInt(kr.getAttribute("height"),10):kr?.getBoundingClientRect().height||0,Mo=so?.scrollHeight||F?.scrollHeight||600,io=Math.max(Hr,K.scrollHeight),Bd=kr?.getAttribute("width")?parseInt(kr.getAttribute("width"),10):kr?.getBoundingClientRect().width||K.scrollWidth,Fg=P.querySelector('[class*="h-12"]')?.offsetHeight||48,ai=Math.max(Mo,io,Hr),ri=Fg+ai+50,oi=(F?.offsetWidth||300)+Bd+10;F&&(F.scrollTop=0,F.scrollLeft=0),K.scrollTop=0,K.scrollLeft=0,P.style.overflow="visible",P.style.height=`${ri}px`,P.style.width=`${oi}px`,F&&(F.style.overflow="visible",F.style.height=`${ai+50}px`),K.style.overflow="visible",K.style.height=`${ai+50}px`,K.style.width=`${Bd+10}px`,await new Promise(si=>setTimeout(si,150));let Ag=await Jm(P,{backgroundColor:Et.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:oi,height:ri,windowWidth:oi+100,windowHeight:ri+100,scrollX:0,scrollY:0,ignoreElements:si=>{let Rd=window.getComputedStyle(si),Od=parseInt(Rd.zIndex,10);return !isNaN(Od)&&Od>=50||Rd.position==="fixed"}}),ni=document.createElement("a");ni.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,ni.href=Ag.toDataURL("image/png"),ni.click();}finally{P.style.overflow=gt,P.style.height=jt,P.style.width=Ur,F&&(F.style.overflow=Da,F.style.height="",F.scrollTop=se,F.scrollLeft=me),K.style.overflow=Pa,K.style.height="",K.style.width=On,K.scrollTop=xe,K.scrollLeft=Tt;}},[Et]),Tg=useCallback(async()=>{await ve.exportToPDF(re);},[re]),Ng=useCallback(async()=>{await ve.exportToExcel(re);},[re]),Dg=useCallback(()=>{let P=ve.exportToCSV(re),F=new Blob([P],{type:"text/csv;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(F),K.download="gantt-chart.csv",K.click(),URL.revokeObjectURL(K.href);},[re]),Sg=useCallback(()=>{let P=ve.exportToJSON(re),F=new Blob([P],{type:"application/json;charset=utf-8;"}),K=document.createElement("a");K.href=URL.createObjectURL(F),K.download="gantt-chart.json",K.click(),URL.revokeObjectURL(K.href);},[re]),Eg=useCallback(()=>{ve.exportToMSProject(re,"Gantt Project","project.xml");},[re]),Pg=P=>{P.preventDefault(),at(true);},Po=useRef(false),[ti,Ld]=useState(false),tn=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let P=At.current,F=vt.current?.querySelector(".gantt-grid-scroll");if(!P||!F)return;let K=()=>{if(Po.current)return;Po.current=true;let gt=P.scrollTop;$e(gt),F.scrollTop=gt,requestAnimationFrame(()=>{Po.current=false;});},se=()=>{if(Po.current)return;Po.current=true;let gt=F.scrollTop;$e(gt),P.scrollTop=gt,requestAnimationFrame(()=>{Po.current=false;});},me=gt=>{if(Xe&&F){let Da=F.parentElement?.getBoundingClientRect()?.left||0,Pa=gt.clientX-Da,Ur=200,On=sr+ir,so=window.innerWidth*Xa,kr=Math.max(On,so);Pa>=Ur&&Pa<=kr&&oa(Pa);}if(ti&&P){let jt=gt.clientX-tn.current.x,Da=gt.clientY-tn.current.y;P.scrollLeft=tn.current.scrollLeft-jt,P.scrollTop=tn.current.scrollTop-Da;}},xe=()=>{at(false),Ld(false);},Tt=gt=>{if(gt.button!==0)return;let jt=gt.target;jt.closest("[data-task-bar]")||jt.closest("[data-dependency-line]")||jt.closest("button")||jt.closest('[role="button"]')||jt.tagName==="rect"&&jt.getAttribute("data-clickable")==="true"||(Ld(true),tn.current={x:gt.clientX,y:gt.clientY,scrollLeft:P.scrollLeft,scrollTop:P.scrollTop},gt.preventDefault());};return P.addEventListener("scroll",K),F.addEventListener("scroll",se),P.addEventListener("mousedown",Tt),document.addEventListener("mousemove",me),document.addEventListener("mouseup",xe),()=>{P.removeEventListener("scroll",K),F.removeEventListener("scroll",se),P.removeEventListener("mousedown",Tt),document.removeEventListener("mousemove",me),document.removeEventListener("mouseup",xe);}},[Xe,ti,sr]);let Id=useRef(false),Mg=useRef(null);return useLayoutEffect(()=>{if(Id.current||re.length===0||!At.current)return;Id.current=true,Mg.current=Rn;let P=At.current,F=new Date,K=ae==="day"?60:ae==="week"?20:8,se=(F.getTime()-Rn.getTime())/(1e3*60*60*24),me=P.clientWidth,Tt=se*K*ut-me/2;se>=0&&me>0&&(P.scrollLeft=Math.max(0,Tt));},[re.length,Rn,ae,ut]),jsx(Vo.Provider,{value:le,children:jsx(mi.Provider,{value:zr,children:jsxs("div",{ref:Ja,className:"flex flex-col h-full w-full",style:{backgroundColor:Et.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx(gs,{theme:Et,timeScale:ae,onTimeScaleChange:nt,zoom:ut,onZoomChange:St,currentTheme:pe,onThemeChange:X,rowDensity:Fe,onRowDensityChange:qe,showThemeSelector:c,showCreateTaskButton:b,createTaskLabel:x,onCreateTask:N,taskFilter:pt,onTaskFilterChange:ie,hideCompleted:B,onHideCompletedChange:Z,onExportPNG:i?Cg:void 0,onExportPDF:i?Tg:void 0,onExportExcel:i?Ng:void 0,onExportCSV:i?Dg:void 0,onExportJSON:i?Sg:void 0,onExportMSProject:i?Eg:void 0}),jsxs("div",{ref:vt,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:Ne,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(vs,{tasks:oe,theme:Et,rowHeight:Re,availableUsers:m,templates:Za,onTaskClick:O,onTaskDblClick:Pd,onTaskContextMenu:C,onTaskToggle:ha,scrollTop:ke,columns:yt,onToggleColumn:Je,onColumnResize:la,onTaskUpdate:Zt,onTaskIndent:lr,onTaskOutdent:Na,onTaskMove:en,onMultiTaskDelete:Qs,onTaskDuplicate:hg,onTaskCreate:bg,onTaskRename:yg,onCreateSubtask:ei,onOpenTaskModal:O?P=>O(P):void 0,onDeleteRequest:(P,F)=>De({taskId:P,taskName:F}),onTaskReparent:Ea})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Et.border,zIndex:15},onMouseDown:Pg}),jsx("div",{ref:At,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:ti?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Ss,{tasks:oe,theme:Et,rowHeight:Re,timeScale:ae,startDate:Rn,endDate:wg,zoom:ut,locale:y,templates:Za,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:O,onTaskDblClick:Pd,onTaskContextMenu:xg,onTaskDateChange:vg,onDependencyCreate:Fd,onDependencyDelete:Ad})})]}),W.task&&jsx(_o,{isOpen:W.isOpen,x:W.x,y:W.y,theme:Et,onClose:()=>Y({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=W.task;if(!P)return [];let F=ve.findTaskById(re,P.id)||P;return F.subtasks&&F.subtasks.length>0?[{id:"addSubtask",label:le.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{S?S(F):ei(F.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:le.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{De({taskId:F.id,taskName:F.name});}}]:[{id:"edit",label:le.contextMenu?.editTask||"Edit Task",icon:Rt.Pencil,onClick:()=>{Q?Q(F):Ye(F);}},{id:"addSubtask",label:le.contextMenu?.addSubtask||"Add Subtask",icon:Rt.Add,onClick:()=>{S?S(F):ei(F.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:le.contextMenu?.markIncomplete||"Mark Incomplete",icon:Rt.MarkIncomplete,onClick:()=>{G?G(F):Zt(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"},{id:"setInProgress",label:le.contextMenu?.setInProgress||"Set In Progress",icon:Rt.SetInProgress,onClick:()=>{ne?ne(F):Zt(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"},{id:"markComplete",label:le.contextMenu?.markComplete||"Mark Complete",icon:Rt.MarkComplete,onClick:()=>{Zt(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"duplicate",label:le.contextMenu?.duplicateTask||"Duplicate Task",icon:Rt.Duplicate,onClick:()=>{_(se=>hs(se,[F.id])),Y({isOpen:false,x:0,y:0,task:null});}},{id:"split",label:le.contextMenu?.splitTask||"Split Task",icon:Rt.Split,onClick:()=>{if(!F.startDate||!F.endDate){console.warn("Cannot split task without dates");return}let se=F.startDate.getTime(),me=F.endDate.getTime(),xe=se+(me-se)/2,Tt=new Date(xe);kg(F,Tt);},disabled:!F.startDate||!F.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:le.contextMenu?.deleteTask||"Delete Task",icon:Rt.Delete,onClick:()=>{De({taskId:F.id,taskName:F.name});}}]})()}),jsx(Ar,{task:be,isOpen:!!be,onClose:()=>Ye(null),onTaskUpdate:P=>{be&&(Zt(be.id,P),Ye(null));},theme:pe==="light"?"light":"dark",locale:y==="es"?"es":"en",availableUsers:m,availableTasks:t}),jsx(AnimatePresence,{children:Te&&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:()=>De(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:Et.bgSecondary,border:`1px solid ${Et.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Et.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:Et.textPrimary,fontFamily:"Inter, sans-serif"},children:[le.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:Et.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsxs("p",{className:"text-sm leading-relaxed",style:{color:Et.textSecondary,fontFamily:"Inter, sans-serif"},children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:Et.textPrimary},children:['"',Te.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Et.bgPrimary,borderTop:`1px solid ${Et.border}`},children:[jsx("button",{onClick:()=>De(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Et.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=Et.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{Qs([Te.taskId]),De(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"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),g?.enabled&&jsx(Es,{tasks:re,theme:Et,config:g,onTasksUpdate:_,onTaskUpdate:Zt,onTaskCreate:P=>{_(F=>[...F,P]);},onTaskDelete:P=>{Qs([P]);},onDependencyCreate:(P,F)=>{let K=ve.findTaskById(re,P);K&&Fd(K,F);},onDependencyDelete:Ad})]})})})});function jy(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 Ky(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 Nl=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Dl=[{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 au({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:f,onDeleteAttachment:v}){let w=[...Nl,...i.filter(B=>!Nl.some(Z=>Z.id===B.id))],g=Qe[c]||Qe.dark,[y,h]=useState(false),[b,x]=useState(false),[N,D]=useState(false),[T,k]=useState(false),[O,I]=useState({top:0,left:0}),[C,H]=useState(null),[R,Q]=useState(new Date),[S,G]=useState({top:0,left:0}),[ne,Ce]=useState(false),[A,Pe]=useState([]),[L,U]=useState(false),[E,q]=useState(""),ee=useRef(null),fe=useRef(null),ue=useRef(null),pe=useRef(null),Oe=useRef(null),[ae,nt]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Fe,qe]=useState({});useEffect(()=>{a?(nt({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||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&Ce(true)):(nt({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),Ce(false),Pe([]));},[a,e]),useEffect(()=>{let B=Z=>{ee.current&&!ee.current.contains(Z.target)&&h(false),fe.current&&!fe.current.contains(Z.target)&&x(false),ue.current&&!ue.current.contains(Z.target)&&D(false),pe.current&&!pe.current.contains(Z.target)&&k(false);};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);let ut=()=>{let B={};return ae.name.trim()||(B.name="El nombre es requerido"),ae.startDate&&ae.endDate&&ae.startDate>ae.endDate&&(B.endDate="La fecha de fin debe ser posterior a la de inicio"),qe(B),Object.keys(B).length===0},St=async B=>{if(B.preventDefault(),!!ut())try{let Z=l==="create"&&A.length>0?{...ae,pendingFiles:A}:ae;await s(Z),Pe([]),t();}catch(Z){console.error("Error submitting task:",Z);}},je=(B,Z)=>{nt(ce=>{let ke={...ce,[B]:Z};if(B==="status"){let $e=Z;$e==="todo"?ke.progress=0:$e==="in-progress"?(ce.progress===0||ce.progress===100)&&(ke.progress=50):$e==="completed"||$e==="closed"?ke.progress=100:($e==="in-review"||$e==="review")&&(ke.progress=75);}if(B==="progress"){let $e=typeof Z=="number"?Z:parseInt(Z,10);$e===100&&ce.status!=="completed"?ke.status="completed":$e>0&&$e<100&&ce.status==="todo"?ke.status="in-progress":$e===0&&ce.status!=="todo"&&(ke.status="todo");}return ke}),Fe[B]&&qe(ce=>{let ke={...ce};return delete ke[B],ke});},Ft=w.find(B=>B.id===ae.status)??Nl[0],it=Dl.find(B=>B.id===ae.priority)??Dl[1],pt=go.find(B=>B.value===ae.color)??go[0],ie={backgroundColor:g.bgSecondary,border:`1px solid ${g.borderLight}`,color:g.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 bg-black/60 z-50",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-50 flex items-center justify-center p-4 pointer-events-none",children:jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":c,style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:B=>B.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Ft.color||g.accent}}),jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:l==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:B=>{B.currentTarget.style.backgroundColor=g.hoverBg,B.currentTarget.style.color=g.textPrimary;},onMouseLeave:B=>{B.currentTarget.style.backgroundColor="transparent",B.currentTarget.style.color=g.textTertiary;},disabled:n,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:St,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxs("div",{className:"p-5 space-y-4",children:[jsxs("div",{children:[jsx("input",{type:"text",value:ae.name,onChange:B=>je("name",B.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:g.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Fe.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Fe.name]})]}),jsx("div",{children:jsx("textarea",{value:ae.description||"",onChange:B=>je("description",B.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:ee,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&h(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ie,borderColor:Ft.color,backgroundColor:`${Ft.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:Ft.color}}),jsx("span",{style:{color:Ft.color},children:Ft.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:Ft.color}})]}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:w.map(B=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:Z=>Z.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:Z=>Z.currentTarget.style.backgroundColor="transparent",onClick:()=>{je("status",B.id),h(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:B.color}}),B.title,ae.status===B.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},B.id))})})]}),jsxs("div",{ref:fe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&x(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ie,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:it.color}}),jsx("span",{children:it.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),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-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:Dl.map(B=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:Z=>Z.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:Z=>Z.currentTarget.style.backgroundColor="transparent",onClick:()=>{je("priority",B.id),x(false);},children:[jsx("span",{children:B.icon}),B.label,ae.priority===B.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},B.id))})})]}),o.length>0&&jsxs("div",{ref:ue,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&D(!N),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ie,disabled:n,children:[ae.assignees&&ae.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:ae.assignees.slice(0,3).map((B,Z)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:B.color||g.accent,borderColor:g.bgSecondary},children:B.initials},Z))}),ae.assignees.length>3&&jsxs("span",{style:{color:g.textTertiary},children:["+",ae.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsx(AnimatePresence,{children:N&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map(B=>{let Z=ae.assignees?.some(ce=>ce.name===B.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:ce=>ce.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:ce=>ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ce=Z?(ae.assignees||[]).filter(ke=>ke.name!==B.name):[...ae.assignees||[],{name:B.name,avatar:B.avatar,initials:B.name.split(" ").map(ke=>ke[0]).join("").toUpperCase().slice(0,2),color:g.accent}];je("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:g.accent},children:B.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:B.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:Z&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},B.id)})})})]}),jsxs("div",{ref:pe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)k(false);else {if(pe.current){let B=pe.current.getBoundingClientRect(),Z=window.innerHeight,ce=120,$e=Z-B.bottom<ce?B.top-ce-8:B.bottom+8;I({top:$e,left:B.left});}k(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ie,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ae.color}}),jsx("span",{children:pt.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsx(AnimatePresence,{children:T&&jsxs(ht,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>k(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:`${O.top}px`,left:`${O.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:B=>B.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:go.slice(0,18).map(B=>{let Z=ae.color===B.value;return jsx("button",{type:"button",onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),je("color",B.value),k(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:B.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:B.value,outline:Z?`2px solid ${B.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},B.value)})})})})]})})]}),m.length>0||d?jsx(_r,{selectedTags:ae.tags||[],availableTags:m,onChange:B=>je("tags",B),onCreateTag:d,theme:g,disabled:n}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxs("div",{ref:Oe,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!ae.isMilestone)if(C==="start")H(null);else {if(Oe.current){let B=Oe.current.getBoundingClientRect(),Z=window.innerHeight,ce=320,$e=Z-B.bottom<ce?B.top-ce-8:B.bottom+8;G({top:$e,left:B.left});}H("start"),Q(ae.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ie,opacity:ae.isMilestone?.5:1,cursor:ae.isMilestone?"not-allowed":"pointer"},disabled:n||ae.isMilestone,children:ae.startDate?ae.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!ae.isMilestone)if(C==="end")H(null);else {if(Oe.current){let B=Oe.current.getBoundingClientRect(),Z=window.innerHeight,ce=320,$e=Z-B.bottom<ce?B.top-ce-8:B.bottom+8;G({top:$e,left:B.left});}H("end"),Q(ae.endDate||ae.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ie,opacity:ae.isMilestone?.5:1,cursor:ae.isMilestone?"not-allowed":"pointer"},disabled:n||ae.isMilestone,children:ae.endDate?ae.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:C&&jsxs(ht,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>H(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:`${S.top}px`,left:`${S.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:B=>B.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let B=new Date,Z=new Date(B);Z.setDate(B.getDate()+1);let ce=new Date(B);ce.setDate(B.getDate()+7);let ke=new Date(B);return ke.setDate(B.getDate()+14),[{label:"Hoy",date:B},{label:"Ma\xF1ana",date:Z},{label:"Pr\xF3xima semana",date:ce},{label:"2 semanas",date:ke}].map((Xe,at)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:ze=>ze.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:ze=>ze.currentTarget.style.backgroundColor="transparent",onClick:()=>{C==="start"?(je("startDate",Xe.date),(!ae.endDate||Xe.date>ae.endDate)&&je("endDate",Xe.date),H("end")):(je("endDate",Xe.date),(!ae.startDate||Xe.date<ae.startDate)&&je("startDate",Xe.date),H(null));},children:Xe.label},at))})(),jsx("div",{style:{borderTop:`1px solid ${g.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:B=>B.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",onClick:()=>{je("startDate",void 0),je("endDate",void 0),H(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:()=>Q(new Date(R.getFullYear(),R.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:g.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:g.textPrimary},children:R.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>Q(new Date(R.getFullYear(),R.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:g.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((B,Z)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:B},Z))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let B=R.getFullYear(),Z=R.getMonth(),ce=new Date(B,Z,1).getDay(),ke=new Date(B,Z+1,0).getDate(),$e=new Date,Xe=[];for(let ze=ce-1;ze>=0;ze--)Xe.push({day:new Date(B,Z,-ze).getDate(),date:new Date(B,Z-1,new Date(B,Z,-ze).getDate()),isCurrentMonth:false});for(let ze=1;ze<=ke;ze++)Xe.push({day:ze,date:new Date(B,Z,ze),isCurrentMonth:true});let at=42-Xe.length;for(let ze=1;ze<=at;ze++)Xe.push({day:ze,date:new Date(B,Z+1,ze),isCurrentMonth:false});return Xe.map((ze,oa)=>{let W=ze.date.toDateString()===$e.toDateString(),Y=ae.startDate?.toDateString()===ze.date.toDateString(),be=ae.endDate?.toDateString()===ze.date.toDateString(),Ye=ae.startDate&&ae.endDate&&ze.date>=ae.startDate&&ze.date<=ae.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:ze.isCurrentMonth?Y||be?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:Y?"#3B82F6":be?"#7C3AED":Ye?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:W&&!Y&&!be?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{C==="start"?(je("startDate",ze.date),ae.endDate&&ze.date>ae.endDate&&je("endDate",ze.date),H("end")):(je("endDate",ze.date),ae.startDate&&ze.date<ae.startDate&&je("startDate",ze.date),H(null));},children:ze.day},oa)})})()})]})]})]})})]}),Fe.endDate&&jsx("span",{className:"text-xs text-red-400",children:Fe.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsx("input",{type:"range",min:"0",max:"100",step:"5",value:ae.progress,onChange:B=>je("progress",parseInt(B.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981"}20`,color:ae.progress<30?"#EF4444":ae.progress<70?"#F59E0B":"#10B981"},children:[ae.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>Ce(!ne),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:g.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${ne?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:ne&&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:g.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:g.textTertiary},children:"Duraci\xF3n estimada"})]}),jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:ae.effortMinutes?jy(ae.effortMinutes):"",onChange:B=>{let Z=Ky(B.target.value);je("effortMinutes",Z);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:g.bgSecondary,color:g.textPrimary,border:`1px solid ${g.borderLight}`}}),jsx("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(f||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:g.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:g.textTertiary},children:["Adjuntos ",l==="create"?A.length>0&&`(${A.length})`:p.length>0&&`(${p.length})`]})]}),l==="create"?jsx(Dr,{cardId:"pending",attachments:A.map((B,Z)=>({id:`pending-${Z}`,cardId:"pending",name:B.name,size:B.size,type:B.type,url:URL.createObjectURL(B),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:B=>Pe(Z=>[...Z,...B]),onDelete:B=>{let Z=parseInt(B.replace("pending-",""),10);Pe(ce=>ce.filter((ke,$e)=>$e!==Z));},maxSizeMB:10,maxFiles:20}):jsx(Dr,{cardId:a?.id||"new",attachments:p,onUpload:f&&a?.id?B=>f(a.id,B):void 0,onDelete:v,maxSizeMB:10,maxFiles:20}),l==="create"&&A.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[A.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 hover:bg-white/5",children:[jsx("input",{type:"checkbox",checked:ae.isMilestone,onChange:B=>je("isMilestone",B.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:g.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:g.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ae.dependencies&&ae.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ae.dependencies.map(B=>{let Z=r.find(ce=>ce.id===B);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${g.accent}20`,color:g.accent},children:[Z?.name||B.slice(0,8),jsx("button",{type:"button",onClick:()=>{let ce=(ae.dependencies||[]).filter(ke=>ke!==B);je("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"})})]},B)})}),jsxs("button",{type:"button",onClick:()=>{U(!L),q("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:g.bgSecondary,color:g.textSecondary},disabled:n,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:L&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{U(false),q("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${g.border}`},children:jsx("input",{type:"text",value:E,onChange:B=>q(B.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:g.bgSecondary,color:g.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(B=>B.id!==a?.id).filter(B=>E===""||B.name.toLowerCase().includes(E.toLowerCase())).map(B=>{let Z=ae.dependencies?.includes(B.id);return jsxs("button",{type:"button",onClick:()=>{let ce=ae.dependencies||[],ke;Z?ke=ce.filter($e=>$e!==B.id):ke=[...ce,B.id],je("dependencies",ke);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:Z?`${g.accent}10`:"transparent"},onMouseEnter:ce=>{Z||(ce.currentTarget.style.backgroundColor=g.hoverBg);},onMouseLeave:ce=>{ce.currentTarget.style.backgroundColor=Z?`${g.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:Z?g.accent:"transparent",borderColor:Z?g.accent:g.borderLight},children:Z&&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:g.textPrimary},children:B.name}),jsx("span",{className:"text-[10px]",style:{color:g.textTertiary},children:B.id.slice(0,8)})]})]},B.id)}),r.filter(B=>B.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:g.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${g.border}`},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:B=>B.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:g.accent,color:"#FFF"},onMouseEnter:B=>!n&&(B.currentTarget.style.opacity="0.9"),onMouseLeave:B=>!n&&(B.currentTarget.style.opacity="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 ru=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
358
|
+
Task dependencies must flow in one direction only.`);return}let j=se=>se.map(me=>{if(me.id===F){let ve=me.dependencies||[];if(!ve.includes(P.id))return {...me,dependencies:[...ve,P.id]}}return me.subtasks?{...me,subtasks:j(me.subtasks)}:me});ie(j(H)),Te?.(P.id,F);},[H,Te,Md]),Ad=useCallback((P,F)=>{let j=se=>se.map(me=>{if(me.id===P&&me.dependencies){let ve=me.dependencies.filter(wt=>wt!==F);return {...me,dependencies:ve}}return me.subtasks?{...me,subtasks:j(me.subtasks)}:me});ie(j(H)),A?.(P,F);},[H,A]),{startDate:$n,endDate:Cg}=useMemo(()=>{let P=H.filter(ve=>ve.startDate&&ve.endDate);if(P.length===0){let ve=new Date,wt=new Date(ve);wt.setDate(wt.getDate()-30);let je=new Date(ve);return je.setDate(je.getDate()+60),{startDate:wt,endDate:je}}let F=P.flatMap(ve=>[ve.startDate,ve.endDate]).filter(ve=>ve!==void 0),j=new Date(Math.min(...F.map(ve=>ve.getTime()))),se=new Date(Math.max(...F.map(ve=>ve.getTime()))),me=Qe==="day"?7:Qe==="week"?14:30;return j.setDate(j.getDate()-me),se.setDate(se.getDate()+me),{startDate:j,endDate:se}},[H,Qe]),Tg=useCallback(async()=>{if(!wr.current||!Ot.current||!Na.current)return;await new Promise(so=>setTimeout(so,200));let P=wr.current,F=Ot.current.querySelector(".gantt-grid-scroll"),j=Na.current,se=F?.scrollTop||0,me=F?.scrollLeft||0,ve=j.scrollTop,wt=j.scrollLeft,je=P.style.overflow,Vt=P.style.height,Ft=F?.style.overflow||"",pa=j.style.overflow,er=P.style.width,Mo=j.style.width;try{let so=F?.querySelector(".gantt-taskgrid-content"),Cr=j.querySelector("svg"),Hr=Cr?.getAttribute("height")?parseInt(Cr.getAttribute("height"),10):Cr?.getBoundingClientRect().height||0,Fo=so?.scrollHeight||F?.scrollHeight||600,io=Math.max(Hr,j.scrollHeight),Bd=Cr?.getAttribute("width")?parseInt(Cr.getAttribute("width"),10):Cr?.getBoundingClientRect().width||j.scrollWidth,Ag=P.querySelector('[class*="h-12"]')?.offsetHeight||48,ai=Math.max(Fo,io,Hr),ri=Ag+ai+50,oi=(F?.offsetWidth||300)+Bd+10;F&&(F.scrollTop=0,F.scrollLeft=0),j.scrollTop=0,j.scrollLeft=0,P.style.overflow="visible",P.style.height=`${ri}px`,P.style.width=`${oi}px`,F&&(F.style.overflow="visible",F.style.height=`${ai+50}px`),j.style.overflow="visible",j.style.height=`${ai+50}px`,j.style.width=`${Bd+10}px`,await new Promise(si=>setTimeout(si,150));let Lg=await Jm(P,{backgroundColor:kt.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:oi,height:ri,windowWidth:oi+100,windowHeight:ri+100,scrollX:0,scrollY:0,ignoreElements:si=>{let Rd=window.getComputedStyle(si),Od=parseInt(Rd.zIndex,10);return !isNaN(Od)&&Od>=50||Rd.position==="fixed"}}),ni=document.createElement("a");ni.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,ni.href=Lg.toDataURL("image/png"),ni.click();}finally{P.style.overflow=je,P.style.height=Vt,P.style.width=er,F&&(F.style.overflow=Ft,F.style.height="",F.scrollTop=se,F.scrollLeft=me),j.style.overflow=pa,j.style.height="",j.style.width=Mo,j.scrollTop=ve,j.scrollLeft=wt;}},[kt]),Ng=useCallback(async()=>{await xe.exportToPDF(H);},[H]),Dg=useCallback(async()=>{await xe.exportToExcel(H);},[H]),Sg=useCallback(()=>{let P=xe.exportToCSV(H),F=new Blob([P],{type:"text/csv;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(F),j.download="gantt-chart.csv",j.click(),URL.revokeObjectURL(j.href);},[H]),Eg=useCallback(()=>{let P=xe.exportToJSON(H),F=new Blob([P],{type:"application/json;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(F),j.download="gantt-chart.json",j.click(),URL.revokeObjectURL(j.href);},[H]),Pg=useCallback(()=>{xe.exportToMSProject(H,"Gantt Project","project.xml");},[H]),Mg=P=>{P.preventDefault(),ze(true);},Po=useRef(false),[ti,Ld]=useState(false),an=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let P=Na.current,F=Ot.current?.querySelector(".gantt-grid-scroll");if(!P||!F)return;let j=()=>{if(Po.current)return;Po.current=true;let je=P.scrollTop;Je(je),F.scrollTop=je,requestAnimationFrame(()=>{Po.current=false;});},se=()=>{if(Po.current)return;Po.current=true;let je=F.scrollTop;Je(je),P.scrollTop=je,requestAnimationFrame(()=>{Po.current=false;});},me=je=>{if(ot&&F){let Ft=F.parentElement?.getBoundingClientRect()?.left||0,pa=je.clientX-Ft,er=200,Mo=Za+Qa,so=window.innerWidth*Ne,Cr=Math.max(Mo,so);pa>=er&&pa<=Cr&&G(pa);}if(ti&&P){let Vt=je.clientX-an.current.x,Ft=je.clientY-an.current.y;P.scrollLeft=an.current.scrollLeft-Vt,P.scrollTop=an.current.scrollTop-Ft;}},ve=()=>{ze(false),Ld(false);},wt=je=>{if(je.button!==0)return;let Vt=je.target;Vt.closest("[data-task-bar]")||Vt.closest("[data-dependency-line]")||Vt.closest("button")||Vt.closest('[role="button"]')||Vt.tagName==="rect"&&Vt.getAttribute("data-clickable")==="true"||(Ld(true),an.current={x:je.clientX,y:je.clientY,scrollLeft:P.scrollLeft,scrollTop:P.scrollTop},je.preventDefault());};return P.addEventListener("scroll",j),F.addEventListener("scroll",se),P.addEventListener("mousedown",wt),document.addEventListener("mousemove",me),document.addEventListener("mouseup",ve),()=>{P.removeEventListener("scroll",j),F.removeEventListener("scroll",se),P.removeEventListener("mousedown",wt),document.removeEventListener("mousemove",me),document.removeEventListener("mouseup",ve);}},[ot,ti,Za]);let Id=useRef(false),Fg=useRef(null);return useLayoutEffect(()=>{if(Id.current||H.length===0||!Na.current)return;Id.current=true,Fg.current=$n;let P=Na.current,F=new Date,j=Qe==="day"?60:Qe==="week"?20:8,se=(F.getTime()-$n.getTime())/(1e3*60*60*24),me=P.clientWidth,wt=se*j*bt-me/2;se>=0&&me>0&&(P.scrollLeft=Math.max(0,wt));},[H.length,$n,Qe,bt]),jsx(_o.Provider,{value:Be,children:jsx(mi.Provider,{value:dr,children:jsxs("div",{ref:wr,className:"flex flex-col h-full w-full",style:{backgroundColor:kt.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx(fs,{theme:kt,timeScale:Qe,onTimeScaleChange:Ie,zoom:bt,onZoomChange:qe,currentTheme:Le,onThemeChange:Ue,rowDensity:Ke,onRowDensityChange:ht,showThemeSelector:m,showCreateTaskButton:b&&de?.canCreateTask!==false&&!de?.canCreateSubtaskOnly,createTaskLabel:x,onCreateTask:N,taskFilter:ne,onTaskFilterChange:O,hideCompleted:J,onHideCompletedChange:ce,onExportPNG:i?Tg:void 0,onExportPDF:i?Ng:void 0,onExportExcel:i?Dg:void 0,onExportCSV:i?Sg:void 0,onExportJSON:i?Eg:void 0,onExportMSProject:i?Pg:void 0}),jsxs("div",{ref:Ot,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:Rt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(vs,{tasks:Oe,theme:kt,rowHeight:Ze,availableUsers:c,templates:M,onTaskClick:R,onTaskDblClick:Pd,onTaskContextMenu:C,onTaskToggle:Da,scrollTop:$e,columns:it,onToggleColumn:la,onColumnResize:ba,onTaskUpdate:Ea,onTaskIndent:Pa,onTaskOutdent:Fa,onTaskMove:hg,onMultiTaskDelete:Qs,onTaskDuplicate:bg,onTaskCreate:yg,onTaskRename:vg,onCreateSubtask:ei,onOpenTaskModal:R?P=>R(P):void 0,onDeleteRequest:(P,F)=>X({taskId:P,taskName:F}),onTaskReparent:tn})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:kt.border,zIndex:15},onMouseDown:Mg}),jsx("div",{ref:Na,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:ti?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Ss,{tasks:Oe,theme:kt,rowHeight:Ze,timeScale:Qe,startDate:$n,endDate:Cg,zoom:bt,locale:y,templates:M,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:R,onTaskDblClick:Pd,onTaskContextMenu:kg,onTaskDateChange:xg,onDependencyCreate:Fd,onDependencyDelete:Ad})})]}),Y.task&&jsx(jo,{isOpen:Y.isOpen,x:Y.x,y:Y.y,theme:kt,onClose:()=>be({isOpen:false,x:0,y:0,task:null}),items:(()=>{let P=Y.task;if(!P)return [];let F=xe.findTaskById(H,P.id)||P,j=F.subtasks&&F.subtasks.length>0,se=de?.canCreateTask!==false,me=de?.canDeleteTask!==false;if(j){let Ft=[],pa=de?.canDuplicateTask!==false;return se&&Ft.push({id:"addSubtask",label:Be.contextMenu?.addSubtask||"Add Subtask",icon:At.Add,onClick:()=>{S?S(F):ei(F.id);}}),pa&&Ft.push({id:"duplicate",label:Be.contextMenu?.duplicateTask||"Duplicate Task",icon:At.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):ie(er=>vn(er,[F.id]).tasks),be({isOpen:false,x:0,y:0,task:null});}}),me&&(Ft.length>0&&Ft.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ft.push({id:"delete",label:Be.contextMenu?.deleteTask||"Delete Task",icon:At.Delete,onClick:()=>{X({taskId:F.id,taskName:F.name});}})),Ft}let ve=de?.canUpdateTask!==false,wt=de?.canDuplicateTask!==false,je=[];return ve&&je.push({id:"edit",label:Be.contextMenu?.editTask||"Edit Task",icon:At.Pencil,onClick:()=>{Q?Q(F):we(F);}}),se&&je.push({id:"addSubtask",label:Be.contextMenu?.addSubtask||"Add Subtask",icon:At.Add,onClick:()=>{S?S(F):ei(F.id);}}),je.length>0&&ve&&je.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),ve&&(je.push({id:"markIncomplete",label:Be.contextMenu?.markIncomplete||"Mark Incomplete",icon:At.MarkIncomplete,onClick:()=>{_?_(F):Ea(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"}),je.push({id:"setInProgress",label:Be.contextMenu?.setInProgress||"Set In Progress",icon:At.SetInProgress,onClick:()=>{oe?oe(F):Ea(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"}),je.push({id:"markComplete",label:Be.contextMenu?.markComplete||"Mark Complete",icon:At.MarkComplete,onClick:()=>{Ea(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"})),(wt||ve&&F.startDate&&F.endDate)&&je.length>0&&je.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),wt&&je.push({id:"duplicate",label:Be.contextMenu?.duplicateTask||"Duplicate Task",icon:At.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):ie(Ft=>vn(Ft,[F.id]).tasks),be({isOpen:false,x:0,y:0,task:null});}}),ve&&F.startDate&&F.endDate&&je.push({id:"split",label:Be.contextMenu?.splitTask||"Split Task",icon:At.Split,onClick:()=>{let Ft=F.startDate.getTime(),pa=F.endDate.getTime(),er=Ft+(pa-Ft)/2,Mo=new Date(er);wg(F,Mo);}}),me&&(je.length>0&&je.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),je.push({id:"delete",label:Be.contextMenu?.deleteTask||"Delete Task",icon:At.Delete,onClick:()=>{X({taskId:F.id,taskName:F.name});}})),je})()}),jsx(Ir,{task:Ye,isOpen:!!Ye,onClose:()=>we(null),onTaskUpdate:P=>{Ye&&(Ea(Ye.id,P),we(null));},theme:Le==="light"?"light":"dark",locale:y==="es"?"es":"en",availableUsers:c,availableTasks:t}),jsx(AnimatePresence,{children:Pe&&jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>X(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:kt.bgSecondary,border:`1px solid ${kt.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${kt.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:kt.textPrimary,fontFamily:"Inter, sans-serif"},children:[Be.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:kt.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsxs("p",{className:"text-sm leading-relaxed",style:{color:kt.textSecondary,fontFamily:"Inter, sans-serif"},children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:kt.textPrimary},children:['"',Pe.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:kt.bgPrimary,borderTop:`1px solid ${kt.border}`},children:[jsx("button",{onClick:()=>X(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:kt.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=kt.hoverBg;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{Qs([Pe.taskId]),X(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"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),g?.enabled&&jsx(Es,{tasks:H,theme:kt,config:g,onTasksUpdate:ie,onTaskUpdate:Ea,onTaskCreate:P=>{ie(F=>[...F,P]);},onTaskDelete:P=>{Qs([P]);},onDependencyCreate:(P,F)=>{let j=xe.findTaskById(H,P);j&&Fd(j,F);},onDependencyDelete:Ad})]})})})});function Ky(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 qy(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 d=parseInt(a[1],10),m=parseInt(a[2],10);return d*60+m}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 Nl=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Dl=[{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 au({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:d=a?"edit":"create",theme:m="dark",customStatuses:i=[],availableTags:c=[],onCreateTag:l,attachments:p=[],onUploadAttachments:f,onDeleteAttachment:v}){let w=[...Nl,...i.filter(O=>!Nl.some(J=>J.id===O.id))],g=tt[m]||tt.dark,[y,h]=useState(false),[b,x]=useState(false),[N,D]=useState(false),[T,k]=useState(false),[R,I]=useState({top:0,left:0}),[C,W]=useState(null),[B,Q]=useState(new Date),[S,_]=useState({top:0,left:0}),[oe,Te]=useState(false),[A,Ee]=useState([]),[L,U]=useState(false),[E,q]=useState(""),ee=useRef(null),de=useRef(null),he=useRef(null),ge=useRef(null),Le=useRef(null),[re,Qe]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Ie,Ke]=useState({});useEffect(()=>{a?(Qe({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||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&Te(true)):(Qe({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),Te(false),Ee([]));},[a,e]),useEffect(()=>{let O=J=>{ee.current&&!ee.current.contains(J.target)&&h(false),de.current&&!de.current.contains(J.target)&&x(false),he.current&&!he.current.contains(J.target)&&D(false),ge.current&&!ge.current.contains(J.target)&&k(false);};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);let ht=()=>{let O={};return re.name.trim()||(O.name="El nombre es requerido"),re.startDate&&re.endDate&&re.startDate>re.endDate&&(O.endDate="La fecha de fin debe ser posterior a la de inicio"),Ke(O),Object.keys(O).length===0},bt=async O=>{if(O.preventDefault(),!!ht())try{let J=d==="create"&&A.length>0?{...re,pendingFiles:A}:re;await s(J),Ee([]),t();}catch(J){console.error("Error submitting task:",J);}},qe=(O,J)=>{Qe(ce=>{let ke={...ce,[O]:J};if(O==="status"){let $e=J;$e==="todo"?ke.progress=0:$e==="in-progress"?(ce.progress===0||ce.progress===100)&&(ke.progress=50):$e==="completed"||$e==="closed"?ke.progress=100:($e==="in-review"||$e==="review")&&(ke.progress=75);}if(O==="progress"){let $e=typeof J=="number"?J:parseInt(J,10);$e===100&&ce.status!=="completed"?ke.status="completed":$e>0&&$e<100&&ce.status==="todo"?ke.status="in-progress":$e===0&&ce.status!=="todo"&&(ke.status="todo");}return ke}),Ie[O]&&Ke(ce=>{let ke={...ce};return delete ke[O],ke});},xt=w.find(O=>O.id===re.status)??Nl[0],ut=Dl.find(O=>O.id===re.priority)??Dl[1],yt=go.find(O=>O.value===re.color)??go[0],ne={backgroundColor:g.bgSecondary,border:`1px solid ${g.borderLight}`,color:g.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 bg-black/60 z-50",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-50 flex items-center justify-center p-4 pointer-events-none",children:jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden","data-theme":m,style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:O=>O.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:xt.color||g.accent}}),jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:d==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:O=>{O.currentTarget.style.backgroundColor=g.hoverBg,O.currentTarget.style.color=g.textPrimary;},onMouseLeave:O=>{O.currentTarget.style.backgroundColor="transparent",O.currentTarget.style.color=g.textTertiary;},disabled:n,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:bt,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxs("div",{className:"p-5 space-y-4",children:[jsxs("div",{children:[jsx("input",{type:"text",value:re.name,onChange:O=>qe("name",O.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:g.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Ie.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Ie.name]})]}),jsx("div",{children:jsx("textarea",{value:re.description||"",onChange:O=>qe("description",O.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:ee,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&h(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ne,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:y&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:w.map(O=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:J=>J.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:J=>J.currentTarget.style.backgroundColor="transparent",onClick:()=>{qe("status",O.id),h(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:O.color}}),O.title,re.status===O.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},O.id))})})]}),jsxs("div",{ref:de,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&x(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:ut.color}}),jsx("span",{children:ut.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),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-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:Dl.map(O=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:J=>J.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:J=>J.currentTarget.style.backgroundColor="transparent",onClick:()=>{qe("priority",O.id),x(false);},children:[jsx("span",{children:O.icon}),O.label,re.priority===O.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},O.id))})})]}),o.length>0&&jsxs("div",{ref:he,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&D(!N),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[re.assignees&&re.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:re.assignees.slice(0,3).map((O,J)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:O.color||g.accent,borderColor:g.bgSecondary},children:O.initials},J))}),re.assignees.length>3&&jsxs("span",{style:{color:g.textTertiary},children:["+",re.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsx(AnimatePresence,{children:N&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map(O=>{let J=re.assignees?.some(ce=>ce.name===O.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:ce=>ce.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:ce=>ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{let ce=J?(re.assignees||[]).filter(ke=>ke.name!==O.name):[...re.assignees||[],{name:O.name,avatar:O.avatar,initials:O.name.split(" ").map(ke=>ke[0]).join("").toUpperCase().slice(0,2),color:g.accent}];qe("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:g.accent},children:O.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:O.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:J&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},O.id)})})})]}),jsxs("div",{ref:ge,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(T)k(false);else {if(ge.current){let O=ge.current.getBoundingClientRect(),J=window.innerHeight,ce=120,$e=J-O.bottom<ce?O.top-ce-8:O.bottom+8;I({top:$e,left:O.left});}k(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ne,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:re.color}}),jsx("span",{children:yt.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsx(AnimatePresence,{children:T&&jsxs(gt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>k(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:`${R.top}px`,left:`${R.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:O=>O.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:go.slice(0,18).map(O=>{let J=re.color===O.value;return jsx("button",{type:"button",onClick:ce=>{ce.preventDefault(),ce.stopPropagation(),qe("color",O.value),k(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:O.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:O.value,outline:J?`2px solid ${O.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},O.value)})})})})]})})]}),c.length>0||l?jsx(_r,{selectedTags:re.tags||[],availableTags:c,onChange:O=>qe("tags",O),onCreateTag:l,theme:g,disabled:n}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxs("div",{ref:Le,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!re.isMilestone)if(C==="start")W(null);else {if(Le.current){let O=Le.current.getBoundingClientRect(),J=window.innerHeight,ce=320,$e=J-O.bottom<ce?O.top-ce-8:O.bottom+8;_({top:$e,left:O.left});}W("start"),Q(re.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ne,opacity:re.isMilestone?.5:1,cursor:re.isMilestone?"not-allowed":"pointer"},disabled:n||re.isMilestone,children:re.startDate?re.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!re.isMilestone)if(C==="end")W(null);else {if(Le.current){let O=Le.current.getBoundingClientRect(),J=window.innerHeight,ce=320,$e=J-O.bottom<ce?O.top-ce-8:O.bottom+8;_({top:$e,left:O.left});}W("end"),Q(re.endDate||re.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ne,opacity:re.isMilestone?.5:1,cursor:re.isMilestone?"not-allowed":"pointer"},disabled:n||re.isMilestone,children:re.endDate?re.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:C&&jsxs(gt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>W(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:`${S.top}px`,left:`${S.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:O=>O.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let O=new Date,J=new Date(O);J.setDate(O.getDate()+1);let ce=new Date(O);ce.setDate(O.getDate()+7);let ke=new Date(O);return ke.setDate(O.getDate()+14),[{label:"Hoy",date:O},{label:"Ma\xF1ana",date:J},{label:"Pr\xF3xima semana",date:ce},{label:"2 semanas",date:ke}].map((Je,ot)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:ze=>ze.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:ze=>ze.currentTarget.style.backgroundColor="transparent",onClick:()=>{C==="start"?(qe("startDate",Je.date),(!re.endDate||Je.date>re.endDate)&&qe("endDate",Je.date),W("end")):(qe("endDate",Je.date),(!re.startDate||Je.date<re.startDate)&&qe("startDate",Je.date),W(null));},children:Je.label},ot))})(),jsx("div",{style:{borderTop:`1px solid ${g.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:O=>O.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",onClick:()=>{qe("startDate",void 0),qe("endDate",void 0),W(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:()=>Q(new Date(B.getFullYear(),B.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:g.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:g.textPrimary},children:B.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>Q(new Date(B.getFullYear(),B.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:g.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((O,J)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:O},J))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=B.getFullYear(),J=B.getMonth(),ce=new Date(O,J,1).getDay(),ke=new Date(O,J+1,0).getDate(),$e=new Date,Je=[];for(let ze=ce-1;ze>=0;ze--)Je.push({day:new Date(O,J,-ze).getDate(),date:new Date(O,J-1,new Date(O,J,-ze).getDate()),isCurrentMonth:false});for(let ze=1;ze<=ke;ze++)Je.push({day:ze,date:new Date(O,J,ze),isCurrentMonth:true});let ot=42-Je.length;for(let ze=1;ze<=ot;ze++)Je.push({day:ze,date:new Date(O,J+1,ze),isCurrentMonth:false});return Je.map((ze,oa)=>{let G=ze.date.toDateString()===$e.toDateString(),Y=re.startDate?.toDateString()===ze.date.toDateString(),be=re.endDate?.toDateString()===ze.date.toDateString(),Ye=re.startDate&&re.endDate&&ze.date>=re.startDate&&ze.date<=re.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:ze.isCurrentMonth?Y||be?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:Y?"#3B82F6":be?"#7C3AED":Ye?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:G&&!Y&&!be?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{C==="start"?(qe("startDate",ze.date),re.endDate&&ze.date>re.endDate&&qe("endDate",ze.date),W("end")):(qe("endDate",ze.date),re.startDate&&ze.date<re.startDate&&qe("startDate",ze.date),W(null));},children:ze.day},oa)})})()})]})]})]})})]}),Ie.endDate&&jsx("span",{className:"text-xs text-red-400",children:Ie.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsx("input",{type:"range",min:"0",max:"100",step:"5",value:re.progress,onChange:O=>qe("progress",parseInt(O.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:re.progress<30?"#EF4444":re.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${re.progress<30?"#EF4444":re.progress<70?"#F59E0B":"#10B981"}20`,color:re.progress<30?"#EF4444":re.progress<70?"#F59E0B":"#10B981"},children:[re.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>Te(!oe),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:g.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${oe?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:oe&&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:g.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:g.textTertiary},children:"Duraci\xF3n estimada"})]}),jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:re.effortMinutes?Ky(re.effortMinutes):"",onChange:O=>{let J=qy(O.target.value);qe("effortMinutes",J);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:g.bgSecondary,color:g.textPrimary,border:`1px solid ${g.borderLight}`}}),jsx("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(f||p.length>0||d==="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:g.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:g.textTertiary},children:["Adjuntos ",d==="create"?A.length>0&&`(${A.length})`:p.length>0&&`(${p.length})`]})]}),d==="create"?jsx(Er,{cardId:"pending",attachments:A.map((O,J)=>({id:`pending-${J}`,cardId:"pending",name:O.name,size:O.size,type:O.type,url:URL.createObjectURL(O),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:O=>Ee(J=>[...J,...O]),onDelete:O=>{let J=parseInt(O.replace("pending-",""),10);Ee(ce=>ce.filter((ke,$e)=>$e!==J));},maxSizeMB:10,maxFiles:20}):jsx(Er,{cardId:a?.id||"new",attachments:p,onUpload:f&&a?.id?O=>f(a.id,O):void 0,onDelete:v,maxSizeMB:10,maxFiles:20}),d==="create"&&A.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[A.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 hover:bg-white/5",children:[jsx("input",{type:"checkbox",checked:re.isMilestone,onChange:O=>qe("isMilestone",O.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:g.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:g.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),re.dependencies&&re.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:re.dependencies.map(O=>{let J=r.find(ce=>ce.id===O);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${g.accent}20`,color:g.accent},children:[J?.name||O.slice(0,8),jsx("button",{type:"button",onClick:()=>{let ce=(re.dependencies||[]).filter(ke=>ke!==O);qe("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"})})]},O)})}),jsxs("button",{type:"button",onClick:()=>{U(!L),q("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:g.bgSecondary,color:g.textSecondary},disabled:n,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:L&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{U(false),q("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${g.border}`},children:jsx("input",{type:"text",value:E,onChange:O=>q(O.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:g.bgSecondary,color:g.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(O=>O.id!==a?.id).filter(O=>E===""||O.name.toLowerCase().includes(E.toLowerCase())).map(O=>{let J=re.dependencies?.includes(O.id);return jsxs("button",{type:"button",onClick:()=>{let ce=re.dependencies||[],ke;J?ke=ce.filter($e=>$e!==O.id):ke=[...ce,O.id],qe("dependencies",ke);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:J?`${g.accent}10`:"transparent"},onMouseEnter:ce=>{J||(ce.currentTarget.style.backgroundColor=g.hoverBg);},onMouseLeave:ce=>{ce.currentTarget.style.backgroundColor=J?`${g.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:J?g.accent:"transparent",borderColor:J?g.accent:g.borderLight},children:J&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:g.textPrimary},children:O.name}),jsx("span",{className:"text-[10px]",style:{color:g.textTertiary},children:O.id.slice(0,8)})]})]},O.id)}),r.filter(O=>O.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:g.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${g.border}`},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:O=>O.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:g.accent,color:"#FFF"},onMouseEnter:O=>!n&&(O.currentTarget.style.opacity="0.9"),onMouseLeave:O=>!n&&(O.currentTarget.style.opacity="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:d==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var ru=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
359
359
|
|
|
360
360
|
AVAILABLE COMMANDS:
|
|
361
361
|
1. move_task - Move a task to a different date
|
|
@@ -400,13 +400,13 @@ If ambiguous, ask for clarification in the message field.`;function ou(e){return
|
|
|
400
400
|
${nu(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(`
|
|
401
401
|
`)}
|
|
402
402
|
|
|
403
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function nu(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function $r(e,t){let a=nu(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 Sl(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 f={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(f!==void 0){let v=new Date(r),w=v.getDay(),g=f-w;return g<=0&&(g+=7),v.setDate(v.getDate()+g),v}}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),f=s[2].toLowerCase(),v=new Date(r);return f==="day"||f==="d\xEDa"||f==="dias"?v.setDate(v.getDate()+p):f==="week"||f==="semana"||f==="semanas"?v.setDate(v.getDate()+p*7):(f==="month"||f==="mes"||f==="meses")&&v.setMonth(v.getMonth()+p),v}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),f=parseInt(l[2],10)-1,v=parseInt(l[3],10);return new Date(v,f,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),f=c[i[2].toLowerCase()],v=i[3]?parseInt(i[3],10):r.getFullYear();if(f!==void 0)return new Date(v,f,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()],f=parseInt(d[2],10),v=d[3]?parseInt(d[3],10):r.getFullYear();if(p!==void 0)return new Date(v,p,f)}return null}function El(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 Pl(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 su(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 iu(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=$r(t,i),p=Sl(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 f=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(p);return v.setDate(v.getDate()+f),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:p,endDate:v},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=$r(t,i),p=El(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 f=new Date(d.endDate);return f.setDate(f.getDate()+p),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:f},message:`Extended "${d.name}" by ${p} days. New end date: ${f.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=$r(t,i),p=Pl(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=$r(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=$r(t,i),p=$r(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=$r(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 lu(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 qy(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 Yy(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Fs(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=>Fs(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:qy(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 du(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:Yy(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function cu(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Fs(r,e,t))}var Ml={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",tags:"Tags"},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"}},Fl={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",tags:"Etiquetas"},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"}},As={en:Ml,es:Fl};function Al(e){return As[e]||As.en}function Ls(e,t){let a=Al(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 Ll=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-blue-500"},{value:"completed",icon:CheckCircle2,color:"text-green-500"}];function mu(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 uu({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let f=v=>{l.current&&!l.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]);let c=mu(e),i=Ll[0],m=Ll.find(f=>f.value===c)??i,d=m.icon,p=f=>{switch(mu(f)){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-[#94A3B8]":"text-gray-500"),children:p(e)})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:f=>{f.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"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-[#94A3B8]":"text-gray-500"),children:p(e)}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-[#6B7280]":"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-[#1F2937] border-white/10":"bg-white border-gray-200"),children:Ll.map(f=>{let v=f.icon;return jsxs("button",{onClick:w=>{w.stopPropagation(),t(f.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",c===f.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsx(v,{className:u("w-4 h-4",f.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p(f.value)})]},f.value)})})]})}var Il=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function gu({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=Il.find(m=>m.value===e)??Il[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-[#94A3B8]":"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/10":"hover:bg-gray-100"),children:[jsx(Flag,{className:u("w-4 h-4",c.color)}),jsx("span",{className:u("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:c.label[i]}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-[#6B7280]":"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-[#1F2937] border-white/10":"bg-white border-gray-200"),children:Il.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/10":"hover:bg-gray-100",e===m.value&&(a?"bg-white/5":"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 Rs(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Os(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 gv(e,t){if(!e)return null;let a=Math.round(e.assignedHoursThisWeek/e.weeklyCapacity*100);switch(e.level){case "light":return {color:t?"text-green-400 bg-green-500/20":"text-green-600 bg-green-100",icon:null,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "moderate":return {color:t?"text-yellow-400 bg-yellow-500/20":"text-yellow-600 bg-yellow-100",icon:Clock,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "heavy":return {color:t?"text-orange-400 bg-orange-500/20":"text-orange-600 bg-orange-100",icon:Clock,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "overloaded":return {color:t?"text-red-400 bg-red-500/20":"text-red-600 bg-red-100",icon:AlertTriangle,label:`${a}%`,tooltip:`SOBRECARGADO: ${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`}}}function bu({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false,showWorkloadIndicators:n=true}){let[l,c]=useState(false),[i,m]=useState(""),d=useRef(null);useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&(c(false),m(""));};return l&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[l]);let p=t.filter(g=>g.name.toLowerCase().includes(i.toLowerCase())||g.email?.toLowerCase().includes(i.toLowerCase())),f=n?[...p].sort((g,y)=>{let h={light:0,moderate:1,heavy:2,overloaded:3},b=g.workload?.level??"light",x=y.workload?.level??"light";return h[b]-h[x]}):p,v=g=>e.some(y=>y.name===g),w=g=>{if(a)if(v(g.name))a(e.filter(y=>y.name!==g.name));else {let y={name:g.name,initials:Rs(g.name),color:g.color||Os(g.name).replace("bg-","").replace("-500",""),avatar:g.avatarUrl};a([...e,y]);}};return s||!a?e.length===0?jsx("span",{className:u("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((g,y)=>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-[#0F1117]":"border-white",!g.avatar&&Os(g.name)),style:g.color&&!g.avatar?{backgroundColor:g.color}:void 0,title:g.name,children:g.avatar?jsx("img",{src:g.avatar,alt:g.name,className:"w-full h-full rounded-full object-cover"}):g.initials||Rs(g.name)},`${g.name}-${y}`)),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-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:d,className:"relative",children:[jsx("button",{onClick:g=>{g.stopPropagation(),c(!l);},className:u("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:u("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsx(Plus,{className:u("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((g,y)=>jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!g.avatar&&Os(g.name)),style:g.color&&!g.avatar?{backgroundColor:g.color}:void 0,children:g.avatar?jsx("img",{src:g.avatar,alt:g.name,className:"w-full h-full rounded-full object-cover"}):g.initials||Rs(g.name)},`${g.name}-${y}`)),e.length>2&&jsxs("span",{className:u("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),l&&jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-72",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[n&&jsxs("div",{className:u("px-3 py-2 text-xs border-b flex items-center gap-3",r?"text-[#9CA3AF] border-white/10":"text-gray-500 border-gray-200"),children:[jsxs("span",{className:"flex items-center gap-1",children:[jsx("span",{className:"w-2 h-2 rounded-full bg-green-500"}),o==="es"?"Ligera":"Light"]}),jsxs("span",{className:"flex items-center gap-1",children:[jsx("span",{className:"w-2 h-2 rounded-full bg-yellow-500"}),o==="es"?"Moderada":"Moderate"]}),jsxs("span",{className:"flex items-center gap-1",children:[jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"}),o==="es"?"Alta":"Heavy"]})]}),jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsx("input",{type:"text",value:i,onChange:g=>m(g.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:u("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:g=>g.stopPropagation()})}),jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:f.length===0?jsx("p",{className:u("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):f.map(g=>{let y=gv(g.workload,r);return jsxs("button",{onClick:h=>{h.stopPropagation(),w(g);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",g.workload?.level==="overloaded"&&(r?"bg-red-500/5":"bg-red-50")),title:y?.tooltip,children:[jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!g.avatarUrl&&Os(g.name)),children:g.avatarUrl?jsx("img",{src:g.avatarUrl,alt:g.name,className:"w-full h-full rounded-full object-cover"}):Rs(g.name)}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:r?"text-white":"text-gray-900",children:g.name}),g.email&&jsx("div",{className:u("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:g.email})]}),n&&y&&jsxs("div",{className:u("flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",y.color),children:[y.icon&&jsx(y.icon,{className:"w-3 h-3"}),y.label]}),v(g.name)&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},g.id)})}),e.length>0&&jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((g,y)=>jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[g.name,jsx("button",{onClick:h=>{h.stopPropagation(),a(e.filter(b=>b.name!==g.name));},className:"hover:text-red-500",children:jsx(X,{className:"w-3 h-3"})})]},`${g.name}-${y}`))})]})]})}function xu({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),[f,v]=useState(()=>{let T=o==="start"?e:t;if(T){let k=T instanceof Date?T:new Date(T);return new Date(k.getFullYear(),k.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),w=useRef(null),g=e?e instanceof Date?e:new Date(e):null,y=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let T=k=>{w.current&&!w.current.contains(k.target)&&m(false);};return i&&document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[i]),useEffect(()=>{i&&p(r?o:"start");},[i,r,o]);let h=T=>T?T.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",b=useCallback(()=>{let T=f.getFullYear(),k=f.getMonth(),O=new Date(T,k,1),C=new Date(T,k+1,0).getDate(),H=O.getDay(),R=[],S=new Date(T,k,0).getDate();for(let ne=H-1;ne>=0;ne--)R.push({date:new Date(T,k-1,S-ne),isCurrentMonth:false});for(let ne=1;ne<=C;ne++)R.push({date:new Date(T,k,ne),isCurrentMonth:true});let G=42-R.length;for(let ne=1;ne<=G;ne++)R.push({date:new Date(T,k+1,ne),isCurrentMonth:false});return R},[f]),x=T=>{if(r)o==="start"?a(T,y||void 0):a(g||void 0,T),m(false);else if(d==="start"){let k=y&&T>y?T:y;a(T,k||void 0),p("end");}else {let k=g&&T<g?T:g;a(k||void 0,T),m(false);}},N=()=>{let T=new Date,k=new Date(T);k.setDate(T.getDate()+1);let O=new Date(T);O.setDate(T.getDate()+((6-T.getDay()+7)%7||7));let I=new Date(T);I.setDate(T.getDate()+((1-T.getDay()+7)%7||7));let C=new Date(T);C.setDate(T.getDate()+(6-T.getDay()+7)%7+7);let H=new Date(T);H.setDate(T.getDate()+14);let R=new Date(T);return R.setDate(T.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:k,display:k.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:O,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:C,display:C.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:H,display:H.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:R,display:R.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let T=r&&o==="start"?g:y;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-[#94A3B8]":"text-gray-500"),children:h(T)})]})}let D=r&&o==="start"?g:y;return jsxs("div",{ref:w,className:"relative",children:[jsxs("button",{onClick:T=>{T.stopPropagation(),m(!i);let k=o==="start"?g:y;k&&v(new Date(k.getFullYear(),k.getMonth(),1));},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-[#94A3B8]":"text-gray-500"),children:h(D)})]}),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-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:T=>T.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",s?"border-white/10":"border-gray-200"),children:[N().map((T,k)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>x(T.date),children:[jsx("span",{children:T.label}),jsx("span",{className:u("text-xs",s?"text-[#6B7280]":"text-gray-400"),children:T.display})]},k)),jsx("div",{className:u("border-t mt-2 pt-2",s?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,y||void 0):a(g||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/5 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/5 text-[#9CA3AF]":"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:f.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>v(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>v(new Date(f.getFullYear(),f.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>v(new Date(f.getFullYear(),f.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/10":"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(T=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-[#6B7280]":"text-gray-400"),children:T},T))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:b().map((T,k)=>{let O=T.date.toDateString()===new Date().toDateString(),I=g?.toDateString()===T.date.toDateString(),C=y?.toDateString()===T.date.toDateString(),H=I||C,R=!r&&g&&y&&T.date>=g&&T.date<=y;return jsx("button",{onClick:()=>x(new Date(T.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!T.isCurrentMonth&&(s?"text-[#4B5563]":"text-gray-300"),T.isCurrentMonth&&(s?"text-white":"text-gray-900"),O&&"ring-2 ring-[#3B82F6]",I&&"bg-[#3B82F6] text-white",C&&!I&&"bg-[#7C3AED] text-white",R&&!H&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!H&&(s?"hover:bg-white/10":"hover:bg-gray-100")),children:T.date.getDate()},k)})})]})]})]})]})}function $s({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(xu,{startDate:s==="start"?c:n||null,endDate:s==="end"?c:l||null,onChange:(p,f)=>{t&&t(s==="start"?p:f);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function Jo(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 zs(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,f=p-d,v=r/o;c(true);for(let w=1;w<=o;w++){let g=setTimeout(()=>{let y=w/o,h=1-Math.pow(1-y,3),b=Math.round(d+f*h);n(b),w===o&&(c(false),n(p));},v*w);m.current.push(g);}return i.current=e,()=>{m.current.forEach(clearTimeout),m.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function ku(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(f=>{c.current&&clearTimeout(c.current),i.current&&clearInterval(i.current),s(f),l(0);let v=Date.now();i.current=setInterval(()=>{let w=Date.now()-v,g=Math.min(w/a*100,100);l(g);},16),c.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(f),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 Tu({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let{isFlashing:n,triggerFlash:l}=Jo(),{displayValue:c,isAnimating:i}=zs(e,{enabled:o,duration:300,steps:6}),m=p=>{if(r||!t)return;p.stopPropagation();let f=p.currentTarget.getBoundingClientRect(),v=p.clientX-f.left,w=Math.round(v/f.width*100),g=Math.max(0,Math.min(100,w));g!==e&&(t(g),s&&l());},d=c??e;return jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-all duration-300",n&&(a?"bg-green-500/30":"bg-green-500/20")),children:[jsx("div",{onClick:m,className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:u("h-full rounded-full transition-all",d===100?"bg-green-500":"bg-[#3B82F6]",i&&"transition-none"),style:{width:`${d}%`}})}),jsxs("span",{className:u("text-xs w-8 text-right tabular-nums transition-all",a?"text-[#9CA3AF]":"text-gray-500",i&&"font-medium scale-105"),children:[d,"%"]})]})}function Su({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-[#94A3B8]":"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/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] 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-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function Mu({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()||""),f=useRef(null),{isFlashing:v,triggerFlash:w}=Jo(),{displayValue:g,isAnimating:y}=zs(e,{enabled:l&&!i});useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]),useEffect(()=>{p(e?.toString()||"");},[e]);let h=()=>{let x=parseFloat(d);if(!isNaN(x)){let N=x;o!==void 0&&(N=Math.max(o,N)),s!==void 0&&(N=Math.min(s,N)),N!==e&&(t?.(N),c&&w());}m(false);},b=x=>{x.key==="Enter"?h():x.key==="Escape"&&(p(e?.toString()||""),m(false));};return n||!t?jsx("span",{className:u("text-sm transition-all",a?"text-[#94A3B8]":"text-gray-500",y&&"font-medium"),children:g!==void 0?g:r}):i?jsx("input",{ref:f,type:"number",value:d,onChange:x=>p(x.target.value),onBlur:h,onKeyDown:b,onClick:x=>x.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsx("button",{onClick:x=>{x.stopPropagation(),m(true);},className:u("text-sm text-left w-full px-2 py-1 rounded transition-all duration-300",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",g===void 0&&(a?"text-[#6B7280]":"text-gray-400"),v&&(a?"bg-green-500/30":"bg-green-500/20"),y&&"font-medium scale-105"),children:g!==void 0?g:r})}function Fu({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-[#94A3B8]":"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/10":"hover:bg-gray-100"),children:[jsx("span",{className:u("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsx(ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"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-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:u("px-3 py-2 text-sm",r?"text-[#6B7280]":"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/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"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-[#3B82F6]"})]},i))})]})}function Lu({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}=ku(t,{delay:s}),d=f=>{f.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-all",p?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] 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-[#0F1117]":"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:f=>{f.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 Ru({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:u("text-sm",t?"text-[#6B7280]":"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-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#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/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function Iv(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 Bv(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 wo({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:l=false}){let[c,i]=useState(false),[m,d]=useState(""),p=useRef(null),{isFlashing:f,triggerFlash:v}=Jo(),w=Iv(e,r);useEffect(()=>{c&&p.current&&(p.current.focus(),p.current.select());},[c]),useEffect(()=>{if(e){let h=Math.floor(e/60),b=e%60;h>0&&b>0?d(`${h}h ${b}m`):h>0?d(`${h}h`):d(`${b}m`);}else d("");},[e,c]);let g=()=>{let h=Bv(m);h!==e&&(t?.(h),n&&v()),i(false);},y=h=>{h.key==="Enter"?g():h.key==="Escape"&&i(false);};return l?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-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-[#94A3B8]":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]}):s||!t?jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsx(Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm",a?"text-[#94A3B8]":"text-gray-500",(!e||e===0)&&(a?"text-[#6B7280]":"text-gray-400")),children:w})]}):c?jsx("input",{ref:p,type:"text",value:m,onChange:h=>d(h.target.value),onBlur:g,onKeyDown:y,onClick:h=>h.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white placeholder:text-[#6B7280]":"bg-white border-[#3B82F6] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:h=>{h.stopPropagation(),i(true);},className:u("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-all duration-300 overflow-hidden",a?"hover:bg-white/10":"hover:bg-gray-100",e!=null&&e>0?a?"text-[#94A3B8]":"text-gray-600":a?"text-[#6B7280]":"text-gray-400",f&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(Clock,{className:u("w-3 h-3 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:"truncate",children:w})]})}function Yv(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Xv(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 Wu({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:c,onColumnSort:i,availableUsers:m=[]}){let d=useRef(null),p=r==="es"?Uu.es:Uu.en;if(useEffect(()=>{let y=b=>{d.current&&!d.current.contains(b.target)&&t();},h=b=>{b.key==="Escape"&&t();};return document.addEventListener("mousedown",y),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",h);}},[t]),!e.isOpen)return null;let f=()=>{if(!e.task)return [];let y=[];return o&&y.push({id:"edit",label:p.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),y.push({id:"sep1",label:"",icon:null,separator:true}),l&&(y.push({id:"status",label:p.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:p.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:p.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:p.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),y.push({id:"priority",label:p.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:p.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:p.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:p.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:p.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),m.length>0&&y.push({id:"assign",label:p.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:m.slice(0,5).map(h=>({id:`assign-${h.id}`,label:h.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:h.name.charAt(0).toUpperCase()}),onClick:()=>{let b=e.task.assignees||[],N=b.some(D=>D.name===h.name)?b.filter(D=>D.name!==h.name):[...b,{name:h.name,initials:Yv(h.name),color:h.color||Xv(h.name),avatar:h.avatarUrl}];l({...e.task,assignees:N}),t();}}))})),y.push({id:"sep2",label:"",icon:null,separator:true}),s&&y.push({id:"duplicate",label:p.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&y.push({id:"delete",label:p.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),y},v=()=>{if(!e.columnId)return [];let y=[];return i&&(y.push({id:"sort-asc",label:p.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),y.push({id:"sort-desc",label:p.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(y.push({id:"sep-hide",label:"",icon:null,separator:true}),y.push({id:"hide",label:p.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),y},w=e.type==="task"?f():v(),g={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:d,style:g,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:w.map(y=>y.separator?jsx("div",{className:u("my-1 h-px",a?"bg-white/10":"bg-gray-200")},y.id):y.submenu?jsx(Jv,{item:y,isDark:a},y.id):jsxs("button",{onClick:y.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",y.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:u(y.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:y.icon}),y.label]},y.id))})}function Jv({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/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:u("w-4 h-4",t?"text-[#6B7280]":"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-[#0F1117] border-white/10":"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/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var Uu={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",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"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",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"}};var Yu={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"}),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"})},ux=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function Ju({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=useRef(null),f=l==="es"?Xu.es:Xu.en;if(useLayoutEffect(()=>{if(!e||!p.current)return;let b=()=>{if(!p.current)return;let x=p.current.getBoundingClientRect(),D=window.innerHeight-x.top-20;d(Math.max(300,D));};return requestAnimationFrame(b),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[e]),useEffect(()=>{if(!e)return;let b=setTimeout(()=>{let x=D=>{p.current&&!p.current.contains(D.target)&&t();},N=D=>{D.key==="Escape"&&t();};document.addEventListener("mousedown",x),document.addEventListener("keydown",N),p._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",N);};},100);return ()=>{clearTimeout(b),p._cleanup&&p._cleanup();}},[e,t]),!e)return null;let v=b=>f.columns[b]||b,w=b=>{if(b==="name")return;let x=a.map(N=>N.id===b?{...N,visible:!N.visible}:N);o(x);},g=(b,x)=>{let N=a.find(T=>T.type===b&&(!x||T.customFieldId===x));if(N){w(N.id);return}let D={id:x||b,type:b,label:x?r.find(T=>T.id===x)?.name||b:v(b),width:120,visible:true,sortable:true,resizable:true,customFieldId:x};o([...a,D]);},y=ux.filter(b=>v(b).toLowerCase().includes(c.toLowerCase())),h=r.filter(b=>b.name.toLowerCase().includes(c.toLowerCase()));return jsxs("div",{ref:p,style:m?{maxHeight:`${m}px`}:void 0,className:u("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50 flex flex-col",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:u("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:u("font-medium",n?"text-white":"text-gray-900"),children:f.title}),jsx("button",{onClick:t,className:u("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(X,{className:u("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsx("div",{className:"p-3",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsx("input",{type:"text",value:c,onChange:b=>i(b.target.value),placeholder:f.searchPlaceholder,className:u("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain",onWheel:b=>b.stopPropagation(),children:[jsxs("div",{className:"px-3 pb-2",children:[jsx("h4",{className:u("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:f.standardFields}),jsx("div",{className:"space-y-1",children:y.map(b=>{let x=a.find(T=>T.type===b&&!T.customFieldId),N=x?.visible??false,D=b==="name";return jsxs("button",{onClick:()=>{D||(x?w(x.id):g(b));},disabled:D,className:u("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",D&&"opacity-50 cursor-not-allowed"),children:[jsx("div",{className:u("w-5 h-5 rounded border flex items-center justify-center",N?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:N&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:Yu[b]}),jsx("span",{className:n?"text-white":"text-gray-900",children:v(b)})]},b)})})]}),h.length>0&&jsxs("div",{className:"px-3 pb-2",children:[jsx("h4",{className:u("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:f.customFields}),jsx("div",{className:"space-y-1",children:h.map(b=>{let N=a.find(D=>D.customFieldId===b.id)?.visible??false;return jsxs("button",{onClick:()=>g(b.type,b.id),className:u("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx("div",{className:u("w-5 h-5 rounded border flex items-center justify-center",N?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:N&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:Yu[b.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{className:n?"text-white":"text-gray-900",children:b.name})]},b.id)})})]})]})]})}var Xu={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",effortMinutes:"Estimated",timeLoggedMinutes:"Time Logged",soldEffortMinutes:"Quoted",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",effortMinutes:"Estimado",timeLoggedMinutes:"Tiempo Registrado",soldEffortMinutes:"Ofertado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var kx=[{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 ep({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[l,c]=useState("text"),[i,m]=useState([""]),d=o==="es"?Qu.es:Qu.en;useEffect(()=>{e&&(n(""),c("text"),m([""]));},[e]),useEffect(()=>{let g=y=>{y.key==="Escape"&&t();};return e&&document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]);let p=()=>{if(!s.trim())return;let g={name:s.trim(),type:l};l==="dropdown"&&(g.options=i.filter(y=>y.trim())),a(g),t();},f=()=>{m([...i,""]);},v=(g,y)=>{let h=[...i];h[g]=y,m(h);},w=g=>{i.length>1&&m(i.filter((y,h)=>h!==g));};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-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"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/10":"hover:bg-gray-100"),children:jsx(X,{className:u("w-5 h-5",r?"text-[#9CA3AF]":"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:g=>n(g.target.value),placeholder:d.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"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:kx.map(g=>jsxs("button",{onClick:()=>c(g.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===g.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:l===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:g.icon}),jsx("span",{className:u("text-xs",l===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:d.types[g.type]})]},g.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((g,y)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:g,onChange:h=>v(y,h.target.value),placeholder:`${d.option} ${y+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsx("button",{onClick:()=>w(y),className:u("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},y)),jsxs("button",{onClick:f,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"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-white/10":"border-gray-200"),children:[jsx("button",{onClick:t,className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"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-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var Qu={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 rp={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 op({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"?rp.es:rp.en;useEffect(()=>{if(!n)return;let f=w=>{Date.now()-i.current<100||c.current&&!c.current.contains(w.target)&&l(false);},v=w=>{w.key==="Escape"&&l(false);};return document.addEventListener("mousedown",f),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",v);}},[n]);let d=[{value:"all",label:m.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{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:f=>{f.stopPropagation(),n||(i.current=Date.now()),l(v=>!v);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-white/10 hover:bg-white/10 text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#3B82F6]/20 border-[#3B82F6]/50 text-[#3B82F6]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/10":"bg-gray-100")),children:[jsx(Filter,{className:"w-4 h-4"}),m.filters,p&&jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"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-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsx("div",{className:u("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:m.filterByStatus})}),jsx("div",{className:"py-2",children:d.map(f=>{let v=e===f.value&&!t,w=()=>f.value==="all"?v?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):f.icon;return jsxs("button",{onClick:()=>{a(f.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/10":"hover:bg-gray-100",v&&(o?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u(v?f.color:"text-gray-400","flex-shrink-0"),children:w()}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:f.label}),v&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},f.value)})}),jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let f=!t;r(f),f&&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/10":"hover:bg-gray-100",t&&(o?"bg-white/5":"bg-gray-50")),children:[jsx(EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"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-[#3B82F6]":"text-blue-500")})]})})]})]})}var Bx=[{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 lp(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(...lp(r.subtasks,t+1));return a}function dp({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:c=[]}){let{theme:i="dark",locale:m="en",customTranslations:d,showSearch:p=true,showHierarchy:f=true,tableColumns:v,allowColumnCustomization:w=true,allowColumnResize:g=true,enableContextMenu:y=true,showCreateTaskButton:h=false,onCreateTask:b,persistFilter:x=false,financialBlur:N}=t,D=Ls(m,d),T=i==="dark",k=useCallback(()=>{if(!x||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let W=localStorage.getItem(x);if(W){let Y=JSON.parse(W);return {statusFilter:Y.statusFilter||"all",hideCompleted:Y.hideCompleted||!1}}}catch(W){console.error("Error loading persisted filter:",W);}return {statusFilter:"all",hideCompleted:false}},[x]),[O,I]=useState("startDate"),[C,H]=useState("asc"),[R,Q]=useState(""),[S,G]=useState(()=>k().statusFilter),[ne,Ce]=useState(()=>k().hideCompleted),[A,Pe]=useState(v||Bx),[L,U]=useState(false),[E,q]=useState(false),[ee,fe]=useState({isOpen:false,x:0,y:0,type:"task"}),[ue,pe]=useState(null),[Oe,ae]=useState(0),[nt,Fe]=useState(0),qe=useRef(null);useEffect(()=>{v&&Pe(v);},[v]),useEffect(()=>{if(!(!x||typeof window>"u"))try{localStorage.setItem(x,JSON.stringify({statusFilter:S,hideCompleted:ne}));}catch(W){console.error("Error persisting filter state:",W);}},[x,S,ne]);let ut=useMemo(()=>{let W=new Set;function Y(be){for(let Ye of be)Ye.subtasks?.length&&(Ye.isExpanded!==false&&W.add(Ye.id),Y(Ye.subtasks));}return Y(e),W},[e]),St=useMemo(()=>A.filter(W=>W.visible),[A]),je=useCallback(W=>{a.onTaskToggleExpand?.(W);},[a]),Ft=useCallback(W=>{O===W?H(Y=>Y==="asc"?"desc":"asc"):(I(W),H("asc")),a.onSortChange?.({column:W,direction:C==="asc"?"desc":"asc"});},[O,C,a]),it=useCallback(W=>{Pe(W),a.onColumnsChange?.(W);},[a]),pt=useCallback(W=>{let Y=A.map(be=>be.id===W?{...be,visible:false}:be);it(Y);},[A,it]),ie=useCallback((W,Y)=>{I(W),H(Y);},[]),B=useCallback((W,Y,be)=>{y&&(W.preventDefault(),fe({isOpen:true,x:W.clientX,y:W.clientY,type:Y?"task":"header",task:Y,columnId:be}));},[y]),Z=useCallback(()=>{fe(W=>({...W,isOpen:false}));},[]),ce=useCallback((W,Y)=>{if(!g)return;W.preventDefault(),W.stopPropagation();let be=A.find(Ye=>Ye.id===Y);be&&(pe(Y),ae(W.clientX),Fe(be.width));},[A,g]);useEffect(()=>{if(!ue)return;let W=be=>{let Ye=be.clientX-Oe,Te=Math.max(50,nt+Ye),De=A.map(X=>X.id===ue?{...X,width:Te}:X);Pe(De);},Y=()=>{ue&&a.onColumnsChange?.(A),pe(null);};return document.addEventListener("mousemove",W),document.addEventListener("mouseup",Y),()=>{document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",Y);}},[ue,Oe,nt,A,a]);let ke=useCallback(async W=>{if(a.onCreateCustomField){let Y={...W,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(Y);}q(false);},[a]),$e=useCallback(W=>W.progress===100||W.status==="completed"?"completed":W.progress&&W.progress>0||W.status==="in-progress"?"in-progress":"todo",[]),Xe=useMemo(()=>{let W=lp(e);if(R.trim()){let Y=R.toLowerCase();W=W.filter(be=>be.name.toLowerCase().includes(Y));}return S!=="all"&&(W=W.filter(Y=>$e(Y)===S)),ne&&(W=W.filter(Y=>$e(Y)!=="completed")),W.sort((Y,be)=>{let Ye,Te;switch(O){case "name":Ye=Y.name.toLowerCase(),Te=be.name.toLowerCase();break;case "startDate":Ye=Y.startDate?.getTime()||0,Te=be.startDate?.getTime()||0;break;case "endDate":Ye=Y.endDate?.getTime()||0,Te=be.endDate?.getTime()||0;break;case "progress":Ye=Y.progress||0,Te=be.progress||0;break;case "status":Ye=Y.status||"todo",Te=be.status||"todo";break;case "priority":let De={urgent:0,high:1,medium:2,low:3,none:4};Ye=De[Y.priority]??4,Te=De[be.priority]??4;break;default:return 0}return Ye<Te?C==="asc"?-1:1:Ye>Te?C==="asc"?1:-1:0}),W},[e,R,S,ne,O,C,$e]),at=useCallback((W,Y)=>{let be=De=>{a.onTaskUpdate?.({...W,...De});},Ye=De=>De?W.customFields?.find(re=>re.fieldId===De)?.value:void 0,Te=(De,X)=>{if(!De)return;let _=[...W.customFields||[]],Ie=_.findIndex(Ae=>Ae.fieldId===De);Ie>=0?_[Ie]={fieldId:De,value:X}:_.push({fieldId:De,value:X}),be({customFields:_});};switch(Y.type){case "name":return null;case "status":return jsx(uu,{value:W.status||(W.progress===100?"completed":W.progress&&W.progress>0?"in-progress":"todo"),onChange:X=>{be({status:X,progress:X==="completed"?100:X==="in-progress"?50:0});},isDark:T,locale:m,translations:D.status});case "priority":return jsx(gu,{value:W.priority,onChange:X=>be({priority:X}),isDark:T,locale:m});case "assignees":return jsx(bu,{value:W.assignees||[],availableUsers:l,onChange:X=>be({assignees:X}),isDark:T,locale:m});case "startDate":return jsx($s,{value:W.startDate,onChange:X=>be({startDate:X}),isDark:T,locale:m,dateField:"start",startDate:W.startDate,endDate:W.endDate});case "endDate":return jsx($s,{value:W.endDate,onChange:X=>be({endDate:X}),isDark:T,locale:m,dateField:"end",startDate:W.startDate,endDate:W.endDate});case "progress":return jsx(Tu,{value:W.progress||0,onChange:X=>{let re=X===100?"completed":X>0?"in-progress":"todo";be({progress:X,status:re});},isDark:T});case "tags":return jsx(Ru,{value:W.tags||[],isDark:T});case "text":return jsx(Su,{value:Ye(Y.customFieldId)||"",onChange:X=>Te(Y.customFieldId,X),isDark:T});case "number":return jsx(Mu,{value:Ye(Y.customFieldId)||0,onChange:X=>Te(Y.customFieldId,X),isDark:T});case "date":let De=Ye(Y.customFieldId);return jsx($s,{value:De?new Date(De):void 0,onChange:X=>Te(Y.customFieldId,X),isDark:T,locale:m});case "dropdown":return jsx(Fu,{value:Ye(Y.customFieldId)||"",options:Y.options||[],onChange:X=>Te(Y.customFieldId,X),isDark:T});case "checkbox":return jsx(Lu,{value:Ye(Y.customFieldId)||false,onChange:X=>Te(Y.customFieldId,X),isDark:T});case "estimatedTime":{let X=W.status==="completed"||W.progress===100;return jsx(wo,{value:W.estimatedTime,onChange:re=>be({estimatedTime:re}),isDark:T,locale:m,disabled:X})}case "quotedTime":{let X=W.status==="completed"||W.progress===100,re=N?.enabled&&(!N.columns||N.columns.includes("quotedTime"));return jsx(wo,{value:W.quotedTime,onChange:_=>be({quotedTime:_}),isDark:T,locale:m,disabled:X,isBlurred:re})}case "elapsedTime":{let X=W.status==="completed"||W.progress===100;return jsx(wo,{value:W.elapsedTime,onChange:re=>be({elapsedTime:re}),isDark:T,locale:m,disabled:X})}case "effortMinutes":{let X=W.status==="completed"||W.progress===100;return jsx(wo,{value:W.effortMinutes,onChange:re=>be({effortMinutes:re}),isDark:T,locale:m,disabled:X})}case "timeLoggedMinutes":{let X=W.status==="completed"||W.progress===100;return jsx(wo,{value:W.timeLoggedMinutes,onChange:a.onLogTime?re=>{a.onLogTime?.(W,re);}:void 0,isDark:T,locale:m,placeholder:m==="es"?"Agregar":"Add",disabled:X})}case "soldEffortMinutes":{let X=W.status==="completed"||W.progress===100,re=N?.enabled&&(!N.columns||N.columns.includes("soldEffortMinutes"));return jsx(wo,{value:W.soldEffortMinutes,onChange:_=>be({soldEffortMinutes:_}),isDark:T,locale:m,disabled:X,isBlurred:re})}default:return jsx("span",{className:u("text-sm",T?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,T,m,l,D]),ze=useCallback(W=>{let be={name:D.columns.name,status:D.columns.status,priority:D.columns.priority,assignees:D.columns.assignees,startDate:D.columns.startDate,endDate:D.columns.endDate,progress:D.columns.progress,tags:D.columns.tags||(m==="es"?"Etiquetas":"Tags"),estimatedTime:D.columns.estimatedTime||(m==="es"?"Estimado":"Estimated"),quotedTime:D.columns.quotedTime||(m==="es"?"Ofertado":"Quoted"),elapsedTime:D.columns.elapsedTime||(m==="es"?"Tiempo":"Time Spent"),effortMinutes:D.columns.effortMinutes||(m==="es"?"Estimado":"Estimated"),timeLoggedMinutes:D.columns.timeLoggedMinutes||(m==="es"?"Tiempo":"Time Logged"),soldEffortMinutes:D.columns.soldEffortMinutes||(m==="es"?"Ofertado":"Quoted")}[W.type]||W.label;return typeof be=="string"?be:String(be||W.type)},[D,m]),oa=useMemo(()=>St.reduce((W,Y)=>W+Y.width,0)+(w?48:0),[St,w]);return r?jsx("div",{className:u("flex-1 flex items-center justify-center",T?"bg-[#0F1117]":"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-[#3B82F6]"}),jsxs("p",{className:u("text-sm",T?"text-[#9CA3AF]":"text-gray-600"),children:[D.empty.noTasks,"..."]})]})}):o?jsx("div",{className:u("flex-1 flex items-center justify-center",T?"bg-[#0F1117]":"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",T?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",T?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",T?"bg-[#0F1117]":"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-[#3B82F6]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:u("text-lg font-semibold mb-2",T?"text-white":"text-gray-900"),children:D.empty.noTasks}),jsx("p",{className:u("text-sm",T?"text-[#9CA3AF]":"text-gray-600"),children:D.empty.addFirstTask})]})}):jsxs("div",{ref:qe,className:u("flex-1 flex flex-col w-full h-full overflow-hidden",T?"bg-[#0F1117]":"bg-white",ue&&"select-none",s),style:n,children:[jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",T?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsx(op,{value:S,hideCompleted:ne,onChange:G,onHideCompletedChange:Ce,isDark:T,locale:m}),jsxs("div",{className:u("text-sm",T?"text-[#9CA3AF]":"text-gray-600"),children:[Xe.length," ",D.pagination.tasks]}),p&&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",T?"text-[#9CA3AF]":"text-gray-400")}),jsx("input",{type:"text",value:R,onChange:W=>Q(W.target.value),placeholder:D.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",T?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),h&&b&&jsxs(motion.button,{onClick:b,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 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-4 h-4"}),jsx("span",{children:D.toolbar.newTask})]})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsxs("div",{style:{minWidth:oa},children:[jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",T?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[St.map(W=>jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-3",T?"text-[#9CA3AF]":"text-gray-500"),style:{width:W.width,minWidth:W.minWidth},onContextMenu:Y=>B(Y,void 0,W.id),children:[W.sortable?jsxs("button",{onClick:()=>Ft(W.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[ze(W),jsx(ArrowUpDown,{className:u("w-3 h-3",O===W.id&&"text-[#3B82F6]")})]}):jsx("span",{children:ze(W)}),g&&W.resizable&&jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",ue===W.id&&"bg-[#3B82F6]"),onMouseDown:Y=>ce(Y,W.id)})]},W.id)),w&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsx("button",{onClick:W=>{W.stopPropagation(),U(Y=>!Y);},className:u("p-1.5 rounded-lg transition-colors",T?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",L&&(T?"bg-white/10":"bg-gray-200")),title:m==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-4 h-4"})}),jsx(Ju,{isOpen:L,onClose:()=>U(false),columns:A,customFields:c,onColumnsChange:it,onCreateCustomField:()=>{U(false),q(true);},isDark:T,locale:m})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Xe.map((W,Y)=>{let be=ut.has(W.id),Ye=Math.min(Y*.01,.2);return jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ye},className:u("flex items-center border-b transition-colors",T?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(W),onDoubleClick:()=>a.onTaskDoubleClick?.(W),onContextMenu:Te=>B(Te,W),children:[St.map(Te=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:Te.width,minWidth:Te.minWidth},children:Te.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[f&&W.level>0&&jsx("div",{style:{width:`${W.level*24}px`},className:"flex-shrink-0"}),f&&W.hasChildren&&jsx("button",{onClick:De=>{De.stopPropagation(),je(W.id);},className:u("p-0.5 rounded flex-shrink-0",T?"hover:bg-white/10":"hover:bg-gray-200"),children:be?jsx(ChevronDown,{className:u("w-4 h-4",T?"text-[#9CA3AF]":"text-gray-400")}):jsx(ChevronRight,{className:u("w-4 h-4",T?"text-[#9CA3AF]":"text-gray-400")})}),f&&!W.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsx("span",{className:u("truncate font-medium",T?"text-white":"text-gray-900",W.progress===100&&(T?"line-through text-[#6B7280]":"line-through text-gray-400")),children:W.name})]}):at(W,Te)},Te.id)),w&&jsx("div",{className:"w-12 flex-shrink-0"})]},W.id)})}),Xe.length===0&&R&&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",T?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:u(T?"text-[#9CA3AF]":"text-gray-600"),children:D.empty.noResults})]})})]})}),jsx(Wu,{state:ee,onClose:Z,isDark:T,locale:m,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:pt,onColumnSort:ie,availableUsers:l}),jsx(ep,{isOpen:E,onClose:()=>q(false),onSave:ke,isDark:T,locale:m})]})}var cp=[{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:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,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:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Time Logged",width:100,visible:false,sortable:true,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true}],mp=[{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"}],up=[{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 jl={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},Kl={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"},ql={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"},Ws={dark:jl,light:Kl,neutral:ql};function pp(e){return Ws[e]||Ws.dark}var Yl={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"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Xl={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"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Gs={en:Yl,es:Xl};function Sn(e){return Gs[e]||Gs.en}function Vs(e,t){let a=Sn(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 gp(e){let t=Sn(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 fp(e,t=0,a=true){let r=Sn(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 xp(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 Zl(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 kp({task:e}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsx(Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function Cp({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:f,mentionableUsers:v,onUploadCommentAttachments:w,onTaskOpen:g,enableTimeTracking:y,timeTrackingSummary:h,timeEntries:b,timerState:x,onLogTime:N,onUpdateEstimate:D,onUpdateSoldEffort:T,onStartTimer:k,onStopTimer:O,onDiscardTimer:I,blurFinancials:C=false}){let{theme:H="dark",locale:R="en",customTranslations:Q}=t,S=Vs(R,Q),G=H==="dark",[ne,Ce]=useState(r||new Date),[A,Pe]=useState(null),[L,U]=useState(null),[E,q]=useState({}),ee=4,fe=3,[ue,pe]=useState(null),[Oe,ae]=useState(""),[nt,Fe]=useState(void 0),[qe,ut]=useState(null),[St,je]=useState(false),[Ft,it]=useState(false),[pt,ie]=useState(null),[B,Z]=useState(false),[ce,ke]=useState(new Date),$e=useCallback(()=>{Ce(new Date(ne.getFullYear(),ne.getMonth()-1,1));},[ne]),Xe=useCallback(()=>{Ce(new Date(ne.getFullYear(),ne.getMonth()+1,1));},[ne]),at=useCallback(()=>{Ce(new Date);},[]),ze=useMemo(()=>{let Y=ne.getFullYear(),be=ne.getMonth(),Ye=new Date(Y,be,1),Te=new Date(Y,be+1,0),De=Ye.getDay(),X=Te.getDate(),re=xp(e),_=new Date;_.setHours(0,0,0,0);let Ie=[],Ae=De,Ge=new Date(Y,be,0).getDate();for(let Be=Ae-1;Be>=0;Be--){let z=new Date(Y,be-1,Ge-Be);Ie.push({date:z,isCurrentMonth:false,isToday:false,isWeekend:z.getDay()===0||z.getDay()===6,events:re.filter(j=>Zl(z,j)).map(j=>({id:j.id,title:j.name,start:j.startDate,end:j.endDate,task:j}))});}for(let Be=1;Be<=X;Be++){let z=new Date(Y,be,Be),j=z.getTime()===_.getTime();Ie.push({date:z,isCurrentMonth:true,isToday:j,isWeekend:z.getDay()===0||z.getDay()===6,events:re.filter(ye=>Zl(z,ye)).map(ye=>({id:ye.id,title:ye.name,start:ye.startDate,end:ye.endDate,task:ye}))});}let He=42-Ie.length;for(let Be=1;Be<=He;Be++){let z=new Date(Y,be+1,Be);Ie.push({date:z,isCurrentMonth:false,isToday:false,isWeekend:z.getDay()===0||z.getDay()===6,events:re.filter(j=>Zl(z,j)).map(j=>({id:j.id,title:j.name,start:j.startDate,end:j.endDate,task:j}))});}return Ie},[ne,e]),oa=R==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],W=ne.toLocaleDateString(R==="es"?"es-ES":"en-US",{month:"long",year:"numeric"});return o?jsx("div",{className:u("flex-1 flex items-center justify-center",G?"bg-[#0F1117]":"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-[#3B82F6]"}),jsxs("p",{className:u("text-sm",G?"text-[#9CA3AF]":"text-gray-600"),children:[S.labels.noEvents,"..."]})]})}):s?jsx("div",{className:u("flex-1 flex items-center justify-center",G?"bg-[#0F1117]":"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:"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",G?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",G?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",G?"bg-[#0F1117]":"bg-white",n),style:l,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsx(Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:u("text-lg font-semibold mb-2",G?"text-white":"text-gray-900"),children:S.labels.noEvents}),jsx("p",{className:u("text-sm",G?"text-[#9CA3AF]":"text-gray-600"),children:S.labels.newTask})]})}):jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-auto",G?"bg-[#0F1117]":"bg-white",n),style:l,children:[jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",G?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-4",children:[jsx("h2",{className:u("text-xl font-semibold capitalize",G?"text-white":"text-gray-900"),children:W}),jsx("button",{onClick:at,className:u("px-3 py-1.5 text-sm rounded-lg transition-colors",G?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:S.navigation.today})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{onClick:$e,className:u("p-2 rounded-lg transition-colors",G?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:u("w-5 h-5",G?"text-[#9CA3AF]":"text-gray-600")})}),jsx("button",{onClick:Xe,className:u("p-2 rounded-lg transition-colors",G?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:u("w-5 h-5",G?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxs("div",{className:"flex flex-col",children:[jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:oa.map(Y=>jsx("div",{className:u("py-2 text-center text-xs font-medium uppercase",G?"text-[#9CA3AF]":"text-gray-500"),children:Y},Y))}),jsx("div",{className:u("grid grid-cols-7 auto-rows-min gap-px rounded-lg",G?"bg-[#2D2D2D]":"bg-gray-300"),children:ze.map((Y,be)=>{let Ye=Y.date.getDay()===0||Y.date.getDay()===6;return jsxs("div",{className:u("min-h-[120px] p-2 transition-colors flex flex-col relative group",G?Ye?"bg-[#1C1F26]":Y.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":Ye?"bg-gray-100":Y.isCurrentMonth?"bg-white":"bg-gray-50",Y.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Te=E[be]||ee,De=Y.events.slice(0,Te),X=Y.events.length-Te;return jsxs("div",{className:"space-y-1 flex-1",children:[De.map(re=>jsx("div",{className:"relative group",children:jsxs(motion.button,{onClick:()=>{Pe(re.task),a.onEventClick?.(re),g?.(re.task.id);},whileHover:{scale:1.02},className:u("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",re.task.progress===100?G?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":G?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsx(kp,{task:re.task}),jsx("span",{className:"truncate",children:re.title})]})},re.id)),X>0&&jsxs("button",{onClick:re=>{re.stopPropagation(),q(_=>({..._,[be]:Te+fe}));},className:u("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",G?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",X," ",R==="es"?"M\xC1S":"MORE"]}),Te>ee&&Y.events.length>ee&&jsx("button",{onClick:re=>{re.stopPropagation(),q(_=>({..._,[be]:ee}));},className:u("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",G?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:R==="es"?"MENOS":"LESS"})]})})(),jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Te=be>=28,De=be%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:X=>{X.stopPropagation(),ue===be?pe(null):(pe(be),ae(""),Fe(void 0),ut(null),ie(null),je(false),it(false),Z(false),ke(Y.date));},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",ue===be?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",G?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsx(Plus,{className:u("w-3.5 h-3.5 transition-transform",ue===be&&"rotate-45")})}),jsx(AnimatePresence,{children:ue===be&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{pe(null),ae(""),Fe(void 0),ut(null),ie(null),je(false),it(false),Z(false);}}),jsxs(motion.div,{initial:{opacity:0,y:Te?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Te?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",Te?"bottom-full mb-1":"top-full mt-1",De?"right-0":"left-0",G?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>{X.stopPropagation(),je(false),it(false),Z(false);},children:[jsx("div",{className:"p-2.5",children:jsx("input",{type:"text",value:Oe,onChange:X=>ae(X.target.value),placeholder:R==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:u("w-full bg-transparent text-sm outline-none placeholder:opacity-40",G?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:X=>{if(X.key==="Enter"&&Oe.trim()){let re=t.availableUsers?.find(Ie=>Ie.id===qe),_=pt||Y.date;a.onTaskCreate?.({name:Oe.trim(),startDate:_,endDate:_,priority:nt,assignees:re?[re]:void 0}),ae(""),Fe(void 0),ut(null),ie(null),pe(null);}X.key==="Escape"&&(pe(null),ae(""),Fe(void 0),ut(null),ie(null));}})}),jsxs("div",{className:u("px-2.5 py-2 flex items-center justify-between border-t",G?"border-white/10":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:X=>{X.stopPropagation(),je(!St),it(false);},className:u("p-1 rounded transition-colors",nt?nt==="urgent"||nt==="high"?"text-red-400 bg-red-500/20":nt==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":G?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:St&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",G?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[{id:"urgent",label:R==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:R==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:R==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:R==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:R==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(X=>jsxs("button",{onClick:()=>{Fe(X.id),je(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",G?"hover:bg-white/5":"hover:bg-gray-50",nt===X.id&&(G?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",X.color)}),jsx("span",{className:G?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:X=>{X.stopPropagation(),Z(!B),je(false),it(false),ke(pt||Y.date);},className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",pt?"bg-[#7C3AED]/20 text-[#7C3AED]":G?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),(pt||Y.date).toLocaleDateString(R==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:B&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",G?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsx("div",{className:u("w-40 py-2 border-r",G?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,re=new Date(X);re.setDate(X.getDate()+1);let _=new Date(X);_.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let Ie=new Date(X);Ie.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let Ae=new Date(X);Ae.setDate(X.getDate()+14);let Ge=new Date(X);return Ge.setDate(X.getDate()+28),[{label:R==="es"?"Hoy":"Today",date:X,display:X.toLocaleDateString(R==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:R==="es"?"Ma\xF1ana":"Tomorrow",date:re,display:re.toLocaleDateString(R==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:R==="es"?"Este fin de semana":"This weekend",date:_,display:R==="es"?"s\xE1b.":"sat."},{label:R==="es"?"Pr\xF3xima semana":"Next week",date:Ie,display:R==="es"?"lun.":"mon."},{label:R==="es"?"2 semanas":"2 weeks",date:Ae,display:Ae.toLocaleDateString(R==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:R==="es"?"4 semanas":"4 weeks",date:Ge,display:Ge.toLocaleDateString(R==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Be,z)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",G?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{ie(Be.date),Z(false);},children:[jsx("span",{children:Be.label}),jsx("span",{className:u("text-[10px]",G?"text-[#6B7280]":"text-gray-400"),children:Be.display})]},z))})()}),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",G?"text-white":"text-gray-900"),children:ce.toLocaleDateString(R==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>ke(new Date),className:u("px-1.5 py-0.5 rounded text-[10px] transition-colors",G?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:R==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>ke(new Date(ce.getFullYear(),ce.getMonth()-1)),className:u("p-0.5 rounded",G?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:()=>ke(new Date(ce.getFullYear(),ce.getMonth()+1)),className:u("p-0.5 rounded",G?"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:(R==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px]",G?"text-[#6B7280]":"text-gray-400"),children:X},X))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=ce.getFullYear(),re=ce.getMonth(),_=new Date(X,re,1).getDay(),Ie=new Date(X,re+1,0).getDate(),Ae=new Date(X,re,0).getDate(),Ge=new Date,He=[];for(let z=_-1;z>=0;z--)He.push({dayNum:Ae-z,isCurrentMonth:false,date:new Date(X,re-1,Ae-z)});for(let z=1;z<=Ie;z++)He.push({dayNum:z,isCurrentMonth:true,date:new Date(X,re,z)});let Be=42-He.length;for(let z=1;z<=Be;z++)He.push({dayNum:z,isCurrentMonth:false,date:new Date(X,re+1,z)});return He.map((z,j)=>{let ye=z.date.toDateString()===Ge.toDateString(),Ve=(pt||Y.date).toDateString()===z.date.toDateString();return jsx("button",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!z.isCurrentMonth&&(G?"text-[#4B5563]":"text-gray-300"),z.isCurrentMonth&&(G?"text-white":"text-gray-900"),ye&&"ring-1 ring-[#3B82F6]",Ve&&"bg-[#7C3AED] text-white",!Ve&&(G?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{ie(z.date),Z(false);},children:z.dayNum},j)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:X=>{X.stopPropagation(),it(!Ft),je(false);},className:u("p-1 rounded transition-colors",qe?"text-[#7C3AED] bg-[#7C3AED]/20":G?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:qe?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(X=>X.id===qe)?.color||"#7C3AED"},children:t.availableUsers?.find(X=>X.id===qe)?.initials||t.availableUsers?.find(X=>X.id===qe)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:Ft&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",G?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxs("button",{onClick:()=>{ut(null),it(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",G?"hover:bg-white/5":"hover:bg-gray-50",!qe&&(G?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",G?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:G?"text-[#9CA3AF]":"text-gray-500",children:R==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(X=>jsxs("button",{onClick:()=>{ut(X.id),it(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",G?"hover:bg-white/5":"hover:bg-gray-50",qe===X.id&&(G?"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-medium",style:{backgroundColor:X.color||"#7C3AED"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsx("span",{className:G?"text-white":"text-gray-900",children:X.name})]},X.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsx("div",{className:u("px-3 py-2 text-xs",G?"text-[#6B7280]":"text-gray-400"),children:R==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:()=>{if(Oe.trim()){let X=t.availableUsers?.find(_=>_.id===qe),re=pt||Y.date;a.onTaskCreate?.({name:Oe.trim(),startDate:re,endDate:re,priority:nt,assignees:X?[X]:void 0}),ae(""),Fe(void 0),ut(null),ie(null),pe(null);}},disabled:!Oe.trim(),className:u("px-2.5 py-1 rounded text-xs font-medium transition-colors",Oe.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":G?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:R==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsx("span",{className:u("text-sm font-medium",Y.isToday?"text-[#3B82F6]":Y.isCurrentMonth?G?"text-white":"text-gray-900":G?"text-[#6B7280]":"text-gray-400"),children:Y.date.getDate()})]})]},be)})})]})}),jsx(Ar,{task:A,isOpen:!!A,onClose:()=>Pe(null),onTaskUpdate:Y=>{a.onTaskUpdate?.(Y),Pe(Y);},theme:H==="dark"?"dark":"light",locale:R,availableUsers:t.availableUsers?.map(Y=>({id:Y.id,name:Y.name,avatar:Y.avatar,initials:Y.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:c,onCreateTag:i,attachments:A?m?.get(A.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:xp(e).filter(Y=>Y.id!==A?.id),comments:d?.filter(Y=>Y.taskId===A?.id).map(Y=>({...Y,createdAt:Y.createdAt instanceof Date?Y.createdAt:new Date(Y.createdAt),updatedAt:Y.updatedAt instanceof Date?Y.updatedAt:Y.updatedAt?new Date(Y.updatedAt):void 0})),onAddComment:p,currentUser:f,mentionableUsers:v,onUploadCommentAttachments:w,enableTimeTracking:y,timeTrackingSummary:h,timeEntries:b,isTimerRunning:x?.isRunning,timerElapsedSeconds:x?.elapsedSeconds,onTimeLog:N,onEstimateUpdate:D,onSoldEffortUpdate:T,onTimerStart:k,onTimerStop:O,onTimerDiscard:I,blurFinancials:C}),jsx(AnimatePresence,{children:L&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>U(null),className:"fixed inset-0 bg-black/30 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",G?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",G?"border-white/10":"border-gray-200"),children:[jsx("span",{className:u("font-medium",G?"text-white":"text-gray-900"),children:L.date.toLocaleDateString(R==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>U(null),className:u("p-1 rounded",G?"hover:bg-white/10 text-[#9CA3AF]":"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-2",children:L.events.map(Y=>jsxs("button",{onClick:()=>{U(null),Pe(Y.task),g?.(Y.task.id);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",G?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx(kp,{task:Y.task}),jsx("span",{className:u("text-sm truncate flex-1",G?"text-white":"text-gray-900"),children:Y.title}),Y.task.priority==="high"||Y.task.priority==="urgent"?jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},Y.id))})]})]})})]})}var Ql={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},ed={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"},td={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"},_s={dark:Ql,light:ed,neutral:td};function Tp(e){return _s[e]||_s.dark}function _x({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(f=>e.cardIds.includes(f.id)),[t,e.cardIds]),d=useMemo(()=>{let f=m.length,v=new Set(m.flatMap(y=>y.assignedUserIds||[])).size,w=m.map(y=>y.priority).filter(Boolean),g=new Set(m.flatMap(y=>y.labels||[])).size;return {totalCards:f,uniqueAssignees:v,priorities:w,labels:g}},[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:f=>{f.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(f=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(f),children:a(f)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(f),children:[jsx("h4",{children:f.title}),f.description&&jsxs("p",{children:[f.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),s?.(e.id,f.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"})]})})]},f.id))})})]})}var Dp={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Pn(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 Mn(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 Sp(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 Ep({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let c=useMemo(()=>({...Dp,...n}),[n]),[i,m]=useState(new Set),d=useRef(null),p=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(b=>{let x=b.timestamp.toISOString().split("T")[0],N=h.get(x);N?N.push(b):h.set(x,[b]);}),Array.from(h.entries()).sort((b,x)=>x[0].localeCompare(b[0])).map(([b,x])=>({date:new Date(b),events:x.sort((N,D)=>D.timestamp.getTime()-N.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:f,uniqueTypes:v}=useMemo(()=>{let h=new Set,b=new Set;return e.forEach(x=>{h.add(x.userId),b.add(x.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(b)}},[e]),w=h=>{m(b=>{let x=new Set(b);return x.has(h)?x.delete(h):x.add(h),x});},g=h=>{let x=new Date().getTime()-h.getTime(),N=Math.floor(x/6e4),D=Math.floor(x/36e5),T=Math.floor(x/864e5);return N<1?"just now":N<60?`${N}m ago`:D<24?`${D}h ago`:T<7?`${T}d ago`:h.toLocaleDateString()},y=useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return useEffect(()=>{if(s&&d.current){let h=d.current.querySelector(`[data-event-id="${s}"]`);h&&h.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:h=>{let b=h.target.value;a({...t,types:b?[b]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),v.map(h=>jsxs("option",{value:h,children:[Mn(h)," ",h.replace("_"," ")]},h))]}),f.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let b=h.target.value;a({...t,users:b?[b]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),f.map(h=>jsx("option",{value:h,children:h},h))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),y>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",y,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:p.map(h=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&h.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:h.events.map((b,x)=>{let N=i.has(b.id),D=s===b.id,T=Sp(b.type);return jsxs("div",{"data-event-id":b.id,className:u("history-timeline-event",N&&"expanded",D&&"selected"),onClick:()=>o?.(b),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:T},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:Mn(b.type)})}),x<h.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:T}})]}),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&&b.userAvatar&&jsx("img",{src:b.userAvatar,alt:b.userName||b.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:b.userName||b.userId}),jsx("span",{className:"history-timeline-event-action",children:Pn(b)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?g(b.timestamp):b.timestamp.toLocaleString()})]}),Object.keys(b.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),w(b.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(b.changes).map(([k,O])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(O.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(O.to)})]})]},k)),b.metadata&&Object.keys(b.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(b.metadata).map(([k,O])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(O)})]},k))]})]})]})]},b.id)})})]},h.date?.toISOString()||"all"))})]})}function Mp({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&&Mn(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&Pn(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:f=>l(parseInt(f.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((f,v)=>jsx("div",{className:u("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>l(v),title:Pn(f)},f.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(f=>jsxs("button",{className:u("history-replay-speed-btn",e.speed===f&&"active"),onClick:()=>c(f),children:[f,"x"]},f))})]}),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(f=>jsx("span",{className:"history-replay-card-preview-label-tag",children:f},f))})]})]})]})]}):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 ad(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 rd(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 Fp(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 Ap(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Jx(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(f=>{if(m.id===f.id)return;let v=m.x-f.x,w=m.y-f.y,g=Math.sqrt(v*v+w*w)||1,y=o.chargeStrength*i/(g*g);m.vx+=v/g*y,m.vy+=w/g*y;});}),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 f=p.x-d.x,v=p.y-d.y,w=Math.sqrt(f*f+v*v)||1,g=(w-o.linkDistance)/w*o.forceStrength*i;d.vx+=f*g,d.vy+=v*g,p.vx-=f*g,p.vy-=v*g;}),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 Lp({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,f]=useState(null),[v,w]=useState(null),[g,y]=useState(null),[h,b]=useState(1),[x,N]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let R=Jx(e,t,a.width,a.height,a,150);d(R);},[e,t,a]);let D=useCallback((R,Q)=>{a.enableDragging&&(Q.stopPropagation(),f(R));},[a.enableDragging]),T=useCallback(R=>{if(!p||!i.current)return;let S=i.current.getBoundingClientRect(),G=(R.clientX-S.left-x.x)/h,ne=(R.clientY-S.top-x.y)/h;d(Ce=>Ce.map(A=>A.id===p?{...A,x:G,y:ne,fx:G,fy:ne}:A));},[p,h,x]),k=useCallback(()=>{f(null);},[]),O=useCallback((R,Q)=>{Q.stopPropagation(),l?.({type:"node-click",node:R,position:{x:Q.clientX,y:Q.clientY}});},[l]),I=useCallback((R,Q)=>{Q.stopPropagation(),l?.({type:"edge-click",edge:R,position:{x:Q.clientX,y:Q.clientY}});},[l]),C=useCallback(R=>{let Q=m.find(S=>S.id===R);return Q?{x:Q.x,y:Q.y}:{x:0,y:0}},[m]),H=useCallback(R=>{if(R.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return R.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let Q=R.card.priority;return Q==="URGENT"?"#ef4444":Q==="HIGH"?"#f59e0b":Q==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return R.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:()=>b(R=>Math.min(R+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>b(R=>Math.max(R-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{b(1),N({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(R=>R.type))).map(R=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:ad(R)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Fp(R)," ",rd(R)]})]},R))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:T,onMouseUp:k,onMouseLeave:k,children:[jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${h})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(R=>{let Q=C(typeof R.source=="string"?R.source:R.source.id),S=C(typeof R.target=="string"?R.target:R.target.id),G=Ap(R.type),ne=g===R.id,Ce=R.onCriticalPath;return jsxs("g",{className:u("relationships-graph-edge",ne&&"hovered",Ce&&"critical"),onMouseEnter:()=>y(R.id),onMouseLeave:()=>y(null),onClick:A=>I(R,A),children:[jsx("line",{x1:Q.x,y1:Q.y,x2:S.x,y2:S.y,stroke:ad(R.type),strokeWidth:Ce?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ne?1:.6,markerEnd:G?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ne&&jsx("text",{x:(Q.x+S.x)/2,y:(Q.y+S.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:rd(R.type)})]},R.id)})}),jsx("g",{className:"relationships-graph-nodes",children:m.map(R=>{let Q=v===R.id,S=R.onCriticalPath;return jsxs("g",{className:u("relationships-graph-node",Q&&"hovered",S&&"critical"),transform:`translate(${R.x}, ${R.y})`,onMouseDown:G=>D(R.id,G),onMouseEnter:()=>w(R.id),onMouseLeave:()=>w(null),onClick:G=>O(R,G),children:[jsx("circle",{r:S?a.nodeSize*1.2:a.nodeSize,fill:H(R),stroke:S?"#fbbf24":"#ffffff",strokeWidth:S?3:2,opacity:Q?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:R.card.title.length>20?R.card.title.substring(0,20)+"...":R.card.title})]},R.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 Rp({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),f=useRef(null),v=l||o;useEffect(()=>{e&&f.current&&f.current.focus();},[e]),useEffect(()=>{let h=b=>{b.key==="Escape"&&!v&&w();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,v]);let w=()=>{v||(n(""),m(null),p(null),t());},g=async()=>{if(!(!s.trim()||v)){c(true),m(null),p(null);try{let h=await r(s.trim());p(h);}catch(h){m(h instanceof Error?h.message:"Failed to generate plan");}finally{c(false);}}},y=()=>{d&&(a(d),w());};return e?jsxs(ht,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:w}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-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:w,disabled:v,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((h,b)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},b))})]}),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((h,b)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},b)),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:f,value:s,onChange:h=>n(h.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:v}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,b)=>jsx("button",{onClick:()=>n(h),disabled:v,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},b))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:v&&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:w,disabled:v,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:y,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:g,disabled:!s.trim()||v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:v?"Generating...":"Generate Plan"})]})]})]})})]}):null}var od={"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 Qx={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},e2={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 t2(e,t,a){let r=od[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Fn(e){return `$${e.toFixed(4)}`}var nd=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=t2(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)}},No=new nd;function zp({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(No.getStats()),[s,n]=useState(No.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{o(No.getStats()),n(No.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=No.getRecentOperations(5);return jsxs(ht,{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:Fn(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:Fn(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:Fn(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 Wp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=useState(""),[c,i]=useState(""),[m,d]=useState(""),[p,f]=useState(false),[v,w]=useState(null),[g,y]=useState(null),[h,b]=useState(null),x=useRef(null),N=p||o;useEffect(()=>{e&&x.current&&x.current.focus();},[e]),useEffect(()=>{let I=C=>{C.key==="Escape"&&!N&&D();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,N]);let D=()=>{N||(l(""),i(""),d(""),w(null),y(null),b(null),t());},T=async()=>{if(!(!n.trim()||N)){f(true),w(null),y(null),b(null);try{let I=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:m||void 0});y(I.tasks.tasks),b({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){w(I instanceof Error?I.message:"Failed to generate tasks");}finally{f(false);}}},k=()=>{g&&(a(g),D());};if(!e)return null;let O=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxs(ht,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:D}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick: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:D,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:g?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",O,"% similar)"]}):jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[h?.tokens_used||0," tokens"]}),h?.tokens_saved&&jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[h.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[g.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:g.map((I,C)=>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:["#",C+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:x,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})]})]}),v&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:v}),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,C)=>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},C))})]})]})}),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:D,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),g?jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:T,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, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function qs({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(g=>{t&&Hn(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(y,h,b)=>{console.warn(`Retry attempt ${h} after ${b}ms: ${y.message}`);}}).then(y=>{y.success||console.error(`Failed to persist board after ${y.attempts} attempts:`,y.error);});},[t]),s=useCallback(async(g,y,h)=>{r(b=>{let x=b.cards.find(I=>I.id===g);if(!x)return b;let N=x.columnId,D={...x,columnId:y,position:h},T=b.cards.map(I=>I.id===g?D:I),k=b.columns.map(I=>{if(I.id===N)return {...I,cardIds:I.cardIds.filter(C=>C!==g)};if(I.id===y){let C=T.filter(H=>H.columnId===y).sort((H,R)=>H.position-R.position);return {...I,cardIds:C.map(H=>H.id)}}return I}),O={...b,cards:T,columns:k};return o(O),O});},[o]),n=useCallback(async(g,y)=>{r(h=>{let b=h.cards.map(N=>N.id===g?{...N,...y}:N),x={...h,cards:b};return o(x),x});},[o]),l=useCallback(async g=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let b={...g,id:y},x=h.columns.map(D=>D.id===g.columnId?{...D,cardIds:[...D.cardIds,y]}:D),N={...h,cards:[...h.cards,b],columns:x};return o(N),N});},[o]),c=useCallback(async g=>{r(y=>{let h=y.cards.find(D=>D.id===g);if(!h)return y;let b=y.cards.filter(D=>D.id!==g),x=y.columns.map(D=>D.id===h.columnId?{...D,cardIds:D.cardIds.filter(T=>T!==g)}:D),N={...y,cards:b,columns:x};return o(N),N});},[o]),i=useCallback(async g=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let b={...g,id:y,cardIds:[]},x={...h,columns:[...h.columns,b]};return o(x),x});},[o]),m=useCallback(async(g,y)=>{r(h=>{let b=h.columns.map(N=>N.id===g?{...N,...y}:N),x={...h,columns:b};return o(x),x});},[o]),d=useCallback(async g=>{r(y=>{let h=y.cards.filter(N=>N.columnId!==g),b=y.columns.filter(N=>N.id!==g),x={...y,cards:h,columns:b};return o(x),x});},[o]),p=useCallback(g=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(g),y},[l]),f=useCallback(g=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(g),y},[i]),v=useCallback(()=>{r(g=>{let y={...g,cards:[],columns:[]};return o(y),y});},[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:f,deleteCard:c,deleteColumn:d,clearBoard:v}}}function Vp({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=qs({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 An={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},jp={by:"none",order:"asc"};function Kp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...An,...e}),[s,n]=useState({...jp,...t}),l=useCallback(w=>{o(g=>({...g,...w}));},[]),c=useCallback(w=>{n(g=>({...g,...w}));},[]),i=useCallback(()=>{o(An),n(jp);},[]),m=useCallback(()=>{a&&o({...An,assignees:[a]});},[a]),d=useCallback(()=>{o({...An,dateFilter:"overdue"});},[]),p=useCallback(()=>{o({...An,priorities:["HIGH","URGENT"]});},[]),f=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]),v=useCallback(w=>{let g=[...w];if(r.search){let y=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(y)||h.description?.toLowerCase().includes(y));}if(r.dateFilter!=="all"){let y=new Date,h=y.getFullYear(),b=String(y.getMonth()+1).padStart(2,"0"),x=String(y.getDate()).padStart(2,"0"),N=`${h}-${b}-${x}`;g=g.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let T=D.endDate||D.dueDate;if(!T)return false;let k;if(typeof T=="string")k=T.split("T")[0]||T;else {let O=T.getUTCFullYear(),I=String(T.getUTCMonth()+1).padStart(2,"0"),C=String(T.getUTCDate()).padStart(2,"0");k=`${O}-${I}-${C}`;}switch(r.dateFilter){case "overdue":return k<N;case "today":return k===N;case "this-week":let O=new Date(N+"T00:00:00"),I=new Date(k+"T00:00:00"),C=new Date(O);return C.setDate(C.getDate()+7),I>=O&&I<=C;case "custom":if(r.dateRange){let H=typeof T=="string"?new Date(T):T;return H>=r.dateRange.start&&H<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(y=>y.priority&&r.priorities.includes(y.priority))),r.assignees.length>0&&(g=g.filter(y=>(y.assignedUserIds||(y.assigneeId?[y.assigneeId]:[])).some(b=>r.assignees.includes(b)))),r.labels.length>0&&(g=g.filter(y=>y.labels&&y.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(y=>r.columns.includes(y.columnId))),s.by!=="none"&&g.sort((y,h)=>{let b=0;switch(s.by){case "created":let x=y.createdAt?new Date(y.createdAt).getTime():0,N=h.createdAt?new Date(h.createdAt).getTime():0;b=x-N;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},T=D[y.priority||"LOW"],k=D[h.priority||"LOW"];b=T-k;break;case "dueDate":let O=y.endDate||y.dueDate,I=h.endDate||h.dueDate;if(!O)return 1;if(!I)return -1;let C=typeof O=="string"?new Date(O).getTime():O.getTime(),H=typeof I=="string"?new Date(I).getTime():I.getTime();b=C-H;break;case "title":b=y.title.localeCompare(h.title);break;case "estimate":let R=y.estimatedTime||0,Q=h.estimatedTime||0;b=R-Q;break;default:b=0;}return s.order==="asc"?b:-b}),g},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:m,filterOverdue:d,filterHighPriority:p,applyFilters:v,hasActiveFilters:f}}var Yp,Xp;if(typeof window<"u")try{let e=$n("ai");Yp=e.generateObject,Xp=e.generateText;}catch{}function Jp(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(Yp&&Xp&&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 f=p instanceof Error?p:new Error("Failed to generate plan");throw o(f),f}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 f=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(f),f}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 f=p instanceof Error?p:new Error("Failed to predict risks");throw o(f),f}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 f=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(f),f}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 f=p instanceof Error?p:new Error("Failed to estimate effort");throw o(f),f}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:m,isAvailable:s,isLoading:t,error:r}}function id(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function Zp(e){let{cards:t}=e,[a,r]=id(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=useCallback((d,p)=>{if(!p){r({selectedCardIds:[d],lastSelectedCardId:d});return}let f=p.ctrlKey||p.metaKey,v=p.shiftKey;if(f)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(w=>w!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(v&&a.lastSelectedCardId){let w=t.find(y=>y.id===d),g=t.find(y=>y.id===a.lastSelectedCardId);if(w&&g&&w.columnId===g.columnId){let y=t.filter(k=>k.columnId===w.columnId).sort((k,O)=>k.position-O.position),h=y.findIndex(k=>k.id===a.lastSelectedCardId),b=y.findIndex(k=>k.id===d),[x,N]=h<b?[h,b]:[b,h],D=y.slice(x,N+1).map(k=>k.id),T=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:T,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 Qp={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function eg(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...Qp,...a}),[a]),[s,n]=useState([]),l=useCallback((w,g,y,h,b)=>{if(g.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:w,cardIds:g,columnId:y,strategy:h,color:b,isExpanded:true,position:s.filter(N=>N.columnId===y).length,createdAt:new Date};n(N=>[...N,x]);},[o.minCardsPerStack,s]),c=useCallback(w=>{n(g=>g.filter(y=>y.id!==w));},[]),i=useCallback(w=>{n(g=>g.map(y=>y.id===w?{...y,isExpanded:!y.isExpanded}:y));},[]),m=useCallback((w,g)=>{n(y=>y.map(h=>h.id===w&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),d=useCallback((w,g)=>{n(y=>y.map(h=>{if(h.id===w){let b=h.cardIds.filter(x=>x!==g);return b.length<o.minCardsPerStack?null:{...h,cardIds:b}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),p=useCallback(w=>s.filter(g=>g.columnId===w).sort((g,y)=>g.position-y.position),[s]),f=useCallback(async w=>{let g=t.filter(N=>N.columnId===w);if(g.length<o.minCardsPerStack*2)return [];let y=[],h=new Map;g.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(D=>{h.has(D)||h.set(D,[]),h.get(D).push(N);});}),h.forEach((N,D)=>{N.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:N.map(T=>T.id),columnId:w,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${D}"`,confidence:.85});});let b=new Map;g.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(D=>{b.has(D)||b.set(D,[]),b.get(D).push(N);});}),b.forEach((N,D)=>{N.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:N.map(T=>T.id),columnId:w,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(g.forEach(N=>{N.priority&&(x.has(N.priority)||x.set(N.priority,[]),x.get(N.priority).push(N));}),x.forEach((N,D)=>{if(N.length>=o.minCardsPerStack){let T={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";y.push({stack:{title:`${T} ${D} Priority`,cardIds:N.map(k=>k.id),columnId:w,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${D} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of g){let T=(await r.findSimilar(N,g)).filter(k=>k.similarity>=o.autoStackConfidenceThreshold);if(T.length>=o.minCardsPerStack-1){let k=[N.id,...T.map(I=>I.card.id)],O=T.reduce((I,C)=>I+C.similarity,0)/T.length;y.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:k,columnId:w,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${T.length+1} similar tasks`,confidence:O});}}return y.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,D)=>D.confidence-N.confidence).slice(0,5)},[t,o,r]),v=useCallback(w=>{l(w.stack.title,w.stack.cardIds,w.stack.columnId,w.stack.strategy,w.stack.color);},[l]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let y=await f(g),h=y[0];y.length>0&&h&&h.confidence>=.9&&v(h);});},[]),{stacks:s,createStack:l,deleteStack:c,toggleStack:i,addToStack:m,removeFromStack:d,getStacksForColumn:p,getSuggestions:f,applySuggestion:v,config:o}}var tg=createContext(null);function ag({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}=$n("@libxai/core");s.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=$n("@libxai/core");n.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=$n("@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(tg.Provider,{value:{store:o},children:e})}function Ys(){let e=useContext(tg);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function In(){let e=Ys(),[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(h=>{e.updateBoard(h);},[e]),c=useCallback(h=>{e.addColumn(h);},[e]),i=useCallback((h,b)=>{e.updateColumn(h,b);},[e]),m=useCallback(h=>{e.deleteColumn(h);},[e]),d=useCallback(h=>e.getColumn(h),[e]),p=useCallback(h=>{e.addCard(h);},[e]),f=useCallback((h,b)=>{e.updateCard(h,b);},[e]),v=useCallback(h=>{e.deleteCard(h);},[e]),w=useCallback((h,b,x)=>{e.moveCard(h,b,x);},[e]),g=useCallback(h=>e.getCard(h),[e]),y=useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:m,getColumn:d,addCard:p,updateCard:f,deleteCard:v,moveCard:w,getCard:g,getCardsByColumn:y}}function og(e){let{cards:t}=In();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 ng(e="position",t="asc"){let{cards:a}=In();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 Xs=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Ud.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);}},y2=new Xs;function ig({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"},f=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:f,children:d.map(v=>{let w=e[v.index];if(!w)return null;let g=c?c(w,v.index):v.index,y={position:"absolute",top:n?0:v.start,left:n?v.start:0,width:n?v.size:"100%",height:n?"100%":v.size};return jsx("div",{style:y,"data-index":v.index,children:r(w,v.index)},g)})})})}function lg(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 cg({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(),f={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},v={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:m,style:f,className:s,children:jsx("div",{style:v,children:p.map(w=>{let g=e[w.index];if(!g)return null;let y=c?c(g,w.index):w.index,h={position:"absolute",top:0,left:w.start,width:w.size,height:"100%"};return jsx("div",{style:h,"data-index":w.index,children:o(g,w.index)},y)})})})}function mg(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 ug(e,t=10){return e>t}var md={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},ud={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},pd={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},gd={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},fd={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},hd={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},bd={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},yd={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)"},vd={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)"},xd={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},kd={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}},wd={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}},Js={spacing:md,borderRadius:ud,fontSize:pd,fontWeight:gd,lineHeight:fd,zIndex:hd,duration:bd,easing:yd,shadows:vd,opacity:xd,kanban:kd,gantt:wd};function pg(e,t,a){return e[t]??a}function Cd(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)?Cd(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function k2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Td(e="asakaa"){let t=Cd(Js),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=k2(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
403
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function nu(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Ur(e,t){let a=nu(e),r=t.toLowerCase().trim(),o=a.find(d=>d.name.toLowerCase()===r);if(o)return o;let s=a.find(d=>d.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(d=>{let m=d.name.toLowerCase();return n.every(i=>m.includes(i))})}function Sl(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 f={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(f!==void 0){let v=new Date(r),w=v.getDay(),g=f-w;return g<=0&&(g+=7),v.setDate(v.getDate()+g),v}}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),f=s[2].toLowerCase(),v=new Date(r);return f==="day"||f==="d\xEDa"||f==="dias"?v.setDate(v.getDate()+p):f==="week"||f==="semana"||f==="semanas"?v.setDate(v.getDate()+p*7):(f==="month"||f==="mes"||f==="meses")&&v.setMonth(v.getMonth()+p),v}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let d=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(d&&d[1]&&d[2]&&d[3]){let p=parseInt(d[1],10),f=parseInt(d[2],10)-1,v=parseInt(d[3],10);return new Date(v,f,p)}let m={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),f=m[i[2].toLowerCase()],v=i[3]?parseInt(i[3],10):r.getFullYear();if(f!==void 0)return new Date(v,f,p)}let c={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let p=c[l[1].toLowerCase()],f=parseInt(l[2],10),v=l[3]?parseInt(l[3],10):r.getFullYear();if(p!==void 0)return new Date(v,p,f)}return null}function El(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 Pl(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 su(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 iu(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(),c=r[2].trim(),l=Ur(t,i),p=Sl(c);if(!l)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:l.id,taskName:l.name,message:`Could not parse the date "${c}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let f=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(p);return v.setDate(v.getDate()+f),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:p,endDate:v},message:`Moved "${l.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(),c=o[2].trim(),l=Ur(t,i),p=El(c);if(!l)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let f=new Date(l.endDate);return f.setDate(f.getDate()+p),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:f},message:`Extended "${l.name}" by ${p} days. New end date: ${f.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(),c=s[2].trim(),l=Ur(t,i),p=Pl(c);return l?p===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:p},message:`Set "${l.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(),c=n[2].trim(),l=Ur(t,i);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:c},message:`Renamed "${l.name}" to "${c}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let d=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let i=d[1].trim(),c=d[2].trim(),l=Ur(t,i),p=Ur(t,c);return l?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:l.id,dependencyTo:p.id,message:`Linked "${l.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:c,message:`Could not find a task named "${c}".`,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 m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let i=m[1].trim(),c=Ur(t,i);return c?{type:"delete_task",taskId:c.id,taskName:c.name,message:`Deleted "${c.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 lu(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 Yy(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 Xy(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Fs(e,t=[],a=[]){let r=e.assignedUserIds?.map(c=>{let l=a.find(p=>p.id===c);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(c=>c!==null),o=t.filter(c=>c.metadata?.parentCardId===e.id).map(c=>Fs(c,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(c=>c.type==="finish-to-start").map(c=>c.taskId));let n=c=>{if(c)return typeof c=="string"?new Date(c):c},d=n(e.startDate),m=n(e.endDate),i=e.metadata?.isMilestone===true||d&&m&&Math.abs(m.getTime()-d.getTime())<=864e5;return {id:e.id,name:e.title,startDate:d,endDate:m,progress:e.progress||0,status:Yy(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 du(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:Xy(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function cu(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Fs(r,e,t))}var Ml={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",tags:"Tags"},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"}},Fl={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",tags:"Etiquetas"},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"}},As={en:Ml,es:Fl};function Al(e){return As[e]||As.en}function Ls(e,t){let a=Al(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 Ll=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-blue-500"},{value:"completed",icon:CheckCircle2,color:"text-green-500"}];function mu(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 uu({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),d=useRef(null);useEffect(()=>{let f=v=>{d.current&&!d.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]);let m=mu(e),i=Ll[0],c=Ll.find(f=>f.value===m)??i,l=c.icon,p=f=>{switch(mu(f)){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(l,{className:u("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:p(e)})]}):jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:f=>{f.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(l,{className:u("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:u("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:p(e)}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-[#6B7280]":"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-[#1F2937] border-white/10":"bg-white border-gray-200"),children:Ll.map(f=>{let v=f.icon;return jsxs("button",{onClick:w=>{w.stopPropagation(),t(f.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",m===f.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsx(v,{className:u("w-4 h-4",f.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p(f.value)})]},f.value)})})]})}var Il=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function gu({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),d=useRef(null);useEffect(()=>{let c=l=>{d.current&&!d.current.contains(l.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let m=Il.find(c=>c.value===e)??Il[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",m.color)}),jsx("span",{className:u("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]})]}):jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(Flag,{className:u("w-4 h-4",m.color)}),jsx("span",{className:u("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:m.label[i]}),jsx(ChevronDown,{className:u("w-3 h-3",a?"text-[#6B7280]":"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-[#1F2937] border-white/10":"bg-white border-gray-200"),children:Il.map(c=>jsxs("button",{onClick:l=>{l.stopPropagation(),t(c.value),n(false);},className:u("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===c.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-2 h-2 rounded-full",c.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[i]})]},c.value))})]})}function Rs(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Os(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 fv(e,t){if(!e)return null;let a=Math.round(e.assignedHoursThisWeek/e.weeklyCapacity*100);switch(e.level){case "light":return {color:t?"text-green-400 bg-green-500/20":"text-green-600 bg-green-100",icon:null,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "moderate":return {color:t?"text-yellow-400 bg-yellow-500/20":"text-yellow-600 bg-yellow-100",icon:Clock,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "heavy":return {color:t?"text-orange-400 bg-orange-500/20":"text-orange-600 bg-orange-100",icon:Clock,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "overloaded":return {color:t?"text-red-400 bg-red-500/20":"text-red-600 bg-red-100",icon:AlertTriangle,label:`${a}%`,tooltip:`SOBRECARGADO: ${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`}}}function bu({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false,showWorkloadIndicators:n=true}){let[d,m]=useState(false),[i,c]=useState(""),l=useRef(null);useEffect(()=>{let g=y=>{l.current&&!l.current.contains(y.target)&&(m(false),c(""));};return d&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[d]);let p=t.filter(g=>g.name.toLowerCase().includes(i.toLowerCase())||g.email?.toLowerCase().includes(i.toLowerCase())),f=n?[...p].sort((g,y)=>{let h={light:0,moderate:1,heavy:2,overloaded:3},b=g.workload?.level??"light",x=y.workload?.level??"light";return h[b]-h[x]}):p,v=g=>e.some(y=>y.name===g),w=g=>{if(a)if(v(g.name))a(e.filter(y=>y.name!==g.name));else {let y={name:g.name,initials:Rs(g.name),color:g.color||Os(g.name).replace("bg-","").replace("-500",""),avatar:g.avatarUrl};a([...e,y]);}};return s||!a?e.length===0?jsx("span",{className:u("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((g,y)=>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-[#0F1117]":"border-white",!g.avatar&&Os(g.name)),style:g.color&&!g.avatar?{backgroundColor:g.color}:void 0,title:g.name,children:g.avatar?jsx("img",{src:g.avatar,alt:g.name,className:"w-full h-full rounded-full object-cover"}):g.initials||Rs(g.name)},`${g.name}-${y}`)),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-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:l,className:"relative",children:[jsx("button",{onClick:g=>{g.stopPropagation(),m(!d);},className:u("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:u("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsx(Plus,{className:u("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((g,y)=>jsx("div",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!g.avatar&&Os(g.name)),style:g.color&&!g.avatar?{backgroundColor:g.color}:void 0,children:g.avatar?jsx("img",{src:g.avatar,alt:g.name,className:"w-full h-full rounded-full object-cover"}):g.initials||Rs(g.name)},`${g.name}-${y}`)),e.length>2&&jsxs("span",{className:u("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),d&&jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-72",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[n&&jsxs("div",{className:u("px-3 py-2 text-xs border-b flex items-center gap-3",r?"text-[#9CA3AF] border-white/10":"text-gray-500 border-gray-200"),children:[jsxs("span",{className:"flex items-center gap-1",children:[jsx("span",{className:"w-2 h-2 rounded-full bg-green-500"}),o==="es"?"Ligera":"Light"]}),jsxs("span",{className:"flex items-center gap-1",children:[jsx("span",{className:"w-2 h-2 rounded-full bg-yellow-500"}),o==="es"?"Moderada":"Moderate"]}),jsxs("span",{className:"flex items-center gap-1",children:[jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"}),o==="es"?"Alta":"Heavy"]})]}),jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsx("input",{type:"text",value:i,onChange:g=>c(g.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:u("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:g=>g.stopPropagation()})}),jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:f.length===0?jsx("p",{className:u("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):f.map(g=>{let y=fv(g.workload,r);return jsxs("button",{onClick:h=>{h.stopPropagation(),w(g);},className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",g.workload?.level==="overloaded"&&(r?"bg-red-500/5":"bg-red-50")),title:y?.tooltip,children:[jsx("div",{className:u("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!g.avatarUrl&&Os(g.name)),children:g.avatarUrl?jsx("img",{src:g.avatarUrl,alt:g.name,className:"w-full h-full rounded-full object-cover"}):Rs(g.name)}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:r?"text-white":"text-gray-900",children:g.name}),g.email&&jsx("div",{className:u("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:g.email})]}),n&&y&&jsxs("div",{className:u("flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",y.color),children:[y.icon&&jsx(y.icon,{className:"w-3 h-3"}),y.label]}),v(g.name)&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},g.id)})}),e.length>0&&jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((g,y)=>jsxs("span",{className:u("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[g.name,jsx("button",{onClick:h=>{h.stopPropagation(),a(e.filter(b=>b.name!==g.name));},className:"hover:text-red-500",children:jsx(X,{className:"w-3 h-3"})})]},`${g.name}-${y}`))})]})]})}function xu({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:d=false,placeholder:m}){let[i,c]=useState(false),[l,p]=useState(o),[f,v]=useState(()=>{let T=o==="start"?e:t;if(T){let k=T instanceof Date?T:new Date(T);return new Date(k.getFullYear(),k.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),w=useRef(null),g=e?e instanceof Date?e:new Date(e):null,y=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let T=k=>{w.current&&!w.current.contains(k.target)&&c(false);};return i&&document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[i]),useEffect(()=>{i&&p(r?o:"start");},[i,r,o]);let h=T=>T?T.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):m||"-",b=useCallback(()=>{let T=f.getFullYear(),k=f.getMonth(),R=new Date(T,k,1),C=new Date(T,k+1,0).getDate(),W=R.getDay(),B=[],S=new Date(T,k,0).getDate();for(let oe=W-1;oe>=0;oe--)B.push({date:new Date(T,k-1,S-oe),isCurrentMonth:false});for(let oe=1;oe<=C;oe++)B.push({date:new Date(T,k,oe),isCurrentMonth:true});let _=42-B.length;for(let oe=1;oe<=_;oe++)B.push({date:new Date(T,k+1,oe),isCurrentMonth:false});return B},[f]),x=T=>{if(r)o==="start"?a(T,y||void 0):a(g||void 0,T),c(false);else if(l==="start"){let k=y&&T>y?T:y;a(T,k||void 0),p("end");}else {let k=g&&T<g?T:g;a(k||void 0,T),c(false);}},N=()=>{let T=new Date,k=new Date(T);k.setDate(T.getDate()+1);let R=new Date(T);R.setDate(T.getDate()+((6-T.getDay()+7)%7||7));let I=new Date(T);I.setDate(T.getDate()+((1-T.getDay()+7)%7||7));let C=new Date(T);C.setDate(T.getDate()+(6-T.getDay()+7)%7+7);let W=new Date(T);W.setDate(T.getDate()+14);let B=new Date(T);return B.setDate(T.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:k,display:k.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:R,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:C,display:C.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:W,display:W.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:B,display:B.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(d){let T=r&&o==="start"?g:y;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-[#94A3B8]":"text-gray-500"),children:h(T)})]})}let D=r&&o==="start"?g:y;return jsxs("div",{ref:w,className:"relative",children:[jsxs("button",{onClick:T=>{T.stopPropagation(),c(!i);let k=o==="start"?g:y;k&&v(new Date(k.getFullYear(),k.getMonth(),1));},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(Calendar,{className:u("w-4 h-4",s?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm",s?"text-[#94A3B8]":"text-gray-500"),children:h(D)})]}),i&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>c(false)}),jsxs("div",{className:u("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:T=>T.stopPropagation(),children:[jsxs("div",{className:u("w-44 py-2 border-r",s?"border-white/10":"border-gray-200"),children:[N().map((T,k)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>x(T.date),children:[jsx("span",{children:T.label}),jsx("span",{className:u("text-xs",s?"text-[#6B7280]":"text-gray-400"),children:T.display})]},k)),jsx("div",{className:u("border-t mt-2 pt-2",s?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,y||void 0):a(g||void 0,void 0):a(void 0,void 0),c(false);},className:u("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/5 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/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:l==="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:f.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>v(new Date),className:u("p-1 rounded text-sm transition-colors",s?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>v(new Date(f.getFullYear(),f.getMonth()-1)),className:u("p-1 rounded",s?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:u("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>v(new Date(f.getFullYear(),f.getMonth()+1)),className:u("p-1 rounded",s?"hover:bg-white/10":"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(T=>jsx("div",{className:u("w-8 h-8 flex items-center justify-center text-xs",s?"text-[#6B7280]":"text-gray-400"),children:T},T))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:b().map((T,k)=>{let R=T.date.toDateString()===new Date().toDateString(),I=g?.toDateString()===T.date.toDateString(),C=y?.toDateString()===T.date.toDateString(),W=I||C,B=!r&&g&&y&&T.date>=g&&T.date<=y;return jsx("button",{onClick:()=>x(new Date(T.date)),className:u("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!T.isCurrentMonth&&(s?"text-[#4B5563]":"text-gray-300"),T.isCurrentMonth&&(s?"text-white":"text-gray-900"),R&&"ring-2 ring-[#3B82F6]",I&&"bg-[#3B82F6] text-white",C&&!I&&"bg-[#7C3AED] text-white",B&&!W&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!W&&(s?"hover:bg-white/10":"hover:bg-gray-100")),children:T.date.getDate()},k)})})]})]})]})]})}function $s({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:d}){let m=e?e instanceof Date?e:new Date(e):null;return jsx(xu,{startDate:s==="start"?m:n||null,endDate:s==="end"?m:d||null,onChange:(p,f)=>{t&&t(s==="start"?p:f);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function Zo(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 zs(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=useState(e),[d,m]=useState(false),i=useRef(e),c=useRef([]);return useEffect(()=>{if(c.current.forEach(clearTimeout),c.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let l=i.current??0,p=e,f=p-l,v=r/o;m(true);for(let w=1;w<=o;w++){let g=setTimeout(()=>{let y=w/o,h=1-Math.pow(1-y,3),b=Math.round(l+f*h);n(b),w===o&&(m(false),n(p));},v*w);c.current.push(g);}return i.current=e,()=>{c.current.forEach(clearTimeout),c.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:d}}function ku(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,d]=useState(0),m=useRef(null),i=useRef(null),c=useCallback(f=>{m.current&&clearTimeout(m.current),i.current&&clearInterval(i.current),s(f),d(0);let v=Date.now();i.current=setInterval(()=>{let w=Date.now()-v,g=Math.min(w/a*100,100);d(g);},16),m.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(f),s(null),d(0);},a);},[a,e]),l=useCallback(()=>{m.current&&clearTimeout(m.current),i.current&&clearInterval(i.current),s(null),d(0),r?.();},[r]);return useEffect(()=>()=>{m.current&&clearTimeout(m.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:c,cancelChange:l}}function Tu({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let{isFlashing:n,triggerFlash:d}=Zo(),{displayValue:m,isAnimating:i}=zs(e,{enabled:o,duration:300,steps:6}),c=p=>{if(r||!t)return;p.stopPropagation();let f=p.currentTarget.getBoundingClientRect(),v=p.clientX-f.left,w=Math.round(v/f.width*100),g=Math.max(0,Math.min(100,w));g!==e&&(t(g),s&&d());},l=m??e;return jsxs("div",{className:u("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-all duration-300",n&&(a?"bg-green-500/30":"bg-green-500/20")),children:[jsx("div",{onClick:c,className:u("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:u("h-full rounded-full transition-all",l===100?"bg-green-500":"bg-[#3B82F6]",i&&"transition-none"),style:{width:`${l}%`}})}),jsxs("span",{className:u("text-xs w-8 text-right tabular-nums transition-all",a?"text-[#9CA3AF]":"text-gray-500",i&&"font-medium scale-105"),children:[l,"%"]})]})}function Su({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[d,m]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{m(e);},[e]);let c=()=>{d!==e&&t?.(d),n(false);},l=p=>{p.key==="Enter"?c():p.key==="Escape"&&(m(e),n(false));};return o||!t?jsx("span",{className:u("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:d,onChange:p=>m(p.target.value),onBlur:c,onKeyDown:l,onClick:p=>p.stopPropagation(),className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] 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-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function Mu({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:d=true,enableSaveFlash:m=true}){let[i,c]=useState(false),[l,p]=useState(e?.toString()||""),f=useRef(null),{isFlashing:v,triggerFlash:w}=Zo(),{displayValue:g,isAnimating:y}=zs(e,{enabled:d&&!i});useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]),useEffect(()=>{p(e?.toString()||"");},[e]);let h=()=>{let x=parseFloat(l);if(!isNaN(x)){let N=x;o!==void 0&&(N=Math.max(o,N)),s!==void 0&&(N=Math.min(s,N)),N!==e&&(t?.(N),m&&w());}c(false);},b=x=>{x.key==="Enter"?h():x.key==="Escape"&&(p(e?.toString()||""),c(false));};return n||!t?jsx("span",{className:u("text-sm transition-all",a?"text-[#94A3B8]":"text-gray-500",y&&"font-medium"),children:g!==void 0?g:r}):i?jsx("input",{ref:f,type:"number",value:l,onChange:x=>p(x.target.value),onBlur:h,onKeyDown:b,onClick:x=>x.stopPropagation(),min:o,max:s,className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsx("button",{onClick:x=>{x.stopPropagation(),c(true);},className:u("text-sm text-left w-full px-2 py-1 rounded transition-all duration-300",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",g===void 0&&(a?"text-[#6B7280]":"text-gray-400"),v&&(a?"bg-green-500/30":"bg-green-500/20"),y&&"font-medium scale-105"),children:g!==void 0?g:r})}function Fu({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,d]=useState(false),m=useRef(null);return useEffect(()=>{let i=c=>{m.current&&!m.current.contains(c.target)&&d(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsx("span",{className:u("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxs("div",{ref:m,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),d(!n);},className:u("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx("span",{className:u("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsx(ChevronDown,{className:u("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"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-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:u("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:c=>{c.stopPropagation(),a(i),d(false);},className:u("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"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-[#3B82F6]"})]},i))})]})}function Lu({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:d,progress:m,startChange:i,cancelChange:c}=ku(t,{delay:s}),l=f=>{f.stopPropagation(),!r&&t&&(o?d?c():i(!e):t(!e));},p=d?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:l,disabled:r||!t,className:u("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-all",p?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",d&&"ring-2 ring-offset-1",d&&p&&"ring-green-500/50",d&&!p&&"ring-red-500/50",d&&(a?"ring-offset-[#0F1117]":"ring-offset-white")),children:[d&&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:`${m/100*50.26} 50.26`,className:"transition-all duration-100"})}),d?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),d&&jsx("button",{onClick:f=>{f.stopPropagation(),c();},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 Ru({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:u("text-sm",t?"text-[#6B7280]":"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-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#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/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function Bv(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 Rv(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let d=parseInt(a[1],10),m=parseInt(a[2],10);return d*60+m}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let d=parseFloat(r[1]),m=r[2]?parseInt(r[2],10):0;return Math.round(d*60)+m}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 wo({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:d=false}){let[m,i]=useState(false),[c,l]=useState(""),p=useRef(null),{isFlashing:f,triggerFlash:v}=Zo(),w=Bv(e,r);useEffect(()=>{m&&p.current&&(p.current.focus(),p.current.select());},[m]),useEffect(()=>{if(e){let h=Math.floor(e/60),b=e%60;h>0&&b>0?l(`${h}h ${b}m`):h>0?l(`${h}h`):l(`${b}m`);}else l("");},[e,m]);let g=()=>{let h=Rv(c);h!==e&&(t?.(h),n&&v()),i(false);},y=h=>{h.key==="Enter"?g():h.key==="Escape"&&i(false);};return d?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-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-[#94A3B8]":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]}):s||!t?jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsx(Clock,{className:u("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("text-sm",a?"text-[#94A3B8]":"text-gray-500",(!e||e===0)&&(a?"text-[#6B7280]":"text-gray-400")),children:w})]}):m?jsx("input",{ref:p,type:"text",value:c,onChange:h=>l(h.target.value),onBlur:g,onKeyDown:y,onClick:h=>h.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:u("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white placeholder:text-[#6B7280]":"bg-white border-[#3B82F6] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:h=>{h.stopPropagation(),i(true);},className:u("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-all duration-300 overflow-hidden",a?"hover:bg-white/10":"hover:bg-gray-100",e!=null&&e>0?a?"text-[#94A3B8]":"text-gray-600":a?"text-[#6B7280]":"text-gray-400",f&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(Clock,{className:u("w-3 h-3 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:"truncate",children:w})]})}function Xv(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Jv(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 Wu({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:d,onColumnHide:m,onColumnSort:i,availableUsers:c=[]}){let l=useRef(null),p=r==="es"?Uu.es:Uu.en;if(useEffect(()=>{let y=b=>{l.current&&!l.current.contains(b.target)&&t();},h=b=>{b.key==="Escape"&&t();};return document.addEventListener("mousedown",y),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",h);}},[t]),!e.isOpen)return null;let f=()=>{if(!e.task)return [];let y=[];return o&&y.push({id:"edit",label:p.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),y.push({id:"sep1",label:"",icon:null,separator:true}),d&&(y.push({id:"status",label:p.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:p.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{d({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:p.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{d({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:p.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{d({...e.task,status:"completed",progress:100}),t();}}]}),y.push({id:"priority",label:p.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:p.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{d({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:p.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{d({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:p.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{d({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:p.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{d({...e.task,priority:"low"}),t();}}]}),c.length>0&&y.push({id:"assign",label:p.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(h=>({id:`assign-${h.id}`,label:h.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:h.name.charAt(0).toUpperCase()}),onClick:()=>{let b=e.task.assignees||[],N=b.some(D=>D.name===h.name)?b.filter(D=>D.name!==h.name):[...b,{name:h.name,initials:Xv(h.name),color:h.color||Jv(h.name),avatar:h.avatarUrl}];d({...e.task,assignees:N}),t();}}))})),y.push({id:"sep2",label:"",icon:null,separator:true}),s&&y.push({id:"duplicate",label:p.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&y.push({id:"delete",label:p.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),y},v=()=>{if(!e.columnId)return [];let y=[];return i&&(y.push({id:"sort-asc",label:p.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),y.push({id:"sort-desc",label:p.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),m&&e.columnId!=="name"&&(y.push({id:"sep-hide",label:"",icon:null,separator:true}),y.push({id:"hide",label:p.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{m(e.columnId),t();}})),y},w=e.type==="task"?f():v(),g={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:l,style:g,className:u("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:w.map(y=>y.separator?jsx("div",{className:u("my-1 h-px",a?"bg-white/10":"bg-gray-200")},y.id):y.submenu?jsx(Zv,{item:y,isDark:a},y.id):jsxs("button",{onClick:y.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",y.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:u(y.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:y.icon}),y.label]},y.id))})}function Zv({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/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:u("w-4 h-4",t?"text-[#6B7280]":"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-[#0F1117] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(d=>jsxs("button",{onClick:d.onClick,className:u("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:d.icon}),d.label]},d.id))})]})}var Uu={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",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"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",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"}};var Yu={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"}),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"})},px=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function Ju({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:d}){let[m,i]=useState(""),[c,l]=useState(null),p=useRef(null),f=d==="es"?Xu.es:Xu.en;if(useLayoutEffect(()=>{if(!e||!p.current)return;let b=()=>{if(!p.current)return;let x=p.current.getBoundingClientRect(),D=window.innerHeight-x.top-20;l(Math.max(300,D));};return requestAnimationFrame(b),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[e]),useEffect(()=>{if(!e)return;let b=setTimeout(()=>{let x=D=>{p.current&&!p.current.contains(D.target)&&t();},N=D=>{D.key==="Escape"&&t();};document.addEventListener("mousedown",x),document.addEventListener("keydown",N),p._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",N);};},100);return ()=>{clearTimeout(b),p._cleanup&&p._cleanup();}},[e,t]),!e)return null;let v=b=>f.columns[b]||b,w=b=>{if(b==="name")return;let x=a.map(N=>N.id===b?{...N,visible:!N.visible}:N);o(x);},g=(b,x)=>{let N=a.find(T=>T.type===b&&(!x||T.customFieldId===x));if(N){w(N.id);return}let D={id:x||b,type:b,label:x?r.find(T=>T.id===x)?.name||b:v(b),width:120,visible:true,sortable:true,resizable:true,customFieldId:x};o([...a,D]);},y=px.filter(b=>v(b).toLowerCase().includes(m.toLowerCase())),h=r.filter(b=>b.name.toLowerCase().includes(m.toLowerCase()));return jsxs("div",{ref:p,style:c?{maxHeight:`${c}px`}:void 0,className:u("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50 flex flex-col",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:u("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:u("font-medium",n?"text-white":"text-gray-900"),children:f.title}),jsx("button",{onClick:t,className:u("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(X,{className:u("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsx("div",{className:"p-3",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:u("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsx("input",{type:"text",value:m,onChange:b=>i(b.target.value),placeholder:f.searchPlaceholder,className:u("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain",onWheel:b=>b.stopPropagation(),children:[jsxs("div",{className:"px-3 pb-2",children:[jsx("h4",{className:u("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:f.standardFields}),jsx("div",{className:"space-y-1",children:y.map(b=>{let x=a.find(T=>T.type===b&&!T.customFieldId),N=x?.visible??false,D=b==="name";return jsxs("button",{onClick:()=>{D||(x?w(x.id):g(b));},disabled:D,className:u("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",D&&"opacity-50 cursor-not-allowed"),children:[jsx("div",{className:u("w-5 h-5 rounded border flex items-center justify-center",N?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:N&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:Yu[b]}),jsx("span",{className:n?"text-white":"text-gray-900",children:v(b)})]},b)})})]}),h.length>0&&jsxs("div",{className:"px-3 pb-2",children:[jsx("h4",{className:u("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:f.customFields}),jsx("div",{className:"space-y-1",children:h.map(b=>{let N=a.find(D=>D.customFieldId===b.id)?.visible??false;return jsxs("button",{onClick:()=>g(b.type,b.id),className:u("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx("div",{className:u("w-5 h-5 rounded border flex items-center justify-center",N?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:N&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:Yu[b.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{className:n?"text-white":"text-gray-900",children:b.name})]},b.id)})})]})]})]})}var Xu={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",effortMinutes:"Estimated",timeLoggedMinutes:"Time Logged",soldEffortMinutes:"Quoted",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",effortMinutes:"Estimado",timeLoggedMinutes:"Tiempo Registrado",soldEffortMinutes:"Ofertado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var wx=[{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 ep({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[d,m]=useState("text"),[i,c]=useState([""]),l=o==="es"?Qu.es:Qu.en;useEffect(()=>{e&&(n(""),m("text"),c([""]));},[e]),useEffect(()=>{let g=y=>{y.key==="Escape"&&t();};return e&&document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]);let p=()=>{if(!s.trim())return;let g={name:s.trim(),type:d};d==="dropdown"&&(g.options=i.filter(y=>y.trim())),a(g),t();},f=()=>{c([...i,""]);},v=(g,y)=>{let h=[...i];h[g]=y,c(h);},w=g=>{i.length>1&&c(i.filter((y,h)=>h!==g));};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-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:u("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsx("h2",{className:u("text-lg font-semibold",r?"text-white":"text-gray-900"),children:l.title}),jsx("button",{onClick:t,className:u("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(X,{className:u("w-5 h-5",r?"text-[#9CA3AF]":"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:l.fieldName}),jsx("input",{type:"text",value:s,onChange:g=>n(g.target.value),placeholder:l.fieldNamePlaceholder,className:u("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"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:l.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:wx.map(g=>jsxs("button",{onClick:()=>m(g.type),className:u("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",d===g.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:d===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:g.icon}),jsx("span",{className:u("text-xs",d===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:l.types[g.type]})]},g.type))})]}),d==="dropdown"&&jsxs("div",{children:[jsx("label",{className:u("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:l.options}),jsxs("div",{className:"space-y-2",children:[i.map((g,y)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:g,onChange:h=>v(y,h.target.value),placeholder:`${l.option} ${y+1}`,className:u("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsx("button",{onClick:()=>w(y),className:u("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},y)),jsxs("button",{onClick:f,className:u("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),l.addOption]})]})]})]}),jsxs("div",{className:u("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsx("button",{onClick:t,className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"text-gray-600 hover:bg-gray-100"),children:l.cancel}),jsx("button",{onClick:p,disabled:!s.trim(),className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:l.create})]})]})]}):null}var Qu={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 rp={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 op({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,d]=useState(false),m=useRef(null),i=useRef(0),c=s==="es"?rp.es:rp.en;useEffect(()=>{if(!n)return;let f=w=>{Date.now()-i.current<100||m.current&&!m.current.contains(w.target)&&d(false);},v=w=>{w.key==="Escape"&&d(false);};return document.addEventListener("mousedown",f),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",v);}},[n]);let l=[{value:"all",label:c.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:c.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:c.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:c.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxs("div",{ref:m,className:"relative",children:[jsxs("button",{onClick:f=>{f.stopPropagation(),n||(i.current=Date.now()),d(v=>!v);},className:u("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-white/10 hover:bg-white/10 text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#3B82F6]/20 border-[#3B82F6]/50 text-[#3B82F6]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/10":"bg-gray-100")),children:[jsx(Filter,{className:"w-4 h-4"}),c.filters,p&&jsx("span",{className:u("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"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-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsx("div",{className:u("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsx("span",{className:u("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:c.filterByStatus})}),jsx("div",{className:"py-2",children:l.map(f=>{let v=e===f.value&&!t,w=()=>f.value==="all"?v?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):f.icon;return jsxs("button",{onClick:()=>{a(f.value),r(false),d(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",v&&(o?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u(v?f.color:"text-gray-400","flex-shrink-0"),children:w()}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:f.label}),v&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},f.value)})}),jsx("div",{className:u("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let f=!t;r(f),f&&a("all"),d(false);},className:u("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",t&&(o?"bg-white/5":"bg-gray-50")),children:[jsx(EyeOff,{className:u("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:u("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsx(Check,{className:u("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]})})]})]})}var Rx=[{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 lp(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(...lp(r.subtasks,t+1));return a}function dp({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:d=[],customFields:m=[]}){let{theme:i="dark",locale:c="en",customTranslations:l,showSearch:p=true,showHierarchy:f=true,tableColumns:v,allowColumnCustomization:w=true,allowColumnResize:g=true,enableContextMenu:y=true,showCreateTaskButton:h=false,onCreateTask:b,persistFilter:x=false,financialBlur:N}=t,D=Ls(c,l),T=i==="dark",k=useCallback(()=>{if(!x||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let G=localStorage.getItem(x);if(G){let Y=JSON.parse(G);return {statusFilter:Y.statusFilter||"all",hideCompleted:Y.hideCompleted||!1}}}catch(G){console.error("Error loading persisted filter:",G);}return {statusFilter:"all",hideCompleted:false}},[x]),[R,I]=useState("startDate"),[C,W]=useState("asc"),[B,Q]=useState(""),[S,_]=useState(()=>k().statusFilter),[oe,Te]=useState(()=>k().hideCompleted),[A,Ee]=useState(v||Rx),[L,U]=useState(false),[E,q]=useState(false),[ee,de]=useState({isOpen:false,x:0,y:0,type:"task"}),[he,ge]=useState(null),[Le,re]=useState(0),[Qe,Ie]=useState(0),Ke=useRef(null);useEffect(()=>{v&&Ee(v);},[v]),useEffect(()=>{if(!(!x||typeof window>"u"))try{localStorage.setItem(x,JSON.stringify({statusFilter:S,hideCompleted:oe}));}catch(G){console.error("Error persisting filter state:",G);}},[x,S,oe]);let ht=useMemo(()=>{let G=new Set;function Y(be){for(let Ye of be)Ye.subtasks?.length&&(Ye.isExpanded!==false&&G.add(Ye.id),Y(Ye.subtasks));}return Y(e),G},[e]),bt=useMemo(()=>A.filter(G=>G.visible),[A]),qe=useCallback(G=>{a.onTaskToggleExpand?.(G);},[a]),xt=useCallback(G=>{R===G?W(Y=>Y==="asc"?"desc":"asc"):(I(G),W("asc")),a.onSortChange?.({column:G,direction:C==="asc"?"desc":"asc"});},[R,C,a]),ut=useCallback(G=>{Ee(G),a.onColumnsChange?.(G);},[a]),yt=useCallback(G=>{let Y=A.map(be=>be.id===G?{...be,visible:false}:be);ut(Y);},[A,ut]),ne=useCallback((G,Y)=>{I(G),W(Y);},[]),O=useCallback((G,Y,be)=>{y&&(G.preventDefault(),de({isOpen:true,x:G.clientX,y:G.clientY,type:Y?"task":"header",task:Y,columnId:be}));},[y]),J=useCallback(()=>{de(G=>({...G,isOpen:false}));},[]),ce=useCallback((G,Y)=>{if(!g)return;G.preventDefault(),G.stopPropagation();let be=A.find(Ye=>Ye.id===Y);be&&(ge(Y),re(G.clientX),Ie(be.width));},[A,g]);useEffect(()=>{if(!he)return;let G=be=>{let Ye=be.clientX-Le,we=Math.max(50,Qe+Ye),Pe=A.map(X=>X.id===he?{...X,width:we}:X);Ee(Pe);},Y=()=>{he&&a.onColumnsChange?.(A),ge(null);};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",Y),()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",Y);}},[he,Le,Qe,A,a]);let ke=useCallback(async G=>{if(a.onCreateCustomField){let Y={...G,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(Y);}q(false);},[a]),$e=useCallback(G=>G.progress===100||G.status==="completed"?"completed":G.progress&&G.progress>0||G.status==="in-progress"?"in-progress":"todo",[]),Je=useMemo(()=>{let G=lp(e);if(B.trim()){let Y=B.toLowerCase();G=G.filter(be=>be.name.toLowerCase().includes(Y));}return S!=="all"&&(G=G.filter(Y=>$e(Y)===S)),oe&&(G=G.filter(Y=>$e(Y)!=="completed")),G.sort((Y,be)=>{let Ye,we;switch(R){case "name":Ye=Y.name.toLowerCase(),we=be.name.toLowerCase();break;case "startDate":Ye=Y.startDate?.getTime()||0,we=be.startDate?.getTime()||0;break;case "endDate":Ye=Y.endDate?.getTime()||0,we=be.endDate?.getTime()||0;break;case "progress":Ye=Y.progress||0,we=be.progress||0;break;case "status":Ye=Y.status||"todo",we=be.status||"todo";break;case "priority":let Pe={urgent:0,high:1,medium:2,low:3,none:4};Ye=Pe[Y.priority]??4,we=Pe[be.priority]??4;break;default:return 0}return Ye<we?C==="asc"?-1:1:Ye>we?C==="asc"?1:-1:0}),G},[e,B,S,oe,R,C,$e]),ot=useCallback((G,Y)=>{let be=Pe=>{a.onTaskUpdate?.({...G,...Pe});},Ye=Pe=>Pe?G.customFields?.find(Ue=>Ue.fieldId===Pe)?.value:void 0,we=(Pe,X)=>{if(!Pe)return;let H=[...G.customFields||[]],ie=H.findIndex(Fe=>Fe.fieldId===Pe);ie>=0?H[ie]={fieldId:Pe,value:X}:H.push({fieldId:Pe,value:X}),be({customFields:H});};switch(Y.type){case "name":return null;case "status":return jsx(uu,{value:G.status||(G.progress===100?"completed":G.progress&&G.progress>0?"in-progress":"todo"),onChange:X=>{be({status:X,progress:X==="completed"?100:X==="in-progress"?50:0});},isDark:T,locale:c,translations:D.status});case "priority":return jsx(gu,{value:G.priority,onChange:X=>be({priority:X}),isDark:T,locale:c});case "assignees":return jsx(bu,{value:G.assignees||[],availableUsers:d,onChange:X=>be({assignees:X}),isDark:T,locale:c});case "startDate":return jsx($s,{value:G.startDate,onChange:X=>be({startDate:X}),isDark:T,locale:c,dateField:"start",startDate:G.startDate,endDate:G.endDate});case "endDate":return jsx($s,{value:G.endDate,onChange:X=>be({endDate:X}),isDark:T,locale:c,dateField:"end",startDate:G.startDate,endDate:G.endDate});case "progress":return jsx(Tu,{value:G.progress||0,onChange:X=>{let Ue=X===100?"completed":X>0?"in-progress":"todo";be({progress:X,status:Ue});},isDark:T});case "tags":return jsx(Ru,{value:G.tags||[],isDark:T});case "text":return jsx(Su,{value:Ye(Y.customFieldId)||"",onChange:X=>we(Y.customFieldId,X),isDark:T});case "number":return jsx(Mu,{value:Ye(Y.customFieldId)||0,onChange:X=>we(Y.customFieldId,X),isDark:T});case "date":let Pe=Ye(Y.customFieldId);return jsx($s,{value:Pe?new Date(Pe):void 0,onChange:X=>we(Y.customFieldId,X),isDark:T,locale:c});case "dropdown":return jsx(Fu,{value:Ye(Y.customFieldId)||"",options:Y.options||[],onChange:X=>we(Y.customFieldId,X),isDark:T});case "checkbox":return jsx(Lu,{value:Ye(Y.customFieldId)||false,onChange:X=>we(Y.customFieldId,X),isDark:T});case "estimatedTime":{let X=G.status==="completed"||G.progress===100;return jsx(wo,{value:G.estimatedTime,onChange:Ue=>be({estimatedTime:Ue}),isDark:T,locale:c,disabled:X})}case "quotedTime":{let X=G.status==="completed"||G.progress===100,Ue=N?.enabled&&(!N.columns||N.columns.includes("quotedTime"));return jsx(wo,{value:G.quotedTime,onChange:H=>be({quotedTime:H}),isDark:T,locale:c,disabled:X,isBlurred:Ue})}case "elapsedTime":{let X=G.status==="completed"||G.progress===100;return jsx(wo,{value:G.elapsedTime,onChange:Ue=>be({elapsedTime:Ue}),isDark:T,locale:c,disabled:X})}case "effortMinutes":{let X=G.status==="completed"||G.progress===100;return jsx(wo,{value:G.effortMinutes,onChange:Ue=>be({effortMinutes:Ue}),isDark:T,locale:c,disabled:X})}case "timeLoggedMinutes":{let X=G.status==="completed"||G.progress===100;return jsx(wo,{value:G.timeLoggedMinutes,onChange:a.onLogTime?Ue=>{a.onLogTime?.(G,Ue);}:void 0,isDark:T,locale:c,placeholder:c==="es"?"Agregar":"Add",disabled:X})}case "soldEffortMinutes":{let X=G.status==="completed"||G.progress===100,Ue=N?.enabled&&(!N.columns||N.columns.includes("soldEffortMinutes"));return jsx(wo,{value:G.soldEffortMinutes,onChange:H=>be({soldEffortMinutes:H}),isDark:T,locale:c,disabled:X,isBlurred:Ue})}default:return jsx("span",{className:u("text-sm",T?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,T,c,d,D]),ze=useCallback(G=>{let be={name:D.columns.name,status:D.columns.status,priority:D.columns.priority,assignees:D.columns.assignees,startDate:D.columns.startDate,endDate:D.columns.endDate,progress:D.columns.progress,tags:D.columns.tags||(c==="es"?"Etiquetas":"Tags"),estimatedTime:D.columns.estimatedTime||(c==="es"?"Estimado":"Estimated"),quotedTime:D.columns.quotedTime||(c==="es"?"Ofertado":"Quoted"),elapsedTime:D.columns.elapsedTime||(c==="es"?"Tiempo":"Time Spent"),effortMinutes:D.columns.effortMinutes||(c==="es"?"Estimado":"Estimated"),timeLoggedMinutes:D.columns.timeLoggedMinutes||(c==="es"?"Tiempo":"Time Logged"),soldEffortMinutes:D.columns.soldEffortMinutes||(c==="es"?"Ofertado":"Quoted")}[G.type]||G.label;return typeof be=="string"?be:String(be||G.type)},[D,c]),oa=useMemo(()=>bt.reduce((G,Y)=>G+Y.width,0)+(w?48:0),[bt,w]);return r?jsx("div",{className:u("flex-1 flex items-center justify-center",T?"bg-[#0F1117]":"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-[#3B82F6]"}),jsxs("p",{className:u("text-sm",T?"text-[#9CA3AF]":"text-gray-600"),children:[D.empty.noTasks,"..."]})]})}):o?jsx("div",{className:u("flex-1 flex items-center justify-center",T?"bg-[#0F1117]":"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",T?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:u("text-sm",T?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:u("flex-1 flex items-center justify-center",T?"bg-[#0F1117]":"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-[#3B82F6]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:u("text-lg font-semibold mb-2",T?"text-white":"text-gray-900"),children:D.empty.noTasks}),jsx("p",{className:u("text-sm",T?"text-[#9CA3AF]":"text-gray-600"),children:D.empty.addFirstTask})]})}):jsxs("div",{ref:Ke,className:u("flex-1 flex flex-col w-full h-full overflow-hidden",T?"bg-[#0F1117]":"bg-white",he&&"select-none",s),style:n,children:[jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",T?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsx(op,{value:S,hideCompleted:oe,onChange:_,onHideCompletedChange:Te,isDark:T,locale:c}),jsxs("div",{className:u("text-sm",T?"text-[#9CA3AF]":"text-gray-600"),children:[Je.length," ",D.pagination.tasks]}),p&&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",T?"text-[#9CA3AF]":"text-gray-400")}),jsx("input",{type:"text",value:B,onChange:G=>Q(G.target.value),placeholder:D.toolbar.searchPlaceholder,className:u("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",T?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),h&&b&&jsxs(motion.button,{onClick:b,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 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-4 h-4"}),jsx("span",{children:D.toolbar.newTask})]})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsxs("div",{style:{minWidth:oa},children:[jsxs("div",{className:u("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",T?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[bt.map(G=>jsxs("div",{className:u("relative flex items-center gap-2 px-4 py-3",T?"text-[#9CA3AF]":"text-gray-500"),style:{width:G.width,minWidth:G.minWidth},onContextMenu:Y=>O(Y,void 0,G.id),children:[G.sortable?jsxs("button",{onClick:()=>xt(G.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[ze(G),jsx(ArrowUpDown,{className:u("w-3 h-3",R===G.id&&"text-[#3B82F6]")})]}):jsx("span",{children:ze(G)}),g&&G.resizable&&jsx("div",{className:u("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",he===G.id&&"bg-[#3B82F6]"),onMouseDown:Y=>ce(Y,G.id)})]},G.id)),w&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsx("button",{onClick:G=>{G.stopPropagation(),U(Y=>!Y);},className:u("p-1.5 rounded-lg transition-colors",T?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",L&&(T?"bg-white/10":"bg-gray-200")),title:c==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-4 h-4"})}),jsx(Ju,{isOpen:L,onClose:()=>U(false),columns:A,customFields:m,onColumnsChange:ut,onCreateCustomField:()=>{U(false),q(true);},isDark:T,locale:c})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Je.map((G,Y)=>{let be=ht.has(G.id),Ye=Math.min(Y*.01,.2);return jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Ye},className:u("flex items-center border-b transition-colors",T?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(G),onDoubleClick:()=>a.onTaskDoubleClick?.(G),onContextMenu:we=>O(we,G),children:[bt.map(we=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:we.width,minWidth:we.minWidth},children:we.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[f&&G.level>0&&jsx("div",{style:{width:`${G.level*24}px`},className:"flex-shrink-0"}),f&&G.hasChildren&&jsx("button",{onClick:Pe=>{Pe.stopPropagation(),qe(G.id);},className:u("p-0.5 rounded flex-shrink-0",T?"hover:bg-white/10":"hover:bg-gray-200"),children:be?jsx(ChevronDown,{className:u("w-4 h-4",T?"text-[#9CA3AF]":"text-gray-400")}):jsx(ChevronRight,{className:u("w-4 h-4",T?"text-[#9CA3AF]":"text-gray-400")})}),f&&!G.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsx("span",{className:u("truncate font-medium",T?"text-white":"text-gray-900",G.progress===100&&(T?"line-through text-[#6B7280]":"line-through text-gray-400")),children:G.name})]}):ot(G,we)},we.id)),w&&jsx("div",{className:"w-12 flex-shrink-0"})]},G.id)})}),Je.length===0&&B&&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",T?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:u(T?"text-[#9CA3AF]":"text-gray-600"),children:D.empty.noResults})]})})]})}),jsx(Wu,{state:ee,onClose:J,isDark:T,locale:c,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:yt,onColumnSort:ne,availableUsers:d}),jsx(ep,{isOpen:E,onClose:()=>q(false),onSave:ke,isDark:T,locale:c})]})}var cp=[{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:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,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:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Time Logged",width:100,visible:false,sortable:true,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true}],mp=[{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"}],up=[{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 jl={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},Kl={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"},ql={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"},Ws={dark:jl,light:Kl,neutral:ql};function pp(e){return Ws[e]||Ws.dark}var Yl={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"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Xl={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"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},Gs={en:Yl,es:Xl};function Pn(e){return Gs[e]||Gs.en}function Vs(e,t){let a=Pn(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 gp(e){let t=Pn(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 fp(e,t=0,a=true){let r=Pn(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 xp(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 Zl(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 kp({task:e}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsx(Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function Cp({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:d,availableTags:m=[],onCreateTag:i,attachmentsByTask:c,comments:l,onAddComment:p,currentUser:f,mentionableUsers:v,onUploadCommentAttachments:w,onTaskOpen:g,enableTimeTracking:y,timeTrackingSummary:h,timeEntries:b,timerState:x,onLogTime:N,onUpdateEstimate:D,onUpdateSoldEffort:T,onStartTimer:k,onStopTimer:R,onDiscardTimer:I,blurFinancials:C=false}){let{theme:W="dark",locale:B="en",customTranslations:Q}=t,S=Vs(B,Q),_=W==="dark",[oe,Te]=useState(r||new Date),[A,Ee]=useState(null),[L,U]=useState(null),[E,q]=useState({}),ee=4,de=3,[he,ge]=useState(null),[Le,re]=useState(""),[Qe,Ie]=useState(void 0),[Ke,ht]=useState(null),[bt,qe]=useState(false),[xt,ut]=useState(false),[yt,ne]=useState(null),[O,J]=useState(false),[ce,ke]=useState(new Date),$e=useCallback(()=>{Te(new Date(oe.getFullYear(),oe.getMonth()-1,1));},[oe]),Je=useCallback(()=>{Te(new Date(oe.getFullYear(),oe.getMonth()+1,1));},[oe]),ot=useCallback(()=>{Te(new Date);},[]),ze=useMemo(()=>{let Y=oe.getFullYear(),be=oe.getMonth(),Ye=new Date(Y,be,1),we=new Date(Y,be+1,0),Pe=Ye.getDay(),X=we.getDate(),Ue=xp(e),H=new Date;H.setHours(0,0,0,0);let ie=[],Fe=Pe,Ve=new Date(Y,be,0).getDate();for(let Re=Fe-1;Re>=0;Re--){let z=new Date(Y,be-1,Ve-Re);ie.push({date:z,isCurrentMonth:false,isToday:false,isWeekend:z.getDay()===0||z.getDay()===6,events:Ue.filter(K=>Zl(z,K)).map(K=>({id:K.id,title:K.name,start:K.startDate,end:K.endDate,task:K}))});}for(let Re=1;Re<=X;Re++){let z=new Date(Y,be,Re),K=z.getTime()===H.getTime();ie.push({date:z,isCurrentMonth:true,isToday:K,isWeekend:z.getDay()===0||z.getDay()===6,events:Ue.filter(ye=>Zl(z,ye)).map(ye=>({id:ye.id,title:ye.name,start:ye.startDate,end:ye.endDate,task:ye}))});}let We=42-ie.length;for(let Re=1;Re<=We;Re++){let z=new Date(Y,be+1,Re);ie.push({date:z,isCurrentMonth:false,isToday:false,isWeekend:z.getDay()===0||z.getDay()===6,events:Ue.filter(K=>Zl(z,K)).map(K=>({id:K.id,title:K.name,start:K.startDate,end:K.endDate,task:K}))});}return ie},[oe,e]),oa=B==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],G=oe.toLocaleDateString(B==="es"?"es-ES":"en-US",{month:"long",year:"numeric"});return o?jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#0F1117]":"bg-white",n),style:d,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-[#3B82F6]"}),jsxs("p",{className:u("text-sm",_?"text-[#9CA3AF]":"text-gray-600"),children:[S.labels.noEvents,"..."]})]})}):s?jsx("div",{className:u("flex-1 flex items-center justify-center",_?"bg-[#0F1117]":"bg-white",n),style:d,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-[#9CA3AF]":"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-[#0F1117]":"bg-white",n),style:d,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsx(Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:u("text-lg font-semibold mb-2",_?"text-white":"text-gray-900"),children:S.labels.noEvents}),jsx("p",{className:u("text-sm",_?"text-[#9CA3AF]":"text-gray-600"),children:S.labels.newTask})]})}):jsxs("div",{className:u("flex-1 flex flex-col w-full h-full overflow-auto",_?"bg-[#0F1117]":"bg-white",n),style:d,children:[jsx("div",{className:u("flex-shrink-0 px-6 py-4 border-b",_?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-4",children:[jsx("h2",{className:u("text-xl font-semibold capitalize",_?"text-white":"text-gray-900"),children:G}),jsx("button",{onClick:ot,className:u("px-3 py-1.5 text-sm rounded-lg transition-colors",_?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:S.navigation.today})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{onClick:$e,className:u("p-2 rounded-lg transition-colors",_?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:u("w-5 h-5",_?"text-[#9CA3AF]":"text-gray-600")})}),jsx("button",{onClick:Je,className:u("p-2 rounded-lg transition-colors",_?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:u("w-5 h-5",_?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxs("div",{className:"flex flex-col",children:[jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:oa.map(Y=>jsx("div",{className:u("py-2 text-center text-xs font-medium uppercase",_?"text-[#9CA3AF]":"text-gray-500"),children:Y},Y))}),jsx("div",{className:u("grid grid-cols-7 auto-rows-min gap-px rounded-lg",_?"bg-[#2D2D2D]":"bg-gray-300"),children:ze.map((Y,be)=>{let Ye=Y.date.getDay()===0||Y.date.getDay()===6;return jsxs("div",{className:u("min-h-[120px] p-2 transition-colors flex flex-col relative group",_?Ye?"bg-[#1C1F26]":Y.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":Ye?"bg-gray-100":Y.isCurrentMonth?"bg-white":"bg-gray-50",Y.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let we=E[be]||ee,Pe=Y.events.slice(0,we),X=Y.events.length-we;return jsxs("div",{className:"space-y-1 flex-1",children:[Pe.map(Ue=>jsx("div",{className:"relative group",children:jsxs(motion.button,{onClick:()=>{Ee(Ue.task),a.onEventClick?.(Ue),g?.(Ue.task.id);},whileHover:{scale:1.02},className:u("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Ue.task.progress===100?_?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":_?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsx(kp,{task:Ue.task}),jsx("span",{className:"truncate",children:Ue.title})]})},Ue.id)),X>0&&jsxs("button",{onClick:Ue=>{Ue.stopPropagation(),q(H=>({...H,[be]:we+de}));},className:u("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",_?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",X," ",B==="es"?"M\xC1S":"MORE"]}),we>ee&&Y.events.length>ee&&jsx("button",{onClick:Ue=>{Ue.stopPropagation(),q(H=>({...H,[be]:ee}));},className:u("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",_?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:B==="es"?"MENOS":"LESS"})]})})(),jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let we=be>=28,Pe=be%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:X=>{X.stopPropagation(),he===be?ge(null):(ge(be),re(""),Ie(void 0),ht(null),ne(null),qe(false),ut(false),J(false),ke(Y.date));},className:u("w-5 h-5 rounded flex items-center justify-center transition-all",he===be?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",_?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsx(Plus,{className:u("w-3.5 h-3.5 transition-transform",he===be&&"rotate-45")})}),jsx(AnimatePresence,{children:he===be&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ge(null),re(""),Ie(void 0),ht(null),ne(null),qe(false),ut(false),J(false);}}),jsxs(motion.div,{initial:{opacity:0,y:we?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:we?-5:5,scale:.95},transition:{duration:.12},className:u("absolute w-[320px] rounded-lg shadow-2xl z-50",we?"bottom-full mb-1":"top-full mt-1",Pe?"right-0":"left-0",_?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>{X.stopPropagation(),qe(false),ut(false),J(false);},children:[jsx("div",{className:"p-2.5",children:jsx("input",{type:"text",value:Le,onChange:X=>re(X.target.value),placeholder:B==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:u("w-full bg-transparent text-sm outline-none placeholder:opacity-40",_?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:X=>{if(X.key==="Enter"&&Le.trim()){let Ue=t.availableUsers?.find(ie=>ie.id===Ke),H=yt||Y.date;a.onTaskCreate?.({name:Le.trim(),startDate:H,endDate:H,priority:Qe,assignees:Ue?[Ue]:void 0}),re(""),Ie(void 0),ht(null),ne(null),ge(null);}X.key==="Escape"&&(ge(null),re(""),Ie(void 0),ht(null),ne(null));}})}),jsxs("div",{className:u("px-2.5 py-2 flex items-center justify-between border-t",_?"border-white/10":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:X=>{X.stopPropagation(),qe(!bt),ut(false);},className:u("p-1 rounded transition-colors",Qe?Qe==="urgent"||Qe==="high"?"text-red-400 bg-red-500/20":Qe==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":_?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:bt&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",_?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[{id:"urgent",label:B==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:B==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:B==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:B==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:B==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(X=>jsxs("button",{onClick:()=>{Ie(X.id),qe(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",_?"hover:bg-white/5":"hover:bg-gray-50",Qe===X.id&&(_?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:u("w-2 h-2 rounded-full",X.color)}),jsx("span",{className:_?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:X=>{X.stopPropagation(),J(!O),qe(false),ut(false),ke(yt||Y.date);},className:u("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",yt?"bg-[#7C3AED]/20 text-[#7C3AED]":_?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),(yt||Y.date).toLocaleDateString(B==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:O&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",_?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsx("div",{className:u("w-40 py-2 border-r",_?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,Ue=new Date(X);Ue.setDate(X.getDate()+1);let H=new Date(X);H.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let ie=new Date(X);ie.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let Fe=new Date(X);Fe.setDate(X.getDate()+14);let Ve=new Date(X);return Ve.setDate(X.getDate()+28),[{label:B==="es"?"Hoy":"Today",date:X,display:X.toLocaleDateString(B==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:B==="es"?"Ma\xF1ana":"Tomorrow",date:Ue,display:Ue.toLocaleDateString(B==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:B==="es"?"Este fin de semana":"This weekend",date:H,display:B==="es"?"s\xE1b.":"sat."},{label:B==="es"?"Pr\xF3xima semana":"Next week",date:ie,display:B==="es"?"lun.":"mon."},{label:B==="es"?"2 semanas":"2 weeks",date:Fe,display:Fe.toLocaleDateString(B==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:B==="es"?"4 semanas":"4 weeks",date:Ve,display:Ve.toLocaleDateString(B==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Re,z)=>jsxs("button",{className:u("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",_?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{ne(Re.date),J(false);},children:[jsx("span",{children:Re.label}),jsx("span",{className:u("text-[10px]",_?"text-[#6B7280]":"text-gray-400"),children:Re.display})]},z))})()}),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",_?"text-white":"text-gray-900"),children:ce.toLocaleDateString(B==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>ke(new Date),className:u("px-1.5 py-0.5 rounded text-[10px] transition-colors",_?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:B==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>ke(new Date(ce.getFullYear(),ce.getMonth()-1)),className:u("p-0.5 rounded",_?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:()=>ke(new Date(ce.getFullYear(),ce.getMonth()+1)),className:u("p-0.5 rounded",_?"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:(B==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsx("div",{className:u("w-6 h-6 flex items-center justify-center text-[10px]",_?"text-[#6B7280]":"text-gray-400"),children:X},X))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=ce.getFullYear(),Ue=ce.getMonth(),H=new Date(X,Ue,1).getDay(),ie=new Date(X,Ue+1,0).getDate(),Fe=new Date(X,Ue,0).getDate(),Ve=new Date,We=[];for(let z=H-1;z>=0;z--)We.push({dayNum:Fe-z,isCurrentMonth:false,date:new Date(X,Ue-1,Fe-z)});for(let z=1;z<=ie;z++)We.push({dayNum:z,isCurrentMonth:true,date:new Date(X,Ue,z)});let Re=42-We.length;for(let z=1;z<=Re;z++)We.push({dayNum:z,isCurrentMonth:false,date:new Date(X,Ue+1,z)});return We.map((z,K)=>{let ye=z.date.toDateString()===Ve.toDateString(),_e=(yt||Y.date).toDateString()===z.date.toDateString();return jsx("button",{className:u("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!z.isCurrentMonth&&(_?"text-[#4B5563]":"text-gray-300"),z.isCurrentMonth&&(_?"text-white":"text-gray-900"),ye&&"ring-1 ring-[#3B82F6]",_e&&"bg-[#7C3AED] text-white",!_e&&(_?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{ne(z.date),J(false);},children:z.dayNum},K)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:X=>{X.stopPropagation(),ut(!xt),qe(false);},className:u("p-1 rounded transition-colors",Ke?"text-[#7C3AED] bg-[#7C3AED]/20":_?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:Ke?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(X=>X.id===Ke)?.color||"#7C3AED"},children:t.availableUsers?.find(X=>X.id===Ke)?.initials||t.availableUsers?.find(X=>X.id===Ke)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:xt&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:u("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",_?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxs("button",{onClick:()=>{ht(null),ut(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",_?"hover:bg-white/5":"hover:bg-gray-50",!Ke&&(_?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:u("w-5 h-5 rounded-full flex items-center justify-center",_?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:_?"text-[#9CA3AF]":"text-gray-500",children:B==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(X=>jsxs("button",{onClick:()=>{ht(X.id),ut(false);},className:u("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",_?"hover:bg-white/5":"hover:bg-gray-50",Ke===X.id&&(_?"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-medium",style:{backgroundColor:X.color||"#7C3AED"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsx("span",{className:_?"text-white":"text-gray-900",children:X.name})]},X.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsx("div",{className:u("px-3 py-2 text-xs",_?"text-[#6B7280]":"text-gray-400"),children:B==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:()=>{if(Le.trim()){let X=t.availableUsers?.find(H=>H.id===Ke),Ue=yt||Y.date;a.onTaskCreate?.({name:Le.trim(),startDate:Ue,endDate:Ue,priority:Qe,assignees:X?[X]:void 0}),re(""),Ie(void 0),ht(null),ne(null),ge(null);}},disabled:!Le.trim(),className:u("px-2.5 py-1 rounded text-xs font-medium transition-colors",Le.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":_?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:B==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsx("span",{className:u("text-sm font-medium",Y.isToday?"text-[#3B82F6]":Y.isCurrentMonth?_?"text-white":"text-gray-900":_?"text-[#6B7280]":"text-gray-400"),children:Y.date.getDate()})]})]},be)})})]})}),jsx(Ir,{task:A,isOpen:!!A,onClose:()=>Ee(null),onTaskUpdate:Y=>{a.onTaskUpdate?.(Y),Ee(Y);},theme:W==="dark"?"dark":"light",locale:B,availableUsers:t.availableUsers?.map(Y=>({id:Y.id,name:Y.name,avatar:Y.avatar,initials:Y.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:m,onCreateTag:i,attachments:A?c?.get(A.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:xp(e).filter(Y=>Y.id!==A?.id),comments:l?.filter(Y=>Y.taskId===A?.id).map(Y=>({...Y,createdAt:Y.createdAt instanceof Date?Y.createdAt:new Date(Y.createdAt),updatedAt:Y.updatedAt instanceof Date?Y.updatedAt:Y.updatedAt?new Date(Y.updatedAt):void 0})),onAddComment:p,currentUser:f,mentionableUsers:v,onUploadCommentAttachments:w,enableTimeTracking:y,timeTrackingSummary:h,timeEntries:b,isTimerRunning:x?.isRunning,timerElapsedSeconds:x?.elapsedSeconds,onTimeLog:N,onEstimateUpdate:D,onSoldEffortUpdate:T,onTimerStart:k,onTimerStop:R,onTimerDiscard:I,blurFinancials:C}),jsx(AnimatePresence,{children:L&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>U(null),className:"fixed inset-0 bg-black/30 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-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:u("px-4 py-3 border-b flex items-center justify-between",_?"border-white/10":"border-gray-200"),children:[jsx("span",{className:u("font-medium",_?"text-white":"text-gray-900"),children:L.date.toLocaleDateString(B==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>U(null),className:u("p-1 rounded",_?"hover:bg-white/10 text-[#9CA3AF]":"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-2",children:L.events.map(Y=>jsxs("button",{onClick:()=>{U(null),Ee(Y.task),g?.(Y.task.id);},className:u("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",_?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx(kp,{task:Y.task}),jsx("span",{className:u("text-sm truncate flex-1",_?"text-white":"text-gray-900"),children:Y.title}),Y.task.priority==="high"||Y.task.priority==="urgent"?jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},Y.id))})]})]})})]})}var Ql={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},ed={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"},td={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"},_s={dark:Ql,light:ed,neutral:td};function Tp(e){return _s[e]||_s.dark}function jx({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:d}){let[m,i]=useState(false),c=useMemo(()=>t.filter(f=>e.cardIds.includes(f.id)),[t,e.cardIds]),l=useMemo(()=>{let f=c.length,v=new Set(c.flatMap(y=>y.assignedUserIds||[])).size,w=c.map(y=>y.priority).filter(Boolean),g=new Set(c.flatMap(y=>y.labels||[])).size;return {totalCards:f,uniqueAssignees:v,priorities:w,labels:g}},[c]),p=()=>{o?.(e.id);};return jsxs("div",{className:u("card-stack",!e.isExpanded&&"card-stack-collapsed",d),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:l.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"]})]}),m&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:f=>{f.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:[l.uniqueAssignees," assignees"]})]}),l.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:[l.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:c.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:c.map(f=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(f),children:a(f)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(f),children:[jsx("h4",{children:f.title}),f.description&&jsxs("p",{children:[f.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),s?.(e.id,f.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"})]})})]},f.id))})})]})}var Dp={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Fn(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 An(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 Sp(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 Ep({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:d}){let m=useMemo(()=>({...Dp,...n}),[n]),[i,c]=useState(new Set),l=useRef(null),p=useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(b=>{let x=b.timestamp.toISOString().split("T")[0],N=h.get(x);N?N.push(b):h.set(x,[b]);}),Array.from(h.entries()).sort((b,x)=>x[0].localeCompare(b[0])).map(([b,x])=>({date:new Date(b),events:x.sort((N,D)=>D.timestamp.getTime()-N.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:f,uniqueTypes:v}=useMemo(()=>{let h=new Set,b=new Set;return e.forEach(x=>{h.add(x.userId),b.add(x.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(b)}},[e]),w=h=>{c(b=>{let x=new Set(b);return x.has(h)?x.delete(h):x.add(h),x});},g=h=>{let x=new Date().getTime()-h.getTime(),N=Math.floor(x/6e4),D=Math.floor(x/36e5),T=Math.floor(x/864e5);return N<1?"just now":N<60?`${N}m ago`:D<24?`${D}h ago`:T<7?`${T}d ago`:h.toLocaleDateString()},y=useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return useEffect(()=>{if(s&&l.current){let h=l.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:u("history-timeline-empty",d),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",m.compact&&"compact",d),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let b=h.target.value;a({...t,types:b?[b]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),v.map(h=>jsxs("option",{value:h,children:[An(h)," ",h.replace("_"," ")]},h))]}),f.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let b=h.target.value;a({...t,users:b?[b]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),f.map(h=>jsx("option",{value:h,children:h},h))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),y>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",y,")"]})]}),jsx("div",{className:"history-timeline-container",ref:l,children:p.map(h=>jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&h.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:h.events.map((b,x)=>{let N=i.has(b.id),D=s===b.id,T=Sp(b.type);return jsxs("div",{"data-event-id":b.id,className:u("history-timeline-event",N&&"expanded",D&&"selected"),onClick:()=>o?.(b),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:T},children:m.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:An(b.type)})}),x<h.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:T}})]}),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:[m.showAvatars&&b.userAvatar&&jsx("img",{src:b.userAvatar,alt:b.userName||b.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:b.userName||b.userId}),jsx("span",{className:"history-timeline-event-action",children:Fn(b)})]})]}),jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?g(b.timestamp):b.timestamp.toLocaleString()})]}),Object.keys(b.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),w(b.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(b.changes).map(([k,R])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(R.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(R.to)})]})]},k)),b.metadata&&Object.keys(b.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(b.metadata).map(([k,R])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(R)})]},k))]})]})]})]},b.id)})})]},h.date?.toISOString()||"all"))})]})}function Mp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:d,onSpeedChange:m,className:i}){let c=[.5,1,1.5,2,3],l=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:l&&An(l.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:l&&Fn(l)}),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:l&&l.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:f=>d(parseInt(f.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((f,v)=>jsx("div",{className:u("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>d(v),title:Fn(f)},f.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:c.map(f=>jsxs("button",{className:u("history-replay-speed-btn",e.speed===f&&"active"),onClick:()=>m(f),children:[f,"x"]},f))})]}),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:l&&l.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(f=>jsx("span",{className:"history-replay-card-preview-label-tag",children:f},f))})]})]})]})]}):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 ad(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 rd(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 Fp(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 Ap(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Zx(e,t,a,r,o,s=100){let n=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),d=new Map(n.map(m=>[m.id,m]));for(let m=0;m<s;m++){let i=1-m/s;n.forEach(c=>{let l=a/2,p=r/2;c.vx+=(l-c.x)*o.centerForce*i,c.vy+=(p-c.y)*o.centerForce*i,n.forEach(f=>{if(c.id===f.id)return;let v=c.x-f.x,w=c.y-f.y,g=Math.sqrt(v*v+w*w)||1,y=o.chargeStrength*i/(g*g);c.vx+=v/g*y,c.vy+=w/g*y;});}),t.forEach(c=>{let l=d.get(typeof c.source=="string"?c.source:c.source.id),p=d.get(typeof c.target=="string"?c.target:c.target.id);if(!l||!p)return;let f=p.x-l.x,v=p.y-l.y,w=Math.sqrt(f*f+v*v)||1,g=(w-o.linkDistance)/w*o.forceStrength*i;l.vx+=f*g,l.vy+=v*g,p.vx-=f*g,p.vy-=v*g;}),n.forEach(c=>{c.fx!==null&&c.fx!==void 0?(c.x=c.fx,c.vx=0):c.x+=c.vx,c.fy!==null&&c.fy!==void 0?(c.y=c.fy,c.vy=0):c.y+=c.vy,c.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,c.x)),c.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,c.y)),c.vx*=.9,c.vy*=.9;});}return n}function Lp({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:d,className:m}){let i=useRef(null),[c,l]=useState([]),[p,f]=useState(null),[v,w]=useState(null),[g,y]=useState(null),[h,b]=useState(1),[x,N]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let B=Zx(e,t,a.width,a.height,a,150);l(B);},[e,t,a]);let D=useCallback((B,Q)=>{a.enableDragging&&(Q.stopPropagation(),f(B));},[a.enableDragging]),T=useCallback(B=>{if(!p||!i.current)return;let S=i.current.getBoundingClientRect(),_=(B.clientX-S.left-x.x)/h,oe=(B.clientY-S.top-x.y)/h;l(Te=>Te.map(A=>A.id===p?{...A,x:_,y:oe,fx:_,fy:oe}:A));},[p,h,x]),k=useCallback(()=>{f(null);},[]),R=useCallback((B,Q)=>{Q.stopPropagation(),d?.({type:"node-click",node:B,position:{x:Q.clientX,y:Q.clientY}});},[d]),I=useCallback((B,Q)=>{Q.stopPropagation(),d?.({type:"edge-click",edge:B,position:{x:Q.clientX,y:Q.clientY}});},[d]),C=useCallback(B=>{let Q=c.find(S=>S.id===B);return Q?{x:Q.x,y:Q.y}:{x:0,y:0}},[c]),W=useCallback(B=>{if(B.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return B.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let Q=B.card.priority;return Q==="URGENT"?"#ef4444":Q==="HIGH"?"#f59e0b":Q==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return B.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:u("relationships-graph-empty",m),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",m),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:()=>b(B=>Math.min(B+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>b(B=>Math.max(B-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{b(1),N({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(B=>B.type))).map(B=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:ad(B)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Fp(B)," ",rd(B)]})]},B))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:T,onMouseUp:k,onMouseLeave:k,children:[jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${h})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(B=>{let Q=C(typeof B.source=="string"?B.source:B.source.id),S=C(typeof B.target=="string"?B.target:B.target.id),_=Ap(B.type),oe=g===B.id,Te=B.onCriticalPath;return jsxs("g",{className:u("relationships-graph-edge",oe&&"hovered",Te&&"critical"),onMouseEnter:()=>y(B.id),onMouseLeave:()=>y(null),onClick:A=>I(B,A),children:[jsx("line",{x1:Q.x,y1:Q.y,x2:S.x,y2:S.y,stroke:ad(B.type),strokeWidth:Te?a.edgeWidth*2:a.edgeWidth,strokeOpacity:oe?1:.6,markerEnd:_?"url(#arrowhead)":void 0}),a.showEdgeLabels&&oe&&jsx("text",{x:(Q.x+S.x)/2,y:(Q.y+S.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:rd(B.type)})]},B.id)})}),jsx("g",{className:"relationships-graph-nodes",children:c.map(B=>{let Q=v===B.id,S=B.onCriticalPath;return jsxs("g",{className:u("relationships-graph-node",Q&&"hovered",S&&"critical"),transform:`translate(${B.x}, ${B.y})`,onMouseDown:_=>D(B.id,_),onMouseEnter:()=>w(B.id),onMouseLeave:()=>w(null),onClick:_=>R(B,_),children:[jsx("circle",{r:S?a.nodeSize*1.2:a.nodeSize,fill:W(B),stroke:S?"#fbbf24":"#ffffff",strokeWidth:S?3:2,opacity:Q?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:B.card.title.length>20?B.card.title.substring(0,20)+"...":B.card.title})]},B.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 Rp({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[d,m]=useState(false),[i,c]=useState(null),[l,p]=useState(null),f=useRef(null),v=d||o;useEffect(()=>{e&&f.current&&f.current.focus();},[e]),useEffect(()=>{let h=b=>{b.key==="Escape"&&!v&&w();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,v]);let w=()=>{v||(n(""),c(null),p(null),t());},g=async()=>{if(!(!s.trim()||v)){m(true),c(null),p(null);try{let h=await r(s.trim());p(h);}catch(h){c(h instanceof Error?h.message:"Failed to generate plan");}finally{m(false);}}},y=()=>{l&&(a(l),w());};return e?jsxs(gt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:w}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-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:w,disabled:v,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:l?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!"})]}),l.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:l.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((h,b)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},b))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((h,b)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},b)),l.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.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:f,value:s,onChange:h=>n(h.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:v}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,b)=>jsx("button",{onClick:()=>n(h),disabled:v,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},b))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:v&&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:w,disabled:v,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"}),l?jsx("button",{onClick:y,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:g,disabled:!s.trim()||v,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:v?"Generating...":"Generate Plan"})]})]})]})})]}):null}var od={"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 e2={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},t2={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 a2(e,t,a){let r=od[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function Ln(e){return `$${e.toFixed(4)}`}var nd=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=a2(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(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,p)=>l+p.cost,0),s=a.reduce((l,p)=>l+p.inputTokens,0),n=a.reduce((l,p)=>l+p.outputTokens,0),d=a.filter(l=>l.success),m=a.reduce((l,p)=>l+p.duration,0),i={},c={};return a.forEach(l=>{i[l.feature]=(i[l.feature]||0)+1,c[l.feature]=(c[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:c,averageDuration:r>0?m/r:0,successRate:r>0?d.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 d=this.operations.filter(c=>c.timestamp>=n).length,m=Math.max(0,o-d),i=d/o*100;return {used:d,limit:o,remaining:m,percentUsed:i,isExceeded:d>=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)}},No=new nd;function zp({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(No.getStats()),[s,n]=useState(No.checkLimit(a));if(useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(No.getStats()),n(No.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),useEffect(()=>{let m=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let d=No.getRecentOperations(5);return jsxs(gt,{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:m=>m.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[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:Ln(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(([m,i])=>{let c=r.costsByFeature[m]||0,l=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:m.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:Ln(c)})]})]}),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:`${l}%`}})})]},m)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),d.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:d.map(m=>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:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Ln(m.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.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 Wp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,d]=useState(""),[m,i]=useState(""),[c,l]=useState(""),[p,f]=useState(false),[v,w]=useState(null),[g,y]=useState(null),[h,b]=useState(null),x=useRef(null),N=p||o;useEffect(()=>{e&&x.current&&x.current.focus();},[e]),useEffect(()=>{let I=C=>{C.key==="Escape"&&!N&&D();};if(e)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[e,N]);let D=()=>{N||(d(""),i(""),l(""),w(null),y(null),b(null),t());},T=async()=>{if(!(!n.trim()||N)){f(true),w(null),y(null),b(null);try{let I=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:c||void 0});y(I.tasks.tasks),b({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){w(I instanceof Error?I.message:"Failed to generate tasks");}finally{f(false);}}},k=()=>{g&&(a(g),D());};if(!e)return null;let R=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxs(gt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:D}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick: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:D,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:g?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",R,"% similar)"]}):jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[h?.tokens_used||0," tokens"]}),h?.tokens_saved&&jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[h.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[g.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:g.map((I,C)=>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:["#",C+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:x,value:n,onChange:I=>d(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:m,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: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})]})]}),v&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:v}),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,C)=>jsx("button",{onClick:()=>d(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},C))})]})]})}),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:D,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),g?jsx("button",{onClick:k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:T,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, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function qs({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(g=>{t&&Wn(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(y,h,b)=>{console.warn(`Retry attempt ${h} after ${b}ms: ${y.message}`);}}).then(y=>{y.success||console.error(`Failed to persist board after ${y.attempts} attempts:`,y.error);});},[t]),s=useCallback(async(g,y,h)=>{r(b=>{let x=b.cards.find(I=>I.id===g);if(!x)return b;let N=x.columnId,D={...x,columnId:y,position:h},T=b.cards.map(I=>I.id===g?D:I),k=b.columns.map(I=>{if(I.id===N)return {...I,cardIds:I.cardIds.filter(C=>C!==g)};if(I.id===y){let C=T.filter(W=>W.columnId===y).sort((W,B)=>W.position-B.position);return {...I,cardIds:C.map(W=>W.id)}}return I}),R={...b,cards:T,columns:k};return o(R),R});},[o]),n=useCallback(async(g,y)=>{r(h=>{let b=h.cards.map(N=>N.id===g?{...N,...y}:N),x={...h,cards:b};return o(x),x});},[o]),d=useCallback(async g=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let b={...g,id:y},x=h.columns.map(D=>D.id===g.columnId?{...D,cardIds:[...D.cardIds,y]}:D),N={...h,cards:[...h.cards,b],columns:x};return o(N),N});},[o]),m=useCallback(async g=>{r(y=>{let h=y.cards.find(D=>D.id===g);if(!h)return y;let b=y.cards.filter(D=>D.id!==g),x=y.columns.map(D=>D.id===h.columnId?{...D,cardIds:D.cardIds.filter(T=>T!==g)}:D),N={...y,cards:b,columns:x};return o(N),N});},[o]),i=useCallback(async g=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let b={...g,id:y,cardIds:[]},x={...h,columns:[...h.columns,b]};return o(x),x});},[o]),c=useCallback(async(g,y)=>{r(h=>{let b=h.columns.map(N=>N.id===g?{...N,...y}:N),x={...h,columns:b};return o(x),x});},[o]),l=useCallback(async g=>{r(y=>{let h=y.cards.filter(N=>N.columnId!==g),b=y.columns.filter(N=>N.id!==g),x={...y,cards:h,columns:b};return o(x),x});},[o]),p=useCallback(g=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return d(g),y},[d]),f=useCallback(g=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(g),y},[i]),v=useCallback(()=>{r(g=>{let y={...g,cards:[],columns:[]};return o(y),y});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:d,onCardDelete:m,onColumnCreate:i,onColumnUpdate:c,onColumnDelete:l},setBoard:r,helpers:{addCard:p,addColumn:f,deleteCard:m,deleteColumn:l,clearBoard:v}}}function Vp({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=qs({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(m,i,c={})=>{s.addCard({title:i,columnId:m,position:r.cards.filter(l=>l.columnId===m).length,...c});},addColumn:(m,i)=>{let c=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:m,position:i??c+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 In={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},jp={by:"none",order:"asc"};function Kp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...In,...e}),[s,n]=useState({...jp,...t}),d=useCallback(w=>{o(g=>({...g,...w}));},[]),m=useCallback(w=>{n(g=>({...g,...w}));},[]),i=useCallback(()=>{o(In),n(jp);},[]),c=useCallback(()=>{a&&o({...In,assignees:[a]});},[a]),l=useCallback(()=>{o({...In,dateFilter:"overdue"});},[]),p=useCallback(()=>{o({...In,priorities:["HIGH","URGENT"]});},[]),f=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]),v=useCallback(w=>{let g=[...w];if(r.search){let y=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(y)||h.description?.toLowerCase().includes(y));}if(r.dateFilter!=="all"){let y=new Date,h=y.getFullYear(),b=String(y.getMonth()+1).padStart(2,"0"),x=String(y.getDate()).padStart(2,"0"),N=`${h}-${b}-${x}`;g=g.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let T=D.endDate||D.dueDate;if(!T)return false;let k;if(typeof T=="string")k=T.split("T")[0]||T;else {let R=T.getUTCFullYear(),I=String(T.getUTCMonth()+1).padStart(2,"0"),C=String(T.getUTCDate()).padStart(2,"0");k=`${R}-${I}-${C}`;}switch(r.dateFilter){case "overdue":return k<N;case "today":return k===N;case "this-week":let R=new Date(N+"T00:00:00"),I=new Date(k+"T00:00:00"),C=new Date(R);return C.setDate(C.getDate()+7),I>=R&&I<=C;case "custom":if(r.dateRange){let W=typeof T=="string"?new Date(T):T;return W>=r.dateRange.start&&W<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(y=>y.priority&&r.priorities.includes(y.priority))),r.assignees.length>0&&(g=g.filter(y=>(y.assignedUserIds||(y.assigneeId?[y.assigneeId]:[])).some(b=>r.assignees.includes(b)))),r.labels.length>0&&(g=g.filter(y=>y.labels&&y.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(y=>r.columns.includes(y.columnId))),s.by!=="none"&&g.sort((y,h)=>{let b=0;switch(s.by){case "created":let x=y.createdAt?new Date(y.createdAt).getTime():0,N=h.createdAt?new Date(h.createdAt).getTime():0;b=x-N;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},T=D[y.priority||"LOW"],k=D[h.priority||"LOW"];b=T-k;break;case "dueDate":let R=y.endDate||y.dueDate,I=h.endDate||h.dueDate;if(!R)return 1;if(!I)return -1;let C=typeof R=="string"?new Date(R).getTime():R.getTime(),W=typeof I=="string"?new Date(I).getTime():I.getTime();b=C-W;break;case "title":b=y.title.localeCompare(h.title);break;case "estimate":let B=y.estimatedTime||0,Q=h.estimatedTime||0;b=B-Q;break;default:b=0;}return s.order==="asc"?b:-b}),g},[r,s]);return {filters:r,sort:s,setFilters:d,setSort:m,resetFilters:i,filterMyTasks:c,filterOverdue:l,filterHighPriority:p,applyFilters:v,hasActiveFilters:f}}var Yp,Xp;if(typeof window<"u")try{let e=zn("ai");Yp=e.generateObject,Xp=e.generateText;}catch{}function Jp(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(Yp&&Xp&&e.apiKey),n=useCallback(async l=>{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:",l),{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: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let f=p instanceof Error?p:new Error("Failed to generate plan");throw o(f),f}finally{a(false);}},[s]),d=useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let f=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(f),f}finally{a(false);}},[s]),m=useCallback(async l=>{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 f=p instanceof Error?p:new Error("Failed to predict risks");throw o(f),f}finally{a(false);}},[s]),i=useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(p){let f=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(f),f}finally{a(false);}},[s]),c=useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(p){let f=p instanceof Error?p:new Error("Failed to estimate effort");throw o(f),f}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:d,onPredictRisks:m,onGenerateSubtasks:i,onEstimateEffort:c,isAvailable:s,isLoading:t,error:r}}function id(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function Zp(e){let{cards:t}=e,[a,r]=id(),o=useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=useCallback((l,p)=>{if(!p){r({selectedCardIds:[l],lastSelectedCardId:l});return}let f=p.ctrlKey||p.metaKey,v=p.shiftKey;if(f)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(w=>w!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(v&&a.lastSelectedCardId){let w=t.find(y=>y.id===l),g=t.find(y=>y.id===a.lastSelectedCardId);if(w&&g&&w.columnId===g.columnId){let y=t.filter(k=>k.columnId===w.columnId).sort((k,R)=>k.position-R.position),h=y.findIndex(k=>k.id===a.lastSelectedCardId),b=y.findIndex(k=>k.id===l),[x,N]=h<b?[h,b]:[b,h],D=y.slice(x,N+1).map(k=>k.id),T=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:T,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),n=useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),d=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(l=>{a.selectedCardIds.includes(l)?n(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,n,r]),c=useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:d,selectAll:m,toggleCard:i,getSelectedCards:c}}var Qp={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function eg(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...Qp,...a}),[a]),[s,n]=useState([]),d=useCallback((w,g,y,h,b)=>{if(g.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:w,cardIds:g,columnId:y,strategy:h,color:b,isExpanded:true,position:s.filter(N=>N.columnId===y).length,createdAt:new Date};n(N=>[...N,x]);},[o.minCardsPerStack,s]),m=useCallback(w=>{n(g=>g.filter(y=>y.id!==w));},[]),i=useCallback(w=>{n(g=>g.map(y=>y.id===w?{...y,isExpanded:!y.isExpanded}:y));},[]),c=useCallback((w,g)=>{n(y=>y.map(h=>h.id===w&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),l=useCallback((w,g)=>{n(y=>y.map(h=>{if(h.id===w){let b=h.cardIds.filter(x=>x!==g);return b.length<o.minCardsPerStack?null:{...h,cardIds:b}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),p=useCallback(w=>s.filter(g=>g.columnId===w).sort((g,y)=>g.position-y.position),[s]),f=useCallback(async w=>{let g=t.filter(N=>N.columnId===w);if(g.length<o.minCardsPerStack*2)return [];let y=[],h=new Map;g.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(D=>{h.has(D)||h.set(D,[]),h.get(D).push(N);});}),h.forEach((N,D)=>{N.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:N.map(T=>T.id),columnId:w,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${D}"`,confidence:.85});});let b=new Map;g.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(D=>{b.has(D)||b.set(D,[]),b.get(D).push(N);});}),b.forEach((N,D)=>{N.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:N.map(T=>T.id),columnId:w,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(g.forEach(N=>{N.priority&&(x.has(N.priority)||x.set(N.priority,[]),x.get(N.priority).push(N));}),x.forEach((N,D)=>{if(N.length>=o.minCardsPerStack){let T={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";y.push({stack:{title:`${T} ${D} Priority`,cardIds:N.map(k=>k.id),columnId:w,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${D} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of g){let T=(await r.findSimilar(N,g)).filter(k=>k.similarity>=o.autoStackConfidenceThreshold);if(T.length>=o.minCardsPerStack-1){let k=[N.id,...T.map(I=>I.card.id)],R=T.reduce((I,C)=>I+C.similarity,0)/T.length;y.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:k,columnId:w,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${T.length+1} similar tasks`,confidence:R});}}return y.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,D)=>D.confidence-N.confidence).slice(0,5)},[t,o,r]),v=useCallback(w=>{d(w.stack.title,w.stack.cardIds,w.stack.columnId,w.stack.strategy,w.stack.color);},[d]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let y=await f(g),h=y[0];y.length>0&&h&&h.confidence>=.9&&v(h);});},[]),{stacks:s,createStack:d,deleteStack:m,toggleStack:i,addToStack:c,removeFromStack:l,getStacksForColumn:p,getSuggestions:f,applySuggestion:v,config:o}}var tg=createContext(null);function ag({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(m=>{let{Column:i}=zn("@libxai/core");s.set(m.id,new i(m));}),t?.cards?.forEach(m=>{let{Card:i}=zn("@libxai/core");n.set(m.id,new i(m));});let d=null;if(t?.board){let{Board:m}=zn("@libxai/core");d=new m(t.board);}r.current=new BoardStore({board:d,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(tg.Provider,{value:{store:o},children:e})}function Ys(){let e=useContext(tg);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Rn(){let e=Ys(),[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 d=useCallback(h=>{e.updateBoard(h);},[e]),m=useCallback(h=>{e.addColumn(h);},[e]),i=useCallback((h,b)=>{e.updateColumn(h,b);},[e]),c=useCallback(h=>{e.deleteColumn(h);},[e]),l=useCallback(h=>e.getColumn(h),[e]),p=useCallback(h=>{e.addCard(h);},[e]),f=useCallback((h,b)=>{e.updateCard(h,b);},[e]),v=useCallback(h=>{e.deleteCard(h);},[e]),w=useCallback((h,b,x)=>{e.moveCard(h,b,x);},[e]),g=useCallback(h=>e.getCard(h),[e]),y=useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:d,addColumn:m,updateColumn:i,deleteColumn:c,getColumn:l,addCard:p,updateCard:f,deleteCard:v,moveCard:w,getCard:g,getCardsByColumn:y}}function og(e){let{cards:t}=Rn();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 ng(e="position",t="asc"){let{cards:a}=Rn();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let d={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?d[o.priority]:0,i=s.priority?d[s.priority]:0;n=m-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 Xs=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Ud.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 d=await Promise.resolve(n.apply(s,a));d!==void 0&&(o=d,a[0]=d);}catch(d){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,d,{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);}},v2=new Xs;function ig({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:d=0,getItemKey:m}){let i=useRef(null),c=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:d}),l=c.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},f=n?{width:`${c.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${c.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:p,className:o,children:jsx("div",{style:f,children:l.map(v=>{let w=e[v.index];if(!w)return null;let g=m?m(w,v.index):v.index,y={position:"absolute",top:n?0:v.start,left:n?v.start:0,width:n?v.size:"100%",height:n?"100%":v.size};return jsx("div",{style:y,"data-index":v.index,children:r(w,v.index)},g)})})})}function lg(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 cg({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:d=16,getItemKey:m,horizontal:i=true}){let c=useRef(null),l=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:d}),p=l.getVirtualItems(),f={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},v={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:c,style:f,className:s,children:jsx("div",{style:v,children:p.map(w=>{let g=e[w.index];if(!g)return null;let y=m?m(g,w.index):w.index,h={position:"absolute",top:0,left:w.start,width:w.size,height:"100%"};return jsx("div",{style:h,"data-index":w.index,children:o(g,w.index)},y)})})})}function mg(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 ug(e,t=10){return e>t}var md={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},ud={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},pd={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},gd={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},fd={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},hd={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},bd={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},yd={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)"},vd={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)"},xd={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},kd={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}},wd={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}},Js={spacing:md,borderRadius:ud,fontSize:pd,fontWeight:gd,lineHeight:fd,zIndex:hd,duration:bd,easing:yd,shadows:vd,opacity:xd,kanban:kd,gantt:wd};function pg(e,t,a){return e[t]??a}function Cd(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)?Cd(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function w2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Td(e="asakaa"){let t=Cd(Js),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=w2(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
404
404
|
${a.join(`
|
|
405
405
|
`)}
|
|
406
|
-
}`}function
|
|
406
|
+
}`}function On(e,t="asakaa"){let a=[],r=Cd(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
|
|
407
407
|
${a.join(`
|
|
408
408
|
`)}
|
|
409
|
-
}`}var Zs={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"}},Nd={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"}},Dd={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 Sd(e=Zs,t="asakaa"){let a=Td(t),r=
|
|
409
|
+
}`}var Zs={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"}},Nd={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"}},Dd={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 Sd(e=Zs,t="asakaa"){let a=Td(t),r=On(e,t);return `${a}
|
|
410
410
|
|
|
411
411
|
${r}`}function gg(){return `/**
|
|
412
412
|
* ASAKAA Design Tokens
|
|
@@ -418,17 +418,17 @@ ${Sd(Zs)}
|
|
|
418
418
|
|
|
419
419
|
/* Light theme */
|
|
420
420
|
[data-theme="light"] {
|
|
421
|
-
${
|
|
421
|
+
${On(Nd,"asakaa").split(`
|
|
422
422
|
`).slice(1,-1).join(`
|
|
423
423
|
`)}
|
|
424
424
|
}
|
|
425
425
|
|
|
426
426
|
/* Neutral theme */
|
|
427
427
|
[data-theme="neutral"] {
|
|
428
|
-
${
|
|
428
|
+
${On(Dd,"asakaa").split(`
|
|
429
429
|
`).slice(1,-1).join(`
|
|
430
430
|
`)}
|
|
431
431
|
}
|
|
432
|
-
`}var
|
|
433
|
-
export{zp as AIUsageDashboard,
|
|
432
|
+
`}var C2=({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 fg({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=Go();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,d])=>{let m=n,i=m===r;return jsxs("button",{onClick:()=>o(m),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${d.displayName} theme`,"aria-pressed":i,title:d.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(C2,{theme:m})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:d.displayName})]},m)})})}
|
|
433
|
+
export{zp as AIUsageDashboard,t2 as AI_FEATURES,od as AI_MODELS,Fi as AddCardButton,Mi as AddColumnButton,Er as AttachmentUploader,ag as BoardProvider,ds as BulkOperationsToolbar,Gi as BurnDownChart,up as CUSTOM_FIELD_TYPES,Cp as CalendarBoard,Ar as Card,Oi as CardDetailModal,Ui as CardDetailModalV2,Mp as CardHistoryReplay,Ep as CardHistoryTimeline,Lp as CardRelationshipsGraph,jx as CardStack,Xi as CardTemplateSelector,li as CircuitBreaker,Bo as Column,hs as ColumnManager,Ii as CommandPalette,el as ConfigMenu,jo as ContextMenu,bn as DEFAULT_SHORTCUTS,cp as DEFAULT_TABLE_COLUMNS,Yi as DEFAULT_TEMPLATES,rn as DateRangePicker,nn as DependenciesSelector,Cs as DependencyLine,Vi as DistributionCharts,hi as EditableColumnTitle,zo as ErrorBoundary,Zi as ExportImportModal,Qi as FilterBar,ru as GANTT_AI_SYSTEM_PROMPT,Es as GanttAIAssistant,Zm as GanttBoard,_o as GanttI18nContext,Ns as GanttMilestone,fs as GanttToolbar,Wp as GenerateGanttTasksDialog,Rp as GeneratePlanModal,Ki as GroupBySelector,Ci as HealthBar,Kr as KanbanBoard,Ei as KanbanToolbar,gn as KanbanViewAdapter,qi as KeyboardShortcutsHelp,dp as ListView,At as MenuIcons,Xs as PluginManager,co as PrioritySelector,Ti as ProfitabilityReport,e2 as RATE_LIMITS,mp as STANDARD_FIELDS,_i as SwimlaneBoardView,yi as TagBadge,wc as TagList,_r as TagPicker,ks as TaskBar,Ir as TaskDetailModal,au as TaskFormModal,vs as TaskGrid,ol as ThemeModal,bm as ThemeProvider,fg as ThemeSwitcher,fo as TimeInputPopover,vi as TimePill,xi as TimePopover,Ss as Timeline,uo as UserAssignmentSelector,Wi as VelocityChart,cg as VirtualGrid,ig as VirtualList,No as aiUsageTracker,ud as borderRadius,Hn as calculatePosition,Ql as calendarDarkTheme,Yl as calendarEnTranslations,Xl as calendarEsTranslations,ed as calendarLightTheme,td as calendarNeutralTheme,_s as calendarThemes,Gs as calendarTranslations,Fs as cardToGanttTask,cu as cardsToGanttTasks,u as cn,Xc as createKanbanView,Ug as createRetryWrapper,tl as darkTheme,Zs as darkTokenTheme,ms as defaultTheme,Js as designTokens,bd as duration,yd as easing,gg as exportTokensToCSS,Ur as findTaskByName,pd as fontSize,gd as fontWeight,Ln as formatCost,ps as ganttEnTranslations,vm as ganttEsTranslations,du as ganttTaskToCardUpdate,tt as ganttThemes,wd as ganttTokens,nl as ganttTranslations,xe as ganttUtils,Td as generateCSSVariables,Sd as generateCompleteCSS,Rg as generateInitialPositions,ou as generateTasksContext,On as generateThemeVariables,Tp as getCalendarTheme,Pn as getCalendarTranslations,pp as getListViewTheme,Al as getListViewTranslations,gp as getMonthNames,pg as getToken,xm as getTranslations,fp as getWeekdayNames,kd as kanbanTokens,al as lightTheme,Nd as lightTokenTheme,fd as lineHeight,jl as listViewDarkTheme,Ml as listViewEnTranslations,Fl as listViewEsTranslations,Kl as listViewLightTheme,ql as listViewNeutralTheme,Ws as listViewThemes,As as listViewTranslations,Vs as mergeCalendarTranslations,Ls as mergeListViewTranslations,sl as mergeTranslations,rl as neutralTheme,Dd as neutralTokenTheme,xd as opacity,iu as parseLocalCommand,Sl as parseNaturalDate,El as parseNaturalDuration,Pl as parseProgress,su as parseStatus,v2 as pluginManager,zg as retrySyncOperation,Wn as retryWithBackoff,vd as shadows,ug as shouldVirtualizeGrid,md as spacing,yo as themes,Jp as useAI,Vp as useBoard,Rn as useBoardCore,Ys as useBoardStore,eg as useCardStacking,Di as useDragState,og as useFilteredCards,Kp as useFilters,Zr as useGanttI18n,qs as useKanbanState,gm as useKeyboardShortcuts,Zp as useMultiSelect,id as useSelectionState,ng as useSortedCards,Go as useTheme,mg as useVirtualGrid,lg as useVirtualList,lu as validateAIResponse,Ai as withErrorBoundary,Vn as wouldCreateCircularDependency,hd as zIndex};//# sourceMappingURL=index.js.map
|
|
434
434
|
//# sourceMappingURL=index.js.map
|