@libxai/board 1.9.10 → 1.9.12

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.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 Qf from'html2canvas';import {createPortal}from'react-dom';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {AnimatePresence,motion}from'framer-motion';import {CheckCircle2,PlayCircle,Circle,Copy,Scissors,Settings,Eye,EyeOff,ArrowDown,ArrowUp,ArrowUpDown,BarChart3,Link2,Minus,Plus,Trash2,Pencil,Edit3,AlertTriangle,CheckSquare,ChevronDown,Calendar,Hash,Type,BarChart,Users,CalendarClock,FileText,Timer,Clock,Tag,CalendarCheck,Flag,CircleDot,Moon,Sun,Palette,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,File,User,Check,CalendarDays,X,Hourglass,Play,Square,Diamond,Upload,MessageSquare,Layers,Filter,Zap,GitBranch,FileImage,FileSpreadsheet,FolderKanban,Share2,Download,ChevronLeft,GripVertical,Smile,Paperclip,Send,FileJson,AlertCircle,Milestone,List,Search,PanelRight,FolderOpen,Folder,Info,Target,DollarSign,Loader2}from'lucide-react';import {Command}from'cmdk';import yy from'react-markdown';import xy from'remark-gfm';import vy from'rehype-sanitize';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart as BarChart$1,Bar}from'recharts';import {toPng}from'html-to-image';var ci=(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 ui=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 [ui.Translate.toString(e),ui.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function c(...e){return twMerge(clsx(e))}function pi(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 Kf(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function $l(e,t){return e.length===0?1e3:t===0?pi(null,e[0].position):t>=e.length?pi(e[e.length-1].position,null):pi(e[t-1].position,e[t].position)}function Nu(e,t=100){return e>t}var qf=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 Yf(e,t,a,r){let n=t*Math.pow(a,e-1),s=n*.2*Math.random();return Math.min(n+s,r)}async function mi(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:n=2,maxDelay:s=1e4,shouldRetry:o=qf,onRetry:l}=t,d,i=0;for(let u=1;u<=a;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(m){if(d=m,u===a||!o(d,u))return {error:d,attempts:i,success:false};let g=Yf(u,r,n,s);if(l)try{l(d,u,g);}catch(f){console.error("Error in retry callback:",f);}await new Promise(f=>setTimeout(f,g));}}return {error:d||new Error("Unknown error"),attempts:i,success:false}}function Xf(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(n){if(a=n,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function Jf(e,t={}){return async(...a)=>mi(()=>e(...a),t)}var Hl=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 Du=(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))(Du||{}),cn=class cn{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:n,component:s,...o}=t,l=`[${a}] [${r}] [${s}]`,d=Object.keys(o).length>0;switch(r){case "DEBUG":console.debug(l,n,d?o:"");break;case "INFO":console.info(l,n,d?o:"");break;case "WARN":console.warn(l,n,d?o:"");break;case "ERROR":console.error(l,n,d?o:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...cn.globalOptions};}static configure(t){cn.globalOptions={...cn.globalOptions,...t};}child(t){return new cn({...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 gi((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new gi(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let n={timestamp:new Date().toISOString(),level:Du[t],message:a,component:this.options.componentName,...r};this.options.onLog(n);}};cn.globalOptions={};var zl=cn,gi=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}},Su=new zl;function Zf(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 eb(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let o=e.columns.find(l=>l.id===s.columnId);return [s.id,Ul(s.title),Ul(s.description||""),Ul(o?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
2
- `)}async function tb(e,t,a){let r=t;if(!r){let o=document.querySelector(".asakaa-board");o&&(r=o.parentElement||o);}if(r)try{let o=await Qf(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=o.toDataURL("image/png"),d=297,i=210,u=o.width/o.height,m=d-20,p=m/u;p>i-20&&(p=i-20,m=p*u);let g=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});g.setFontSize(16),g.setTextColor(255,255,255),g.setFillColor(10,10,10),g.rect(0,0,d,15,"F"),g.text(e.title||"Kanban Board",10,10);let f=(d-m)/2;return g.addImage(l,"PNG",f,20,m,p),g}catch(o){console.error("Error capturing board:",o);}let n=new jsPDF,s=20;return n.setFontSize(20),n.text(e.title||"Kanban Board",20,s),s+=10,n.setFontSize(10),n.setTextColor(128,128,128),n.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,n.setTextColor(0,0,0),e.columns.forEach(o=>{let l=e.cards.filter(d=>d.columnId===o.id);s>250&&(n.addPage(),s=20),n.setFontSize(16),n.setFont("helvetica","bold"),n.text(o.title,20,s),s+=8,l.length===0?(n.setFontSize(10),n.setFont("helvetica","italic"),n.setTextColor(128,128,128),n.text("No cards in this column",20,s),n.setTextColor(0,0,0),s+=10):l.forEach(d=>{if(s>260&&(n.addPage(),s=20),n.setFontSize(12),n.setFont("helvetica","bold"),n.text(d.title,25,s),s+=6,d.description){n.setFontSize(9),n.setFont("helvetica","normal");let u=n.splitTextToSize(d.description,160);n.text(u,25,s),s+=u.length*5;}let i=[];if(d.priority&&i.push(`Priority: ${d.priority}`),d.labels&&d.labels.length>0&&i.push(`Labels: ${d.labels.join(", ")}`),d.assignedUserIds&&d.assignedUserIds.length>0&&i.push(`Assigned: ${d.assignedUserIds.length} user(s)`),d.startDate||d.endDate){let u=[];d.startDate&&u.push(`Start: ${d.startDate}`),d.endDate&&u.push(`End: ${d.endDate}`),i.push(u.join(" \u2192 "));}i.length>0&&(n.setFontSize(8),n.setTextColor(100,100,100),n.text(i.join(" \u2022 "),25,s),n.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),n}function Ul(e){return e.includes(",")||e.includes('"')||e.includes(`
3
- `)?`"${e.replace(/"/g,'""')}"`:e}async function Mu(e,t,a,r){switch(t){case "json":return Zf(e,r);case "csv":return eb(e);case "pdf":return await tb(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Pu(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${r}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,o={json:"application/json",csv:"text/csv",pdf:"application/pdf"},l=new Blob([e],{type:o[t]}),d=URL.createObjectURL(l),i=document.createElement("a");i.href=d,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(d);}function ab(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 rb(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=Fu(t[0]),r=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let l=Fu(t[o]||"");if(l.length>a.length){s.push(`Line ${o+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${o+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((g,f)=>{i[g]=l[f]||"";});let u=i.Column||"Unnamed";n.has(u)||n.set(u,{id:`col-${n.size+1}`,title:u,position:n.size+1,cardIds:[]});let m=n.get(u),p={id:i["Card ID"]||`card-${o}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:m.id,position:m.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),m.cardIds.push(p.id);}catch(l){s.push(`Line ${o+1}: ${l instanceof Error?l.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:n.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Fu(e){let t=[],a="",r=false;for(let n=0;n<e.length;n++){let s=e[n],o=e[n+1];s==='"'&&r&&o==='"'?(a+='"',n++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Au(e,t){switch(t){case "json":return ab(e);case "csv":return rb(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Lu(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=n=>{n.target?.result?t(n.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var Wl=createContext(null);function Iu(){return useContext(Wl)}var Bu=createContext(null);function Ru({children:e,themeName:t}){return jsx(Bu.Provider,{value:{themeName:t},children:e})}function Rn(){return useContext(Bu)}function ra({children:e,container:t}){let[a,r]=useState(false),n=Iu(),s=Rn();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:l,themeName:d}=n,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return createPortal(jsx("div",{"data-theme":d,"data-gantt-portal":"true",style:i,children:e}),o)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),o):createPortal(e,o)}var Uu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},ub="#BDC3C7",pb=({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 un({priority:e,onChange:t,className:a}){let[r,n]=useState(false),[s,o]=useState({top:0,left:0}),l=useRef(null),d=useRef(null),i=()=>{if(!d.current)return;let g=d.current.getBoundingClientRect(),f=window.innerHeight,v=window.innerWidth,y=160,b=220,h=4,x=g.right-y;x<10&&(x=g.left),x+y>v-10&&(x=v-y-10);let w=f-g.bottom,N=g.top,D;w>=b+h?D=g.bottom+h:N>=b+h?D=g.top-b-h:D=w>=N?g.bottom+h:Math.max(10,g.top-b-h),o({top:D,left:x}),n(true);};useEffect(()=>{let g=f=>{l.current&&!l.current.contains(f.target)&&!d.current?.contains(f.target)&&n(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),useEffect(()=>{let g=f=>{f.key==="Escape"&&n(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let u=g=>{t(g),n(false);},m=e?Uu[e]:null,p=m?.color||ub;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:d,onClick:()=>r?n(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${p}10`:"transparent",boxShadow:e?`0 0 0 2px ${p}30 inset`:"none"},title:m?.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(ra,{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(Uu).map(([g,f])=>jsxs("button",{onClick:()=>u(g),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:f.color,background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsx(pb,{color:f.color}),jsx("span",{className:"font-semibold text-sm",children:f.label}),e===g&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>u(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.currentTarget.style.background="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var mb=[{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 xs({startDate:e,endDate:t,onChange:a,className:r}){let[n,s]=useState(false),[o,l]=useState({top:0,left:0}),d=useRef(null),i=useRef(null),p=(Rn()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let x=i.current.getBoundingClientRect(),w=window.innerHeight,N=window.innerWidth,D=320,A=380,T=4,E=x.left;E+D>N-10&&(E=N-D-10),E<10&&(E=10);let P=w-x.bottom,k=x.top,K;P>=A+T?K=x.bottom+T:k>=A+T?K=x.top-A-T:K=P>=k?x.bottom+T:Math.max(10,x.top-A-T),l({top:K,left:E}),s(true);};useEffect(()=>{let x=w=>{d.current&&!d.current.contains(w.target)&&!i.current?.contains(w.target)&&s(false);};if(n)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),useEffect(()=>{let x=w=>{w.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[n]);let f=x=>{let w=new Date,N=E=>{let P=E.getFullYear(),k=String(E.getMonth()+1).padStart(2,"0"),K=String(E.getDate()).padStart(2,"0");return `${P}-${k}-${K}`},D=N(w),A=new Date(w);A.setDate(A.getDate()+x);let T=N(A);a(D,T),s(false);},v=()=>{if(!e||!t)return "Set date";let x=A=>{if(A instanceof Date)return A;if(typeof A!="string"||!A.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=A.split("-").map(Number);if(T.length!==3||T.some(K=>isNaN(K)))return null;let E=T[0],P=T[1],k=T[2];return E===void 0||P===void 0||k===void 0?null:new Date(E,P-1,k)},w=x(e),N=x(t);if(!w||!N||isNaN(w.getTime())||isNaN(N.getTime()))return "Set date";let D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${D[w.getMonth()]} ${w.getDate()} \u2013 ${D[N.getMonth()]} ${N.getDate()}`},y=e&&t,h=(()=>{if(!t)return false;let x=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),x<w})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,onClick:()=>n?s(false):g(),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:y?`${v()}`:"Set date range",children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsx("span",{className:"whitespace-nowrap",children:v()})]}),n&&jsx(ra,{children:jsxs("div",{ref:d,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${o.top}px`,left:`${o.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:mb.map(x=>jsx("button",{onClick:()=>f(x.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color: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:w=>{w.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:x.label},x.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color: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:x=>a(x.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background: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:x=>a(e,x.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background: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:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function mn({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:n=3}){let[s,o]=useState(false),[l,d]=useState(""),[i,u]=useState({top:0,left:0}),m=useRef(null),p=useRef(null),g=()=>{if(!p.current)return;let h=p.current.getBoundingClientRect(),x=window.innerHeight,w=window.innerWidth,N=300,D=380,A=4,T=h.right-N;T<10&&(T=h.left),T+N>w-10&&(T=w-N-10);let E=x-h.bottom,P=h.top,k;E>=D+A?k=h.bottom+A:P>=D+A?k=h.top-D-A:k=E>=P?h.bottom+A:Math.max(10,h.top-D-A),u({top:k,left:T}),o(true);};useEffect(()=>{let h=x=>{m.current&&!m.current.contains(x.target)&&!p.current?.contains(x.target)&&(o(false),d(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),useEffect(()=>{let h=x=>{x.key==="Escape"&&(o(false),d(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let f=h=>{let x=e.some(w=>w.id===h.id);a(x?e.filter(w=>w.id!==h.id):[...e,h]);},v=t.filter(h=>h.name.toLowerCase().includes(l.toLowerCase())),y=e.slice(0,n),b=e.length-n;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:p,onClick:()=>s?o(false):g(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxs("div",{className:"asakaa-avatar-group",children:[y.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)),b>0&&jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsx(ra,{children:jsxs("div",{ref:m,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=>d(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:v.length===0?jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):v.map(h=>{let x=e.some(w=>w.id===h.id);return jsxs("button",{onClick:()=>f(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:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor: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:x?"#00E5CC":"transparent"},children:x?"\u2713":""})]},h.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),o(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function fi(e,t,a){let r=new Map;e.forEach(d=>{if(d.dependencies&&Array.isArray(d.dependencies)){let i=d.dependencies.map(u=>{if(typeof u=="string")return u;let m=u;return m.taskId||m.targetId||""}).filter(Boolean);r.set(d.id,i);}});let n=r.get(a)||[];r.set(a,[...n,t]);let s=new Set,o=new Set,l=d=>{if(!s.has(d)){s.add(d),o.add(d);let i=r.get(d)||[];for(let u of i){if(!s.has(u)&&l(u))return true;if(o.has(u))return true}}return o.delete(d),false};return l(a)}function ws({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:n,validateCircular:s=true,onCircularDependencyError:o}){let[l,d]=useState(false),[i,u]=useState(""),[m,p]=useState(t.length>0),[g,f]=useState({top:0,left:0}),[v,y]=useState(null),b=useRef(null),h=useRef(null),x=()=>{if(!h.current)return;let T=h.current.getBoundingClientRect(),E=window.innerHeight,P=window.innerWidth,k=300,K=m?380:120,H=4,ee=T.right-k;ee<10&&(ee=T.left),ee+k>P-10&&(ee=P-k-10);let I=E-T.bottom,Y=T.top,q;I>=K+H?q=T.bottom+H:Y>=K+H?q=T.top-K-H:q=I>=Y?T.bottom+H:Math.max(10,T.top-K-H),f({top:q,left:ee}),d(true);};useEffect(()=>{if(!l||!h.current)return;let T=h.current.getBoundingClientRect(),E=window.innerHeight,P=window.innerWidth,k=300,K=m?380:120,H=4,ee=T.right-k;ee<10&&(ee=T.left),ee+k>P-10&&(ee=P-k-10);let I=E-T.bottom,Y=T.top,q;I>=K+H?q=T.bottom+H:Y>=K+H?q=T.top-K-H:q=I>=Y?T.bottom+H:Math.max(10,T.top-K-H),f({top:q,left:ee});},[m,l]),useEffect(()=>{let T=E=>{b.current&&!b.current.contains(E.target)&&!h.current?.contains(E.target)&&(d(false),u(""));};if(l)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[l]),useEffect(()=>{let T=E=>{E.key==="Escape"&&(d(false),u(""));};if(l)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[l]);let w=T=>{let E=t.includes(T),P=a.find(k=>k.id===T);if(y(null),E){let k=t.filter(K=>K!==T);r(k),k.length===0&&p(false);}else {if(s&&fi(a,T,e)){let K=`Cannot add "${P?.title||T}" as dependency - would create circular reference`;y(K),o?.(T,P?.title||T),setTimeout(()=>y(null),3e3);return}r([...t,T]),p(true);}},N=()=>{let T=!m;p(T),T||r([]);},D=a.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(i.toLowerCase())||T.id.toLowerCase().includes(i.toLowerCase())),A=t.length>0?"#00E5CC":"#BDC3C7";return jsxs("div",{className:`relative ${n||""}`,children:[jsxs("button",{ref:h,onClick:()=>l?d(false):x(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:A,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:A},children:t.length})]}),l&&jsx(ra,{children:jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[v&&jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:v})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:N,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:m?"#00E5CC":"transparent",borderColor:m?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:m&&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"})]})}),m&&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:T=>u(T.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children: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(T=>{let E=t.includes(T.id);return jsxs("button",{onClick:()=>w(T.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:P=>{P.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:P=>{P.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:E?"#00E5CC":"transparent",borderColor:E?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:E&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:T.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:T.id})]})]},T.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),p(false),d(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 So=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:n,className:s,onUpdate:o,availableUsers:l=[],allCards:d=[]})=>{let{attributes:i,listeners:u,setNodeRef:m,transform:p,transition:g,isDragging:f}=useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),v={transform:ui.Transform.toString(p),transition:g};if(t)return jsx("div",{ref:m,style:v,...i,...u,onClick:()=>a?.(e),children:t(e)});let y=l.filter(w=>e.assignedUserIds?.includes(w.id)),b=e.progress===100,h=(e.attachments||[]).filter(w=>w.type.startsWith("image/")),x={...v,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:m,style:x,className:c("asakaa-card",f&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:w=>{w.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:w=>{w.currentTarget.style.display="none";}})}),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:w=>{w.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((w,N)=>jsxs("div",{className:"relative",children:[jsx("img",{src:w.url,alt:w.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError: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]})})]},w.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.6:1},children:e.title}),e.description&&jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsx("div",{onClick:w=>w.stopPropagation(),className:"priority-selector",children:jsx(un,{priority:e.priority,onChange:w=>o?.(e.id,{priority:w})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsx(xs,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(w,N)=>o?.(e.id,{startDate:w,endDate:N})})}),l.length>0&&jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsx(mn,{assignedUsers:y,availableUsers:l,onChange:w=>o?.(e.id,{assignedUserIds:w.map(N=>N.id)})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsx(ws,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(w=>typeof w=="string"?w:w.taskId):[],availableTasks:d,onChange:w=>o?.(e.id,{dependencies:w})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(w=>jsx("span",{className:"asakaa-label",children:w},w))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#00E5CC"},children:[Math.round(e.progress),"%"]})]}),jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#00E5CC"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));So.displayName="Card";var bi={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"}},Ju=({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 Qu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[n,s]=useState(false),[o,l]=useState({top:0,left:0}),d=useRef(null),i=useRef(null),u=[...Object.entries(bi).map(([y,b])=>({id:y,label:b.label,color:b.color,icon:b.icon})),...r.filter(y=>!Object.keys(bi).includes(y.id)).map(y=>({id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}))],m=()=>{let y=bi[e];if(y)return {...y,id:e};let b=r.find(h=>h.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...bi.todo,id:"todo"}},p=()=>{if(!i.current)return;let y=i.current.getBoundingClientRect(),b=window.innerHeight,h=window.innerWidth,x=180,w=280,N=4,D=y.right-x;D<10&&(D=y.left),D+x>h-10&&(D=h-x-10);let A=b-y.bottom,T=y.top,E;A>=w+N?E=y.bottom+N:T>=w+N?E=y.top-w-N:E=A>=T?y.bottom+N:Math.max(10,y.top-w-N),l({top:E,left:D}),s(true);};useEffect(()=>{let y=b=>{d.current&&!d.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(n)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[n]),useEffect(()=>{let y=b=>{b.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[n]);let g=y=>{t(y),s(false);},f=m(),v=f.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:i,onClick:()=>n?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:`${v}10`,boxShadow:`0 0 0 2px ${v}30 inset`},title:f.label,children:jsx(Ju,{icon:f.icon,color:v})}),n&&jsx(ra,{children:jsxs("div",{ref:d,className:"status-selector-menu",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:u.map(y=>jsxs("button",{onClick:()=>g(y.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:y.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsx(Ju,{icon:y.icon,color:y.color}),jsx("span",{className:"font-semibold",children:y.label}),e===y.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},y.id))})]})})]})}var Zu={en:{renameColumn:"Rename Column",rename:"Rename",delete:"Delete",columnName:"Column name",columnOptions:"Column options"},es:{renameColumn:"Renombrar Columna",rename:"Renombrar",delete:"Eliminar",columnName:"Nombre de columna",columnOptions:"Opciones de columna"}};function ep({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:n,locale:s="en"}){let o=Zu[s]||Zu.en,[l,d]=useState(false),[i,u]=useState(false),[m,p]=useState(e),[g,f]=useState({top:0,left:0}),v=useRef(null),y=useRef(null),b=useRef(null);useEffect(()=>{if(l&&y.current){let N=y.current.getBoundingClientRect();f({top:N.bottom+window.scrollY+8,left:N.left+window.scrollX});}},[l]),useEffect(()=>{let N=D=>{v.current&&!v.current.contains(D.target)&&!y.current?.contains(D.target)&&(d(false),u(false));};if(l)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),useEffect(()=>{let N=D=>{D.key==="Escape"&&(d(false),u(false),p(e));};if(l)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[l,e]),useEffect(()=>{i&&b.current&&(b.current.focus(),b.current.select());},[i]);let h=()=>{u(true),p(e);},x=()=>{let N=m.trim();N&&N!==e&&t(N),u(false),d(false),p(e);},w=N=>{N.key==="Enter"?x():N.key==="Escape"&&(u(false),p(e));};return jsxs("div",{className:`relative ${n||""}`,children:[jsx("button",{ref:y,onClick:()=>d(!l),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:o.columnOptions,"aria-label":o.columnOptions,children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),l&&jsx(ra,{children:jsx("div",{ref:v,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:i?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:o.renameColumn}),jsx("input",{ref:b,type:"text",value:m,onChange:N=>p(N.target.value),onKeyDown:w,onBlur:x,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-[#00E5CC]/50 transition-all",placeholder:o.columnName,maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:h,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-medium",children:o.rename})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),d(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:o.delete})]})]})]})})})]})}var Hn=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:l,availableUsers:d,allCards:i,enableVirtualization:u,cardHeight:m=120,isCollapsed:p,onToggleCollapse:g,onColumnRename:f,onColumnDelete:v,isDeletable:y=false,className:b,renderMetrics:h,locale:x})=>{let{setNodeRef:w,isOver:N}=useDroppable({id:e.id,data:{type:"column",column:e}}),D=useRef(null),A=u??Nu(t.length),T=useVirtualizer({count:t.length,getScrollElement:()=>D.current,estimateSize:()=>m,enabled:A});if(a)return jsx("div",{ref:w,className:b,children:a(e,t)});let P=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let H=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:H}:H>=80?{state:"warning",percentage:H}:H>=60?{state:"approaching",percentage:H}:{state:"ok",percentage:H}})(),k=P.state==="exceeded",K=()=>"asakaa-column-count";return jsxs("div",{ref:w,className:c("asakaa-column",N&&"ring-2 ring-asakaa-accent-blue",k&&"ring-2 ring-asakaa-accent-red",b),children:[n?n(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:c(K()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&P.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${P.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[P.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"})]}),P.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"})]}),P.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"})}),P.state==="ok"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(f||v)&&jsx(ep,{columnTitle:e.title,onRename:H=>f?.(e.id,H),onDelete:v?()=>v(e.id):void 0,isDeletable:y,locale:x}),g&&jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),h&&h(e,t),!p&&jsx("div",{ref:D,className:"asakaa-column-cards",style:{maxHeight:A?"600px":void 0},children:jsx(SortableContext,{items:t.map(H=>H.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"})}):A?jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map(H=>{let ee=t[H.index];return ee?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${H.start}px)`},children:jsx(So,{card:ee,render:r,onClick:o,onUpdate:l,availableUsers:d,allCards:i})},ee.id):null})}):t.map(H=>jsx(So,{card:H,render:r,onClick:o,onUpdate:l,availableUsers:d,allCards:i},H.id))})})]})});Hn.displayName="Column";function Kl({title:e,onSave:t,className:a}){let[r,n]=useState(false),[s,o]=useState(e),l=useRef(null);useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let d=()=>{let u=s.trim();u&&u!==e?t(u):o(e),n(false);},i=u=>{u.key==="Enter"?d():u.key==="Escape"&&(o(e),n(false));};return r?jsx("input",{ref:l,type:"text",value:s,onChange:u=>o(u.target.value),onBlur:d,onKeyDown:i,className:c("asakaa-column-title bg-transparent border-b-2 border-[#00E5CC]","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:c("asakaa-column-title cursor-pointer",a),onClick:()=>n(true),title:"Click to edit",children:e})}function Lb(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let n=a[r-1];if(r>0&&n&&!/\s/.test(n))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function sp(e,t){let a=[],r=/@(\S+)/g,n;for(;(n=r.exec(e))!==null;){let s=n[1]?.toLowerCase()??"";if(!s)continue;let o=t.find(l=>{let d=l.name.toLowerCase(),i=d.replace(/\s+/g,""),u=d.split(/\s+/);return !!(i===s||d===s||u.some(m=>m===s))});o&&!a.includes(o.id)&&a.push(o.id);}return a}function Ib(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Bb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Rb=["\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 ip({value:e,onChange:t,onSubmit:a,users:r,placeholder:n,disabled:s=false,isSubmitting:o=false,theme:l="dark",locale:d="es",currentUser:i,enableEmoji:u=true,enableAttachments:m=true,pendingFiles:p=[],onFilesSelect:g,onRemoveFile:f,maxFileSizeMB:v=10}){let y=l==="dark",[b,h]=useState(false),[x,w]=useState([]),[N,D]=useState(0),[A,T]=useState(null),[E,P]=useState(false),k=useRef(null),K=useRef(null),H=useRef(null),ee=useRef(null),I=useCallback((z,te)=>{let xe=Lb(z,te);if(T(xe),xe){let je=r.filter(Ne=>Ne.name.toLowerCase().includes(xe.query)||Ne.email&&Ne.email.toLowerCase().includes(xe.query)).slice(0,5);w(je),h(je.length>0),D(0);}else h(false),w([]);},[r]),Y=z=>{let te=z.target.value;if(t(te),I(te,z.target.selectionStart||0),k.current){k.current.style.height="24px";let xe=k.current.scrollHeight,je=280,Ne=Math.min(xe,je);k.current.style.height=`${Ne}px`,k.current.style.overflowY=xe>je?"auto":"hidden";}},q=()=>{k.current&&I(e,k.current.selectionStart||0);},V=useCallback(z=>{if(!A||!k.current)return;let te=e.slice(0,A.start),xe=e.slice(A.end),je=`@${z.name.replace(/\s+/g,"")} `,Ne=te+je+xe;t(Ne),h(false),T(null),setTimeout(()=>{if(k.current){let ze=A.start+je.length;k.current.selectionStart=ze,k.current.selectionEnd=ze,k.current.focus();}},0);},[A,e,t]),B=z=>{if(b&&x.length>0)switch(z.key){case "ArrowDown":z.preventDefault(),D(te=>te<x.length-1?te+1:0);break;case "ArrowUp":z.preventDefault(),D(te=>te>0?te-1:x.length-1);break;case "Enter":{z.preventDefault();let te=x[N];te&&V(te);break}case "Tab":{z.preventDefault();let te=x[N];te&&V(te);break}case "Escape":z.preventDefault(),h(false);break}else z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),a());};useEffect(()=>{let z=te=>{K.current&&!K.current.contains(te.target)&&k.current&&!k.current.contains(te.target)&&h(false),ee.current&&!ee.current.contains(te.target)&&P(false);};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);let X$1=useCallback(z=>{if(!k.current)return;let te=k.current.selectionStart||e.length,xe=e.slice(0,te)+z+e.slice(te);t(xe),P(false),setTimeout(()=>{if(k.current){let je=te+z.length;k.current.selectionStart=je,k.current.selectionEnd=je,k.current.focus();}},0);},[e,t]),Te=useCallback(z=>{if(!g||!z.target.files)return;let te=Array.from(z.target.files),xe=v*1024*1024,je=te.filter(Ne=>Ne.size>xe?(console.warn(`File ${Ne.name} exceeds max size of ${v}MB`),false):true);je.length>0&&g(je),z.target.value="";},[g,v]),He=useCallback(z=>z.type.startsWith("image/")?Image:z.type.includes("pdf")||z.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(b&&K.current){let z=K.current.children[N];z&&z.scrollIntoView({block:"nearest"});}},[N,b]),jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:p.map(z=>{let te=He(z.file),xe=z.file.type.startsWith("image/");return jsxs("div",{className:c("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",y?"bg-white/10":"bg-gray-100"),children:[xe&&z.preview?jsx("img",{src:z.preview,alt:z.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(te,{className:c("w-4 h-4",y?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:c("text-xs truncate",y?"text-white":"text-gray-900"),children:z.file.name}),jsx("p",{className:c("text-xs",y?"text-[#6B7280]":"text-gray-400"),children:Bb(z.file.size)})]}),f&&jsx("button",{onClick:()=>f(z.id),className:c("p-0.5 rounded-full transition-colors",y?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsx(X,{className:"w-3 h-3"})})]},z.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[i&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:c("flex-1 relative min-w-0"),children:[jsxs("div",{className:c("flex items-end gap-1 px-2 py-2 rounded-lg",y?"bg-white/5":"bg-white border border-gray-200"),children:[u&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>P(!E),disabled:s||o,className:c("p-1 rounded transition-colors flex-shrink-0",y?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:E&&jsx(motion.div,{ref:ee,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:c("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",y?"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:Rb.map(z=>jsx("button",{type:"button",onClick:()=>X$1(z),className:c("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",y?"hover:bg-white/10":"hover:bg-gray-100"),children:z},z))})})})]}),m&&g&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>H.current?.click(),disabled:s||o,className:c("p-1.5 rounded transition-colors",y?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:d==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:H,type:"file",multiple:true,onChange:Te,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:k,value:e,onChange:Y,onSelect:q,onKeyDown:B,placeholder:n||(d==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||o,rows:1,className:c("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",y?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||o)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:o||!e.trim()&&p.length===0||s,className:c("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-[#00E5CC] text-white hover:bg-[#00C4AE]":y?"text-[#6B7280]":"text-gray-400",o&&"opacity-50 cursor-not-allowed"),children:o?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]}),jsx(AnimatePresence,{children:b&&x.length>0&&jsx(motion.div,{ref:K,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:c("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",y?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:x.map((z,te)=>jsxs("button",{type:"button",onClick:()=>V(z),className:c("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",te===N?y?"bg-white/10":"bg-gray-100":y?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:z.color||"#8B5CF6"},children:Ib(z.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:c("text-sm font-medium truncate",y?"text-white":"text-gray-900"),children:z.name}),z.email&&jsx("p",{className:c("text-xs truncate",y?"text-[#6B7280]":"text-gray-500"),children:z.email})]})]},z.id))})})]})]})]})}function lp({content:e,theme:t="dark"}){let a=t==="dark",r=[],n=/@(\S+)/g,s=0,o;for(;(o=n.exec(e))!==null;)o.index>s&&r.push({type:"text",value:e.slice(s,o.index)}),r.push({type:"mention",value:o[0]}),s=o.index+o[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((l,d)=>l.type==="mention"?jsx("span",{className:c("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:l.value},d):jsx("span",{children:l.value},d))})}var wi=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Wo({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:n,disabled:s=false,compact:o=true}){let[l,d]=useState(false),[i,u]=useState(""),[m,p]=useState(false),[g,f]=useState(wi[10]||"#00E5CC"),[v,y]=useState({top:0,left:0}),b=useRef(null),h=useRef(null),x=useRef(null),w=useRef(null),N=t.filter(k=>k.name.toLowerCase().includes(i.toLowerCase())),D=t.some(k=>k.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(l&&h.current){let k=h.current.getBoundingClientRect();y({top:k.bottom+6,left:k.left});}},[l]),useEffect(()=>{let k=K=>{let H=K.target,ee=b.current?.contains(H),I=x.current?.contains(H);!ee&&!I&&(d(false),u(""),p(false));};if(l)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),useEffect(()=>{l&&w.current&&w.current.focus();},[l]);let A=k=>{let K=e.some(H=>H.id===k.id);a(K?e.filter(H=>H.id!==k.id):[...e,k]);},T=async()=>{if(!(!r||!i.trim())){p(true);try{let k=await r(i.trim(),g);k&&(a([...e,k]),u(""),f(wi[Math.floor(Math.random()*wi.length)]||"#00E5CC"));}finally{p(false);}}},E=(k,K)=>{K.stopPropagation(),a(e.filter(H=>H.id!==k));},P={backgroundColor:`${n.textTertiary}15`,border:`1px solid ${n.borderLight}`,color:n.textSecondary};return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{ref:h,type:"button",onClick:()=>!s&&d(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:P,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(k=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${k.color}20`,color:k.color},children:k.name},k.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:n.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:n.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:x,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:v.top,left:v.left,zIndex:99999,backgroundColor:n.bgPrimary,border:`1px solid ${n.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:n.border},children:jsx("input",{ref:w,type:"text",value:i,onChange:k=>u(k.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:n.bgSecondary,color:n.textPrimary,border:`1px solid ${n.borderLight}`},onKeyDown:k=>{k.key==="Enter"&&i.trim()&&!D&&r&&T();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:n.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:n.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(k=>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:`${k.color}20`,color:k.color},onClick:K=>E(k.id,K),children:[k.name,jsx(X,{className:"w-3 h-3"})]},k.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(k=>{let K=e.some(H=>H.id===k.id);return jsxs("button",{type:"button",onClick:()=>A(k),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:K?`${k.color}15`:"transparent",color:n.textPrimary},onMouseEnter:H=>{K||(H.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:H=>{K||(H.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:k.color}}),jsx("span",{className:"flex-1 text-left",children:k.name}),K&&jsx(Check,{className:"w-4 h-4",style:{color:k.color}})]},k.id)}):i.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!D&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:n.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:n.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:wi.map(k=>jsx("button",{type:"button",onClick:()=>f(k),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:k,outline:g===k?`2px solid ${k}`:"none",outlineOffset:"2px"}},k))}),jsxs("button",{type:"button",onClick:T,disabled:m,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:m?.7:1},children:[m?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 Yl({tag:e,onRemove:t,size:a="sm"}){return jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function cp({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),n=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsx(Yl,{tag:s,size:a},s.id)),n>0&&jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",n]})]})}var fn=[{name:"Azul",value:"#00E5CC",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#00E5CC",light:"#00E5CC"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function up(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 jb(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 _b({className:e}){return jsxs("svg",{className:c("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 Xl({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:n}){let s=jb(e.health),o={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},d=up(e.loggedMinutes),i=e.estimateMinutes?up(e.estimateMinutes):null,u=a&&i?`${d} / ${i}`:d;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:c("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,o[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",n),onClick:r,type:r?"button":void 0,children:[jsx(_b,{className:l[t]}),jsx("span",{children:u})]})}function Kb(e){let t=e.trim();if(!t)return null;let a;if(t.startsWith("="))a=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))a=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))a=t;else return null;if(!a||!/^[\d+\-*/().\s]+$/.test(a)||/[+\-*/]{2,}/.test(a.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let r=new Function(`"use strict"; return (${a});`)();return typeof r!="number"||!isFinite(r)||r<0?null:r}catch{return null}}function Ci(e){let t=Kb(e);return t!==null?String(t):e}function mp(e){let a=Ci(e).trim().toLowerCase();if(a.includes(":")){let[o,l]=a.split(":").map(Number);return (o||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,l=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+l}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function Ti(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Xb(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 Jb({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function Qb({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 gp({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 Zb({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 Jl({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:l,onStopTimer:d,onDiscardTimer:i,onClose:u,className:m}){let[p,g]=useState(""),[f,v]=useState(t.estimateMinutes?Ti(t.estimateMinutes):""),[y,b]=useState(""),[h,x]=useState(false),[w,N]=useState(false),D=useRef(null);useEffect(()=>{D.current?.focus();},[]);let A=async()=>{let P=mp(p);if(!(P<=0||!s)){x(true);try{await s({durationMinutes:P,note:y.trim()||void 0,source:"manual"}),g(""),b("");}finally{x(false);}}},T=async()=>{if(!o)return;let P=f.trim()?mp(f):null;await o(P),N(false);},E=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),A()),P.key==="Escape"&&u?.();};return jsxs("div",{className:c("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",m),children:[jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsx("button",{onClick:u,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(gp,{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:Xb(n)})]}),jsx("button",{onClick:d,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(Qb,{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(gp,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:l,className:c("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(Jb,{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(Zb,{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:P=>g(P.target.value),onKeyDown:E,placeholder:"8 (=8h), 2h 30m",className:c("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsx("button",{onClick:A,disabled:h||!p.trim(),className:c("px-3 py-1.5 rounded-lg text-sm font-medium","bg-[#00E5CC] hover:bg-[#00C4AE] text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:y,onChange:P=>b(P.target.value),onKeyDown:E,placeholder:"Note (optional)",className:c("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsxs("div",{className:"px-3 py-2",children:[jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Ti(t.loggedMinutes)})]}),jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),w?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:f,onChange:P=>v(P.target.value),onKeyDown:P=>{P.key==="Enter"&&T(),P.key==="Escape"&&N(false);},onBlur:T,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-[#00E5CC] bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>N(true),className:"font-medium text-gray-900 dark:text-white hover:text-[#00E5CC]",children:t.estimateMinutes?Ti(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxs("div",{className:"mt-2",children:[jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxs("span",{className:c("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:c("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxs("div",{className:"px-3 py-2",children:[jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map(P=>jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsx("span",{className:"truncate flex-1",children:P.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Ti(P.durationMinutes)})]},P.id))})]})]})}function oh(e){let a=Ci(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[o,l]=a.split(":").map(Number);return (o||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,l=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+l}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function nh(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 bo({mode:e,locale:t,isDark:a,currentValue:r,onSave:n,onClose:s,className:o}){let[l,d]=useState(nh(r)),[i,u]=useState(""),[m,p]=useState(false),g=useRef(null);useEffect(()=>{g.current?.focus();},[]);let f=async()=>{p(true);let x=oh(l);await n(x&&x>0?x:null,i||void 0),p(false);},v=async()=>{p(true),await n(null),p(false);},y=x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),f()),x.key==="Escape"&&s();},b={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},h=t==="es";return jsxs("div",{className:c("w-56",o),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:x=>x.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#00E5CC"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:b[e]})]}),jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsx(X,{className:"w-3 h-3"})})]}),jsxs("div",{className:"p-3 space-y-2",children:[jsx("input",{ref:g,type:"text",value:l,onChange:x=>d(x.target.value),onKeyDown:y,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsx("input",{type:"text",value:i,onChange:x=>u(x.target.value),onKeyDown:y,placeholder:h?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsx("button",{type:"button",onClick:f,disabled:m||!l.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0, 229, 204,0.3)":"1px solid #00E5CC",background:a?"rgba(0, 229, 204,0.15)":"#00E5CC",color:a?"#007FFF":"#FFFFFF"},children:m?h?"Guardando...":"Saving...":h?"Registrar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:v,disabled:m,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:h?"Quitar":"Clear"})]})]})}function sh(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 ih(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 Zl({summary:e,showLabel:t=false,size:a="md",className:r}){let n=sh(e.health),s=ih(e.health),o={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,d=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxs("div",{className:c("flex items-center gap-2",r),children:[jsx("div",{className:c("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",o[a]),children:jsx("div",{className:c("h-full w-1/4",n)})}),t&&jsx("span",{className:c("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:c("flex items-center gap-2",r),children:[jsxs("div",{className:c("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",o[a]),children:[jsx("div",{className:c("h-full transition-all duration-300",n),style:{width:`${d}%`}}),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:c("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function zn(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 dh(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-[#00E5CC]":"text-[#00C4AE]";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function ch(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-[#00A893]/30 border-[#00C4AE]/50":"bg-[#00E5CC]/15 border-[#00E5CC]/15";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function uh(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 ph({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,n=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",o=a?"border-white/5":"border-gray-200",l=a?"text-[#9CA3AF]":"text-gray-500",d=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:c("p-4 rounded-lg border",s,o),children:[jsx("div",{className:c("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:c("text-2xl font-bold",n),children:[r?"+":"",zn(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:c("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:c("p-4 rounded-lg border",s,o),children:[jsx("div",{className:c("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:c("font-medium",d),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-[#00E5CC]":"text-[#00C4AE]",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:c("font-medium",d),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:c("font-medium",d),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:c("p-4 rounded-lg border",s,o),children:[jsx("div",{className:c("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:c("font-medium",d),children:zn(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:c("font-medium",d),children:zn(e.totalLoggedMinutes)})]}),jsxs("div",{className:c("flex justify-between pt-1 border-t",o),children:[jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:c("font-medium",d),children:e.totalTasksWithEstimate})]})]})]})]})}function mh({task:e,locale:t,isDark:a,onClick:r}){let n=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",o=a?"text-[#E5E7EB]":"text-gray-900",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:c("border-b",s,r&&c("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:c("font-medium",o),children:e.taskName}),e.projectName&&jsx("div",{className:c("text-xs mt-1",l),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?zn(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:zn(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:c("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),children:[n,zn(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:c("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[n,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:c("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",ch(e.status,a),dh(e.status,a)),children:uh(e.status,t)})})]})}function ed({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:n,onTaskClick:s}){let o=r==="dark",l=o?"bg-[#050505]":"bg-gray-50",d=o?"bg-[#0A0A0A]":"bg-white",i=o?"border-white/[0.08]":"border-gray-200",u=o?"text-white/[0.92]":"text-gray-900",m=o?"text-white/[0.60]":"text-gray-500",p=o?"bg-[#050505]/50":"bg-gray-50",g=useMemo(()=>e?[...e.tasks].sort((f,v)=>f.varianceMinutes===null?1:v.varianceMinutes===null?-1:v.varianceMinutes-f.varianceMinutes):[],[e]);return t?jsx("div",{className:c("p-8 text-center",m,n),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:c("p-8 text-center",m,n),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:c("space-y-6 p-6",l,n),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:c("text-2xl font-bold",u),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:c("text-sm mt-1",m),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(ph,{summary:e.summary,locale:a,isDark:o}),jsx("div",{className:c("rounded-lg border overflow-hidden",d,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:c("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",m),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:"%"}),jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:c("divide-y",i),children:g.map(f=>jsx(mh,{task:f,locale:a,isDark:o,onClick:s},f.taskId))})]})})}),jsx("div",{className:c("text-xs text-center",m),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 Un(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 Sh(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 Tp(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(n=>{let s=t.find(o=>o.id===n);return s||null}).filter(n=>n!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(n=>typeof n=="string"?n:n.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(n=>({id:n.id,name:n.title,progress:n.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function Eh(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds,dependencies:e.dependencies}}function Mo({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:l=[],availableTags:d=[],onCreateTag:i,attachments:u=[],onUploadAttachments:m,onDeleteAttachment:p,availableTasks:g=[],comments:f=[],onAddComment:v,currentUser:y,mentionableUsers:b=[],onUploadCommentAttachments:h,enableTimeTracking:x=false,timeTrackingSummary:w,timeEntries:N=[],isTimerRunning:D=false,timerElapsedSeconds:A=0,onTimeLog:T,onEstimateUpdate:E,onSoldEffortUpdate:P,onTimerStart:k,onTimerStop:K,onTimerDiscard:H,blurFinancials:ee=false}){let I=s==="dark",Y={textTertiary:I?"#6B7280":"#9CA3AF",textSecondary:I?"#9CA3AF":"#6B7280",textPrimary:I?"#FFFFFF":"#111827",borderLight:I?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:I?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:I?"#1A1D25":"#FFFFFF",bgSecondary:I?"#0A0A0A":"#F9FAFB",hoverBg:I?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},q=e&&"title"in e&&!("name"in e),V=e,[B,X$1]=useState(e?Tp(e,l):null),[Te,He]=useState(false),[z,te]=useState(false),[xe,je]=useState(false),[Ne,ze]=useState(null),[Me,at]=useState(new Date),[be,pt]=useState(false),[Ke,Ue]=useState(false),[kt,Ht]=useState(""),[qe,We]=useState(false),[ot,zt]=useState(false),[Ee,nt]=useState(false),[F,le]=useState(false),[R,J]=useState(""),O=useRef(null),Z=useRef(null),[Ve,ke]=useState(""),Re=useRef(null),[Ae,Pe]=useState(""),[ct,Qe]=useState(false),[st,mt]=useState([]),[jt,St]=useState(""),[Ut,gt]=useState(false),Mt=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 C=Tp(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:C?.id,taskName:C?.name,soldEffortMinutes:C?.soldEffortMinutes,quotedMinutes:C?.quotedMinutes,effortMinutes:C?.effortMinutes,timeLoggedMinutes:C?.timeLoggedMinutes}),X$1(C),J(C.description||""),ke(C.name||"");}},[e?.id,e?.quotedMinutes,l,t]),useEffect(()=>{if(!t||!R)return;let C=setTimeout(()=>{let $=Z.current;$&&($.style.height="auto",$.style.height=`${Math.max(100,$.scrollHeight)}px`);},50);return ()=>clearTimeout(C)},[t,R]),useEffect(()=>()=>{O.current&&clearTimeout(O.current),Re.current&&clearTimeout(Re.current);},[]),useEffect(()=>{t&&Mt.current&&f.length>0&&setTimeout(()=>{Mt.current&&(Mt.current.scrollTop=Mt.current.scrollHeight);},100);},[t,f.length]);let Bt=useCallback(C=>{X$1(C),q&&n&&V?n(Eh(C,V)):r&&r(C);},[q,V,n,r]),_t=useCallback(()=>{He(false),te(false),je(false),ze(null),Ue(false),Ht(""),We(false);},[]),Wt=useCallback((C,$)=>{if(!B)return;let fe={...B,[C]:$};Bt(fe);},[B,Bt]),rt=useCallback(()=>{let C=Z.current;C&&(C.style.height="auto",C.style.height=`${Math.max(100,C.scrollHeight)}px`);},[]),da=useCallback(C=>{J(C),setTimeout(rt,0),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{if(B){let $={...B,description:C};Bt($);}},800);},[B,Bt,rt]),ha=useCallback(C=>{ke(C),Re.current&&clearTimeout(Re.current),Re.current=setTimeout(()=>{if(B&&C.trim()){let $={...B,name:C.trim()};Bt($);}},800);},[B,Bt]),W=useCallback(C=>{let $=C.map(fe=>{let De={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:fe};return fe.type.startsWith("image/")&&(De.preview=URL.createObjectURL(fe)),De});mt(fe=>[...fe,...$]);},[]),ne=useCallback(C=>{mt($=>{let fe=$.find(De=>De.id===C);return fe?.preview&&URL.revokeObjectURL(fe.preview),$.filter(De=>De.id!==C)});},[]),ft=useCallback(async()=>{if(!(!B||!Ae.trim()&&st.length===0||!v)){Qe(true);try{let C=sp(Ae,b),$=[];if(st.length>0&&h){let fe=st.map(De=>De.file);$=await h(fe);}await v(B.id,Ae.trim(),C.length>0?C:void 0,$.length>0?$:void 0),Pe(""),st.forEach(fe=>{fe.preview&&URL.revokeObjectURL(fe.preview);}),mt([]);}finally{Qe(false);}}},[B,Ae,st,v,b,h]),Tt=useCallback(()=>{if(!B||!jt.trim())return;let C=B.subtasks||[],$={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:jt.trim(),progress:0,startDate:new Date,endDate:new Date,position:C.length},fe=[...C,$],De={...B,subtasks:fe};Bt(De),St(""),gt(false);},[B,jt,Bt]),pa=useCallback(C=>{if(!B?.subtasks)return;let $=B.subtasks.map(De=>De.id===C?{...De,progress:De.progress===100?0:100}:De),fe={...B,subtasks:$};Bt(fe);},[B,Bt]),ce=useCallback(C=>{if(!B?.subtasks)return;let $=B.subtasks.filter(De=>De.id!==C),fe={...B,subtasks:$};Bt(fe);},[B,Bt]),ve=useCallback(C=>{let $=typeof C=="string"?new Date(C):C,De=new Date().getTime()-$.getTime(),se=Math.floor(De/6e4),ut=Math.floor(De/36e5),lt=Math.floor(De/864e5);return se<1?o==="es"?"Ahora":"Just now":se<60?o==="es"?`Hace ${se} min`:`${se}m ago`:ut<24?o==="es"?`Hace ${ut}h`:`${ut}h ago`:lt<7?o==="es"?`Hace ${lt}d`:`${lt}d ago`:$.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),Et=useCallback(C=>{if(!B)return;let $=B.progress||0;C==="completed"?$=100:C==="in-progress"&&$===0?$=10:C==="todo"&&($=0);let fe={...B,status:C,progress:$};Bt(fe),He(false);},[B,Bt]),it=useCallback((C,$)=>{if(!B)return;let fe={...B,startDate:C,endDate:$};Bt(fe);},[B,Bt]),wt=useCallback(()=>{let C=Me.getFullYear(),$=Me.getMonth(),fe=new Date(C,$,1),se=new Date(C,$+1,0).getDate(),ut=fe.getDay(),lt=[],Zt=new Date(C,$,0).getDate();for(let Kt=ut-1;Kt>=0;Kt--)lt.push({date:new Date(C,$-1,Zt-Kt),isCurrentMonth:false});for(let Kt=1;Kt<=se;Kt++)lt.push({date:new Date(C,$,Kt),isCurrentMonth:true});let Yt=42-lt.length;for(let Kt=1;Kt<=Yt;Kt++)lt.push({date:new Date(C,$+1,Kt),isCurrentMonth:false});return lt},[Me]),_=useCallback(async C=>{if(C.preventDefault(),C.stopPropagation(),nt(false),!B||!m)return;let $=Array.from(C.dataTransfer.files);if($.length!==0){le(true);try{await m(B.id,$);}finally{le(false);}}},[B,m]),ge=useCallback(async C=>{if(!B||!m||!C.target.files)return;let $=Array.from(C.target.files);if($.length!==0){le(true);try{await m(B.id,$);}finally{le(false);}C.target.value="";}},[B,m]),ae=useCallback(C=>{C.preventDefault(),C.stopPropagation(),nt(true);},[]),U=useCallback(C=>{C.preventDefault(),C.stopPropagation(),nt(false);},[]),oe=useCallback(C=>C<1024?`${C} B`:C<1024*1024?`${(C/1024).toFixed(1)} KB`:`${(C/(1024*1024)).toFixed(1)} MB`,[]),Le=useCallback(C=>C.startsWith("image/")?Image:C.includes("pdf")||C.includes("document")?FileText:File,[]);return !t||!B?null:jsx(AnimatePresence,{children:t&&B&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:c("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",I?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:c("px-6 py-3 border-b flex items-center gap-3 h-[49px]",I?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:c("w-4 h-4",I?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:c("text-xs px-2 py-0.5 rounded",I?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[o==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:c("text-xs font-mono",I?"text-[#6B7280]":"text-gray-400"),children:B.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let C=B.progress===100?0:100,fe={...B,progress:C,status:C===100?"completed":"todo"};Bt(fe);},className:c("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",B.progress===100?"bg-green-500 border-green-500":I?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:B.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Ve,onChange:C=>ha(C.target.value),placeholder:o==="es"?"Nombre de la tarea...":"Task name...",className:c("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",B.progress===100?"line-through text-[#6B7280]":I?"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:c("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{_t(),He(!Te);},className:c("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",B.progress===100||B.status==="completed"?"bg-green-500/20 text-green-400":B.progress&&B.progress>0||B.status==="in-progress"?"bg-[#00E5CC]/20 text-[#00E5CC]":I?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.progress===100||B.status==="completed"?o==="es"?"COMPLETADO":"DONE":B.progress&&B.progress>0||B.status==="in-progress"?o==="es"?"EN PROGRESO":"IN PROGRESS":o==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:Te&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>He(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:o==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:o==="es"?"En progreso":"In Progress",color:"bg-[#00E5CC]"},{id:"completed",label:o==="es"?"Completado":"Done",color:"bg-green-500"}].map(C=>jsxs("button",{onClick:()=>Et(C.id),className:c("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",I?"hover:bg-white/5":"hover:bg-gray-50",B.status===C.id&&(I?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:c("w-2 h-2 rounded-full",C.color)}),jsx("span",{className:I?"text-white":"text-gray-900",children:C.label})]},C.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:c("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{_t(),je(!xe);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[B.assignees&&B.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[B.assignees.slice(0,3).map((C,$)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:C.color||"#8B5CF6"},title:C.name,children:C.initials||C.name.slice(0,2).toUpperCase()},$)),B.assignees.length>3&&jsxs("span",{className:c("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:["+",B.assignees.length-3]})]}):jsx("span",{className:c("text-sm",I?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:c("w-3 h-3",I?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:xe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>je(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(C=>{let $=B.assignees?.some(fe=>fe.name===C.name);return jsxs("button",{onClick:()=>{let fe=B.assignees||[],De;$?De=fe.filter(se=>se.name!==C.name):De=[...fe,C],Wt("assignees",De);},className:c("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",I?"hover:bg-white/5":"hover:bg-gray-50",$&&(I?"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:C.color||"#8B5CF6"},children:C.initials||C.name.slice(0,2).toUpperCase()}),jsx("span",{className:c("flex-1",I?"text-white":"text-gray-900"),children:C.name}),$&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},C.name)}):jsx("div",{className:c("px-3 py-4 text-sm text-center",I?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:c("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{ze(Ne?null:"start"),at(B.startDate||new Date);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[B.startDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Inicio":"Start"),jsx("span",{className:c("mx-1",I?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),B.endDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:Ne&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ze(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:c("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:C=>C.stopPropagation(),children:[jsxs("div",{className:c("w-44 py-2 border-r",I?"border-white/10":"border-gray-200"),children:[(()=>{let C=new Date,$=new Date(C);$.setDate(C.getDate()+1);let fe=new Date(C);fe.setDate(C.getDate()+((6-C.getDay()+7)%7||7));let De=new Date(C);De.setDate(C.getDate()+((1-C.getDay()+7)%7||7));let se=new Date(C);se.setDate(C.getDate()+(6-C.getDay()+7)%7+7);let ut=new Date(C);ut.setDate(C.getDate()+14);let lt=new Date(C);return lt.setDate(C.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:C,display:C.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:$,display:$.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:fe,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:De,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:se,display:se.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:ut,display:ut.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:lt,display:lt.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Yt,Kt)=>jsxs("button",{className:c("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",I?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Ne==="start"){let La=B.endDate&&Yt.date>B.endDate?Yt.date:B.endDate;it(Yt.date,La),ze("end");}else {let La=B.startDate&&Yt.date<B.startDate?Yt.date:B.startDate;it(La,Yt.date),ze(null);}},children:[jsx("span",{children:Yt.label}),jsx("span",{className:c("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:Yt.display})]},Kt))})(),jsx("div",{className:c("border-t mt-2 pt-2",I?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{it(void 0,void 0),ze(null);},className:c("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",I?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:c("text-xs mb-3 px-2 py-1 rounded",I?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Ne==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:c("font-medium",I?"text-white":"text-gray-900"),children:Me.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>at(new Date),className:c("p-1 rounded text-sm transition-colors",I?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>at(new Date(Me.getFullYear(),Me.getMonth()-1)),className:c("p-1 rounded",I?"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:()=>at(new Date(Me.getFullYear(),Me.getMonth()+1)),className:c("p-1 rounded",I?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(C=>jsx("div",{className:c("w-8 h-8 flex items-center justify-center text-xs",I?"text-[#6B7280]":"text-gray-400"),children:C},C))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:wt().map((C,$)=>{let fe=C.date.toDateString()===new Date().toDateString(),De=B.startDate?.toDateString()===C.date.toDateString(),se=B.endDate?.toDateString()===C.date.toDateString(),ut=De||se,lt=B.startDate&&B.endDate&&C.date>=B.startDate&&C.date<=B.endDate;return jsx("button",{onClick:()=>{let Zt=new Date(C.date);if(Ne==="start"){let Yt=B.endDate&&Zt>B.endDate?Zt:B.endDate;it(Zt,Yt),ze("end");}else {let Yt=B.startDate&&Zt<B.startDate?Zt:B.startDate;it(Yt,Zt),ze(null);}},className:c("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!C.isCurrentMonth&&(I?"text-[#4B5563]":"text-gray-300"),C.isCurrentMonth&&(I?"text-white":"text-gray-900"),fe&&"ring-2 ring-[#00E5CC]",De&&"bg-[#00E5CC] text-white",se&&!De&&"bg-[#7C3AED] text-white",lt&&!ut&&(I?"bg-[#7C3AED]/20":"bg-purple-100"),!ut&&(I?"hover:bg-white/10":"hover:bg-gray-100")),children:C.date.getDate()},$)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:c("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{_t(),te(!z);},className:c("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",B.priority==="high"||B.priority==="urgent"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":B.priority==="low"?"bg-green-500/20 text-green-400":I?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.priority?B.priority==="high"||B.priority==="urgent"?o==="es"?"Alta":"High":B.priority==="medium"?o==="es"?"Media":"Medium":o==="es"?"Baja":"Low":o==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:z&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>te(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:o==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:o==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:o==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:o==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:o==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(C=>jsxs("button",{onClick:()=>{Wt("priority",C.id),te(false);},className:c("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",I?"hover:bg-white/5":"hover:bg-gray-50",B.priority===C.id&&(I?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:c("w-2 h-2 rounded-full",C.color)}),jsx("span",{className:I?"text-white":"text-gray-900",children:C.label})]},C.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:c("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:c("text-sm",I?"text-white":"text-gray-900"),children:B.startDate&&B.endDate?`${Math.ceil((B.endDate.getTime()-B.startDate.getTime())/(1e3*60*60*24))} ${o==="es"?"d\xEDas":"days"}`:o==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:c("w-4 h-4 rounded-full border-2",I?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[be?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:B.progress||0,onChange:C=>{let $=parseInt(C.target.value),fe=B.status;$===100?fe="completed":$>0?fe="in-progress":fe="todo";let De={...B,progress:$,status:fe};Bt(De);},onBlur:()=>pt(false),className:c("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",I?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#00E5CC] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>pt(true),className:c("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",I?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:c("h-full rounded-full transition-all",B.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${B.progress||0}%`}})}),jsxs("span",{className:c("text-sm font-medium min-w-[40px]",I?"text-white":"text-gray-900"),children:[B.progress||0,"%"]})]})]}),x&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:c("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:B.status==="completed"||B.progress===100?jsx("span",{className:c("text-sm px-2 py-0.5 cursor-not-allowed",I?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:w?.estimateMinutes?Un(w.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsx("button",{type:"button",onClick:()=>zt("estimate"),className:c("text-sm px-2 py-0.5 rounded",I?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Un(w.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>zt("estimate"),className:c("text-sm",I?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:ot==="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(bo,{mode:"estimate",locale:o,isDark:I,currentValue:w?.estimateMinutes||null,onSave:async C=>{await E?.(B.id,C),zt(false);},onClose:()=>zt(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:c("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:ee?jsx("span",{className:c("text-sm select-none blur-[4px] opacity-60 pointer-events-none",I?"text-[#94A3B8]":"text-gray-500"),title:o==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):B.status==="completed"||B.progress===100?jsx("span",{className:c("text-sm px-2 py-0.5 cursor-not-allowed",I?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:B.quotedMinutes?Un(B.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):B.quotedMinutes?jsx("button",{type:"button",onClick:()=>zt("quoted"),className:c("text-sm px-2 py-0.5 rounded",I?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Un(B.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>zt("quoted"),className:c("text-sm",I?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:ot==="quoted"&&!ee&&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(bo,{mode:"quoted",locale:o,isDark:I,currentValue:B.quotedMinutes||null,onSave:async C=>{P?(await P(B.id,C),X$1($=>$?{...$,quotedMinutes:C}:null)):Wt("quotedMinutes",C),zt(false);},onClose:()=>zt(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:c("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[B.status==="completed"||B.progress===100?jsx("div",{className:c("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",I?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):D?jsxs("button",{type:"button",onClick:()=>K?.(B.id),className:c("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"}),Sh(A||0)]}):jsx("button",{type:"button",onClick:()=>k?.(B.id),className:c("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",I?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:o==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),B.status==="completed"||B.progress===100?jsxs("div",{className:c("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",I?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>zt("log"),className:c("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",I?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}),w&&w.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:c("text-sm font-medium",w.health==="over-budget"?"text-red-500":w.health==="at-risk"?"text-yellow-500":I?"text-white":"text-gray-900"),children:[Un(w.loggedMinutes),w.estimateMinutes&&jsxs("span",{className:c("font-normal",I?"text-[#6B7280]":"text-gray-400"),children:[" / ",Un(w.estimateMinutes)]})]}),w.health!=="no-estimate"&&jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsx("div",{className:c("h-full rounded-full transition-all",w.health==="over-budget"?"bg-red-500":w.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,w.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:ot==="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(bo,{mode:"log",locale:o,isDark:I,currentValue:null,onSave:async(C,$)=>{C&&await T?.(B.id,{durationMinutes:C,note:$,source:"manual"}),zt(false);},onClose:()=>zt(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:c("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Etiquetas":"Tags"}),jsx(Wo,{selectedTags:B.tags||[],availableTags:d,onChange:C=>{Wt("tags",C);},onCreateTag:i,theme:Y})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:c("w-4 h-4 mt-1.5",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0 mt-1",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[B.dependencies&&B.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:B.dependencies.map(C=>{let $=g.find(fe=>fe.id===C);return jsxs("span",{className:c("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",I?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:[$?.name||C.slice(0,8),jsx("button",{onClick:()=>{let fe=(B.dependencies||[]).filter(De=>De!==C);Wt("dependencies",fe);},className:c("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},C)})}),jsxs("button",{onClick:()=>{_t(),Ue(!Ke);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",I?"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:c("text-sm",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:Ke&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ue(false),Ht("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:c("p-2 border-b",I?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:kt,onChange:C=>Ht(C.target.value),placeholder:o==="es"?"Buscar tarea...":"Search task...",className:c("w-full px-3 py-2 rounded-md text-sm outline-none",I?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:g.length>0?g.filter(C=>C.id!==B.id).filter(C=>kt===""||C.name.toLowerCase().includes(kt.toLowerCase())).map(C=>{let $=B.dependencies?.includes(C.id);return jsxs("button",{onClick:()=>{let fe=B.dependencies||[],De;$?De=fe.filter(se=>se!==C.id):De=[...fe,C.id],Wt("dependencies",De);},className:c("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",I?"hover:bg-white/5":"hover:bg-gray-50",$&&(I?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:c("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",$?"bg-[#00E5CC] border-[#00E5CC]":I?"border-white/30":"border-gray-300"),children:$&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:c("block truncate",I?"text-white":"text-gray-900"),children:C.name}),jsx("span",{className:c("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:C.id.slice(0,8)})]})]},C.id)}):jsx("div",{className:c("px-3 py-4 text-sm text-center",I?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:c("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{_t(),We(!qe);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:B.color||"#6366F1"}}),jsx("span",{className:c("text-sm",I?"text-white":"text-gray-900"),children:fn.find(C=>C.value===B.color)?.name||(o==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:c("w-3 h-3",I?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:qe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>We(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:fn.map(C=>{let $=B.color===C.value;return jsx("button",{onClick:()=>{Wt("color",C.value),We(false);},className:c("w-7 h-7 rounded-full flex items-center justify-center transition-all",$&&"ring-2 ring-offset-2",I?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:C.value,outlineColor:$?C.value:void 0},title:C.name,children:$&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},C.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:c("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:B.isMilestone||false,onChange:C=>Wt("isMilestone",C.target.checked),className:c("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",B.isMilestone?"bg-purple-500 border-purple-500":I?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:c("text-sm",I?"text-white":"text-gray-900"),children:o==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:c("mt-6 pt-4 border-t",I?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:c("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:c("text-sm font-semibold",I?"text-white":"text-gray-900"),children:o==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:Z,value:R,onChange:C=>da(C.target.value),placeholder:o==="es"?"Agregar descripci\xF3n...":"Add description...",className:c("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",I?"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:c("mt-6 pt-4 border-t",I?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:c("text-sm font-semibold",I?"text-white":"text-gray-900"),children:[o==="es"?"Subtareas":"Subtasks",B.subtasks&&B.subtasks.length>0&&jsxs("span",{className:c("ml-2 text-xs font-normal",I?"text-[#6B7280]":"text-gray-400"),children:["(",B.subtasks.filter(C=>C.progress===100).length,"/",B.subtasks.length,")"]})]})}),B.subtasks&&B.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...B.subtasks].sort((C,$)=>(C.position??0)-($.position??0)).map(C=>jsxs("div",{className:c("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",I?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>pa(C.id),className:c("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",C.progress===100?"bg-green-500 border-green-500":I?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:C.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:c("text-sm flex-1",C.progress===100?"line-through text-[#6B7280]":I?"text-white":"text-gray-900"),children:C.name}),jsx("button",{onClick:()=>ce(C.id),className:c("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",I?"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"})})]},C.id))}),Ut?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:jt,onChange:C=>St(C.target.value),onKeyDown:C=>{C.key==="Enter"&&jt.trim()?Tt():C.key==="Escape"&&(gt(false),St(""));},placeholder:o==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:c("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",I?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-[#00E5CC]/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-[#00E5CC]")}),jsx("button",{onClick:Tt,disabled:!jt.trim(),className:c("px-3 py-2 rounded-lg text-sm font-medium transition-colors",jt.trim()?"bg-[#00E5CC] hover:bg-[#00C4AE] text-white":I?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:o==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{gt(false),St("");},className:c("p-2 rounded-lg transition-colors",I?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>gt(true),className:c("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),o==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:c("mt-6 pt-4 border-t",I?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:c("text-sm font-semibold mb-3",I?"text-white":"text-gray-900"),children:[o==="es"?"Adjuntos":"Attachments",u.length>0&&jsxs("span",{className:c("ml-2 text-xs font-normal",I?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsx("div",{className:"space-y-2 mb-4",children:u.map(C=>{let $=Le(C.type),fe=C.type.startsWith("image/");return jsxs("div",{className:c("flex items-center gap-3 p-2 rounded-lg group transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[fe&&C.thumbnailUrl?jsx("img",{src:C.thumbnailUrl,alt:C.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:c("w-10 h-10 rounded flex items-center justify-center",I?"bg-white/10":"bg-gray-200"),children:jsx($,{className:c("w-5 h-5",I?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:C.url,target:"_blank",rel:"noopener noreferrer",className:c("text-sm font-medium truncate block hover:underline",I?"text-white":"text-gray-900"),children:C.name}),jsx("p",{className:c("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:oe(C.size)})]}),p&&jsx("button",{onClick:()=>p(C.id),className:c("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",I?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:o==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},C.id)})}),jsxs("div",{onDragOver:ae,onDragLeave:U,onDrop:_,className:c("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Ee?I?"border-[#00E5CC] bg-[#00E5CC]/10":"border-[#00E5CC] bg-[#00E5CC]/15":I?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",F&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:ge,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!m||F}),F?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-[#00E5CC] border-t-transparent rounded-full animate-spin"}),jsx("p",{className:c("text-sm",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:c("w-6 h-6 mx-auto mb-2",Ee?"text-[#00E5CC]":I?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:c("text-sm",I?"text-[#9CA3AF]":"text-gray-500"),children:Ee?o==="es"?"Suelta los archivos aqu\xED":"Drop files here":o==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!m&&jsx("p",{className:c("text-xs mt-1",I?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:c("w-96 border-l flex flex-col",I?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:c("px-4 py-3 border-b flex items-center justify-between h-[49px]",I?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:c("text-sm font-semibold",I?"text-white":"text-gray-900"),children:[o==="es"?"Actividad":"Activity",f.length>0&&jsxs("span",{className:c("ml-2 text-xs font-normal",I?"text-[#6B7280]":"text-gray-400"),children:["(",f.length,")"]})]}),jsx("button",{onClick:a,className:c("p-1.5 rounded transition-colors",I?"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 vb from'html2canvas';import {createPortal}from'react-dom';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {AnimatePresence,motion}from'framer-motion';import {CheckCircle2,PlayCircle,Circle,Copy,Scissors,Settings,Eye,EyeOff,ArrowDown,ArrowUp,ArrowUpDown,BarChart3,Link2,Minus,Plus,Trash2,Pencil,Edit3,AlertTriangle,CheckSquare,ChevronDown,Calendar,Hash,Type,BarChart,Users,CalendarClock,FileText,Timer,Clock,Tag,CalendarCheck,Flag,CircleDot,Moon,Sun,Palette,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,File,User,Check,CalendarDays,X,Hourglass,Play,Square,Diamond,Upload,MessageSquare,Layers,Filter,Zap,GitBranch,FileImage,FileSpreadsheet,FolderKanban,Share2,Download,ChevronLeft,GripVertical,Smile,Paperclip,Send,FileJson,AlertCircle,Milestone,List,Search,PanelRight,FolderOpen,Folder,Info,Target,DollarSign,Loader2}from'lucide-react';import {Command}from'cmdk';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart as BarChart$1,Bar}from'recharts';import {toPng}from'html-to-image';var fi=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var bi=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:r}=e;return "translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:r}=e;return "scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return [bi.Translate.toString(e),bi.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:a}=e;return t+" "+r+"ms "+a}}});function g(...e){return twMerge(clsx(e))}function hi(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 fb(e){return Array.from({length:e},(t,r)=>(r+1)*1e3)}function ql(e,t){return e.length===0?1e3:t===0?hi(null,e[0].position):t>=e.length?hi(e[e.length-1].position,null):hi(e[t-1].position,e[t].position)}function Eu(e,t=100){return e>t}var bb=e=>{if(e.message.includes("network")||e.message.includes("fetch"))return true;if("status"in e){let t=e.status;return t>=500||t===429}return false};function hb(e,t,r,a){let n=t*Math.pow(r,e-1),s=n*.2*Math.random();return Math.min(n+s,a)}async function yi(e,t={}){let{maxAttempts:r=3,initialDelay:a=1e3,backoffMultiplier:n=2,maxDelay:s=1e4,shouldRetry:o=bb,onRetry:c}=t,l,i=0;for(let d=1;d<=r;d++){i=d;try{return {data:await e(),attempts:i,success:!0}}catch(u){if(l=u,d===r||!o(l,d))return {error:l,attempts:i,success:false};let m=hb(d,a,n,s);if(c)try{c(l,d,m);}catch(f){console.error("Error in retry callback:",f);}await new Promise(f=>setTimeout(f,m));}}return {error:l||new Error("Unknown error"),attempts:i,success:false}}function yb(e,t=3){let r;for(let a=1;a<=t;a++)try{return {data:e(),success:!0}}catch(n){if(r=n,a===t)return {error:r,success:false}}return {error:r||new Error("Unknown error"),success:false}}function xb(e,t={}){return async(...r)=>yi(()=>e(...r),t)}var Yl=class{constructor(t=5,r=6e4){this.threshold=t;this.resetTimeout=r;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 r=await t();return this.onSuccess(),r}catch(r){throw this.onFailure(),r}}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 Mu=(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))(Mu||{}),bo=class bo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:r,level:a,message:n,component:s,...o}=t,c=`[${r}] [${a}] [${s}]`,l=Object.keys(o).length>0;switch(a){case "DEBUG":console.debug(c,n,l?o:"");break;case "INFO":console.info(c,n,l?o:"");break;case "WARN":console.warn(c,n,l?o:"");break;case "ERROR":console.error(c,n,l?o:""),t.error?.stack&&console.error(t.error.stack);break}};let r=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(r?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...bo.globalOptions};}static configure(t){bo.globalOptions={...bo.globalOptions,...t};}child(t){return new bo({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,r){this.log(0,t,r);}info(t,r){this.log(1,t,r);}warn(t,r){this.log(2,t,r);}error(t,r,a){this.log(3,t,{...a,error:r?{message:r.message,stack:r.stack,name:r.name}:void 0});}startTimer(t){return this.options.enableTiming?new xi((r,a)=>{this.log(0,`${t} completed`,{...a,action:t,duration:r});},true):new xi(()=>{},false)}log(t,r,a){if(!this.options.enabled||t<this.options.minLevel)return;let n={timestamp:new Date().toISOString(),level:Mu[t],message:r,component:this.options.componentName,...a};this.options.onLog(n);}};bo.globalOptions={};var Xl=bo,xi=class{constructor(t,r){this.onEnd=t;this.enabled=r;this.startTime=r?performance.now():0;}end(t){if(!this.enabled)return 0;let r=Math.round(performance.now()-this.startTime);return this.onEnd(r,t),r}elapsed(){return this.enabled?Math.round(performance.now()-this.startTime):0}},Pu=new Xl;function wb(e,t){let r={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(r,null,2)}function kb(e,t){let r=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],a=e.cards.map(s=>{let o=e.columns.find(c=>c.id===s.columnId);return [s.id,Jl(s.title),Jl(s.description||""),Jl(o?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [r.join(","),...a.map(s=>s.join(","))].join(`
2
+ `)}async function Cb(e,t,r){let a=t;if(!a){let o=document.querySelector(".asakaa-board");o&&(a=o.parentElement||o);}if(a)try{let o=await vb(a,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:a.scrollWidth,windowHeight:a.scrollHeight}),c=o.toDataURL("image/png"),l=297,i=210,d=o.width/o.height,u=l-20,p=u/d;p>i-20&&(p=i-20,u=p*d);let m=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});m.setFontSize(16),m.setTextColor(255,255,255),m.setFillColor(10,10,10),m.rect(0,0,l,15,"F"),m.text(e.title||"Kanban Board",10,10);let f=(l-u)/2;return m.addImage(c,"PNG",f,20,u,p),m}catch(o){console.error("Error capturing board:",o);}let n=new jsPDF,s=20;return n.setFontSize(20),n.text(e.title||"Kanban Board",20,s),s+=10,n.setFontSize(10),n.setTextColor(128,128,128),n.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,n.setTextColor(0,0,0),e.columns.forEach(o=>{let c=e.cards.filter(l=>l.columnId===o.id);s>250&&(n.addPage(),s=20),n.setFontSize(16),n.setFont("helvetica","bold"),n.text(o.title,20,s),s+=8,c.length===0?(n.setFontSize(10),n.setFont("helvetica","italic"),n.setTextColor(128,128,128),n.text("No cards in this column",20,s),n.setTextColor(0,0,0),s+=10):c.forEach(l=>{if(s>260&&(n.addPage(),s=20),n.setFontSize(12),n.setFont("helvetica","bold"),n.text(l.title,25,s),s+=6,l.description){n.setFontSize(9),n.setFont("helvetica","normal");let d=n.splitTextToSize(l.description,160);n.text(d,25,s),s+=d.length*5;}let i=[];if(l.priority&&i.push(`Priority: ${l.priority}`),l.labels&&l.labels.length>0&&i.push(`Labels: ${l.labels.join(", ")}`),l.assignedUserIds&&l.assignedUserIds.length>0&&i.push(`Assigned: ${l.assignedUserIds.length} user(s)`),l.startDate||l.endDate){let d=[];l.startDate&&d.push(`Start: ${l.startDate}`),l.endDate&&d.push(`End: ${l.endDate}`),i.push(d.join(" \u2192 "));}i.length>0&&(n.setFontSize(8),n.setTextColor(100,100,100),n.text(i.join(" \u2022 "),25,s),n.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),n}function Jl(e){return e.includes(",")||e.includes('"')||e.includes(`
3
+ `)?`"${e.replace(/"/g,'""')}"`:e}async function Lu(e,t,r,a){switch(t){case "json":return wb(e,a);case "csv":return kb(e);case "pdf":return await Cb(e,r);default:throw new Error(`Unsupported export format: ${t}`)}}function Au(e,t,r){let a=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let d=`${a}.pdf`;e.save(d);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${a}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,o={json:"application/json",csv:"text/csv",pdf:"application/pdf"},c=new Blob([e],{type:o[t]}),l=URL.createObjectURL(c),i=document.createElement("a");i.href=l,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(l);}function Tb(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 r={id:t.board.id,title:t.board.title,columns:t.columns,cards:t.cards,metadata:t.board.metadata};return {success:!0,cardsImported:r.cards.length,columnsImported:r.columns.length}}catch(t){return {success:false,errors:[`Failed to parse JSON: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Nb(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 r=Iu(t[0]),a=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let c=Iu(t[o]||"");if(c.length>r.length){s.push(`Line ${o+1}: Too many columns`);continue}if(r.length-c.length>3){s.push(`Line ${o+1}: Column count mismatch (expected ${r.length}, got ${c.length})`);continue}for(;c.length<r.length;)c.push("");let i={};r.forEach((m,f)=>{i[m]=c[f]||"";});let d=i.Column||"Unnamed";n.has(d)||n.set(d,{id:`col-${n.size+1}`,title:d,position:n.size+1,cardIds:[]});let u=n.get(d),p={id:i["Card ID"]||`card-${o}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:u.id,position:u.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};a.push(p),u.cardIds.push(p.id);}catch(c){s.push(`Line ${o+1}: ${c instanceof Error?c.message:"Unknown error"}`);}return a.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:a.length,columnsImported:n.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Iu(e){let t=[],r="",a=false;for(let n=0;n<e.length;n++){let s=e[n],o=e[n+1];s==='"'&&a&&o==='"'?(r+='"',n++):s==='"'?a=!a:s===","&&!a?(t.push(r),r=""):r+=s;}return t.push(r),t}function Ru(e,t){switch(t){case "json":return Tb(e);case "csv":return Nb(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Bu(e){return new Promise((t,r)=>{let a=new FileReader;a.onload=n=>{n.target?.result?t(n.target.result):r(new Error("Failed to read file"));},a.onerror=()=>r(new Error("Failed to read file")),a.readAsText(e);})}var Ql=createContext(null);function $u(){return useContext(Ql)}var Ou=createContext(null);function Hu({children:e,themeName:t}){return jsx(Ou.Provider,{value:{themeName:t},children:e})}function vi(){return useContext(Ou)}function lr({children:e,container:t}){let[r,a]=useState(false),n=$u(),s=vi();if(useEffect(()=>(a(true),()=>a(false)),[]),!r)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:c,themeName:l}=n,i={"--asakaa-color-background-primary":c.bgPrimary,"--asakaa-color-background-secondary":c.bgSecondary,"--asakaa-color-background-card":c.bgGrid,"--asakaa-color-background-hover":c.hoverBg,"--asakaa-color-text-primary":c.textPrimary,"--asakaa-color-text-secondary":c.textSecondary,"--asakaa-color-text-tertiary":c.textTertiary,"--asakaa-color-text-inverse":c.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":c.border,"--asakaa-color-border-hover":c.borderLight,"--asakaa-color-border-subtle":c.borderLight,"--asakaa-color-interactive-primary":c.accent,"--asakaa-color-interactive-primaryHover":c.accentHover,"--asakaa-color-interactive-primaryBorder":`${c.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${c.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${c.accent}33`,"--asakaa-color-status-success":c.statusCompleted,"--asakaa-color-status-warning":c.milestone,"--asakaa-color-status-error":c.criticalPath,"--asakaa-color-danger":c.criticalPath,"--asakaa-color-danger-border":`${c.criticalPath}4D`,"--asakaa-color-danger-background":`${c.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${c.criticalPath}26`};return createPortal(jsx("div",{"data-theme":l,"data-gantt-portal":"true",style:i,children:e}),o)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),o):createPortal(e,o)}var Vu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Ab="#BDC3C7",Ib=({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 ho({priority:e,onChange:t,className:r}){let[a,n]=useState(false),[s,o]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),i=()=>{if(!l.current)return;let m=l.current.getBoundingClientRect(),f=window.innerHeight,x=window.innerWidth,y=160,b=220,h=4,v=m.right-y;v<10&&(v=m.left),v+y>x-10&&(v=x-y-10);let w=f-m.bottom,T=m.top,E;w>=b+h?E=m.bottom+h:T>=b+h?E=m.top-b-h:E=w>=T?m.bottom+h:Math.max(10,m.top-b-h),o({top:E,left:v}),n(true);};useEffect(()=>{let m=f=>{c.current&&!c.current.contains(f.target)&&!l.current?.contains(f.target)&&n(false);};if(a)return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[a]),useEffect(()=>{let m=f=>{f.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[a]);let d=m=>{t(m),n(false);},u=e?Vu[e]:null,p=u?.color||Ab;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:l,onClick:()=>a?n(false):i(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${p}10`:"transparent",boxShadow:e?`0 0 0 2px ${p}30 inset`:"none"},title:u?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:p,fillOpacity:e?"0.6":"0.4"})})}),a&&jsx(lr,{children:jsxs("div",{ref:c,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(Vu).map(([m,f])=>jsxs("button",{onClick:()=>d(m),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:f.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx(Ib,{color:f.color}),jsx("span",{className:"font-semibold text-sm",children:f.label}),e===m&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},m)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>d(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:m=>{m.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:m=>{m.currentTarget.style.background="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Rb=[{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 Ds({startDate:e,endDate:t,onChange:r,className:a}){let[n,s]=useState(false),[o,c]=useState({top:0,left:0}),l=useRef(null),i=useRef(null),p=(vi()?.themeName||"dark")==="dark",m=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),w=window.innerHeight,T=window.innerWidth,E=320,F=380,k=4,D=v.left;D+E>T-10&&(D=T-E-10),D<10&&(D=10);let P=w-v.bottom,N=v.top,K;P>=F+k?K=v.bottom+k:N>=F+k?K=v.top-F-k:K=P>=N?v.bottom+k:Math.max(10,v.top-F-k),c({top:K,left:D}),s(true);};useEffect(()=>{let v=w=>{l.current&&!l.current.contains(w.target)&&!i.current?.contains(w.target)&&s(false);};if(n)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[n]),useEffect(()=>{let v=w=>{w.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[n]);let f=v=>{let w=new Date,T=D=>{let P=D.getFullYear(),N=String(D.getMonth()+1).padStart(2,"0"),K=String(D.getDate()).padStart(2,"0");return `${P}-${N}-${K}`},E=T(w),F=new Date(w);F.setDate(F.getDate()+v);let k=T(F);r(E,k),s(false);},x=()=>{if(!e||!t)return "Set date";let v=F=>{if(F instanceof Date)return F;if(typeof F!="string"||!F.match(/^\d{4}-\d{2}-\d{2}$/))return null;let k=F.split("-").map(Number);if(k.length!==3||k.some(K=>isNaN(K)))return null;let D=k[0],P=k[1],N=k[2];return D===void 0||P===void 0||N===void 0?null:new Date(D,P-1,N)},w=v(e),T=v(t);if(!w||!T||isNaN(w.getTime())||isNaN(T.getTime()))return "Set date";let E=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${E[w.getMonth()]} ${w.getDate()} \u2013 ${E[T.getMonth()]} ${T.getDate()}`},y=e&&t,h=(()=>{if(!t)return false;let v=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),v<w})();return jsxs("div",{className:`relative ${a||""}`,children:[jsxs("button",{ref:i,onClick:()=>n?s(false):m(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:y?`${x()}`:"Set date range",children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsx("span",{className:"whitespace-nowrap",children:x()})]}),n&&jsx(lr,{children:jsxs("div",{ref:l,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${o.top}px`,left:`${o.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:Rb.map(v=>jsx("button",{onClick:()=>f(v.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:w=>{w.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:v.label},v.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:v=>r(v.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:v=>r(e,v.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:()=>{r(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function xo({assignedUsers:e=[],availableUsers:t,onChange:r,className:a,maxVisibleAvatars:n=3}){let[s,o]=useState(false),[c,l]=useState(""),[i,d]=useState({top:0,left:0}),u=useRef(null),p=useRef(null),m=()=>{if(!p.current)return;let h=p.current.getBoundingClientRect(),v=window.innerHeight,w=window.innerWidth,T=300,E=380,F=4,k=h.right-T;k<10&&(k=h.left),k+T>w-10&&(k=w-T-10);let D=v-h.bottom,P=h.top,N;D>=E+F?N=h.bottom+F:P>=E+F?N=h.top-E-F:N=D>=P?h.bottom+F:Math.max(10,h.top-E-F),d({top:N,left:k}),o(true);};useEffect(()=>{let h=v=>{u.current&&!u.current.contains(v.target)&&!p.current?.contains(v.target)&&(o(false),l(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),useEffect(()=>{let h=v=>{v.key==="Escape"&&(o(false),l(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let f=h=>{let v=e.some(w=>w.id===h.id);r(v?e.filter(w=>w.id!==h.id):[...e,h]);},x=t.filter(h=>h.name.toLowerCase().includes(c.toLowerCase())),y=e.slice(0,n),b=e.length-n;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:p,onClick:()=>s?o(false):m(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxs("div",{className:"asakaa-avatar-group",children:[y.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)),b>0&&jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsx(lr,{children:jsxs("div",{ref:u,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:c,onChange:h=>l(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:x.length===0?jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):x.map(h=>{let v=e.some(w=>w.id===h.id);return jsxs("button",{onClick:()=>f(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:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor: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:v?"#00E5CC":"transparent"},children:v?"\u2713":""})]},h.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{r([]),o(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function wi(e,t,r){let a=new Map;e.forEach(l=>{if(l.dependencies&&Array.isArray(l.dependencies)){let i=l.dependencies.map(d=>{if(typeof d=="string")return d;let u=d;return u.taskId||u.targetId||""}).filter(Boolean);a.set(l.id,i);}});let n=a.get(r)||[];a.set(r,[...n,t]);let s=new Set,o=new Set,c=l=>{if(!s.has(l)){s.add(l),o.add(l);let i=a.get(l)||[];for(let d of i){if(!s.has(d)&&c(d))return true;if(o.has(d))return true}}return o.delete(l),false};return c(r)}function Es({currentCardId:e,dependencies:t=[],availableTasks:r,onChange:a,className:n,validateCircular:s=true,onCircularDependencyError:o}){let[c,l]=useState(false),[i,d]=useState(""),[u,p]=useState(t.length>0),[m,f]=useState({top:0,left:0}),[x,y]=useState(null),b=useRef(null),h=useRef(null),v=()=>{if(!h.current)return;let k=h.current.getBoundingClientRect(),D=window.innerHeight,P=window.innerWidth,N=300,K=u?380:120,H=4,te=k.right-N;te<10&&(te=k.left),te+N>P-10&&(te=P-N-10);let I=D-k.bottom,_=k.top,j;I>=K+H?j=k.bottom+H:_>=K+H?j=k.top-K-H:j=I>=_?k.bottom+H:Math.max(10,k.top-K-H),f({top:j,left:te}),l(true);};useEffect(()=>{if(!c||!h.current)return;let k=h.current.getBoundingClientRect(),D=window.innerHeight,P=window.innerWidth,N=300,K=u?380:120,H=4,te=k.right-N;te<10&&(te=k.left),te+N>P-10&&(te=P-N-10);let I=D-k.bottom,_=k.top,j;I>=K+H?j=k.bottom+H:_>=K+H?j=k.top-K-H:j=I>=_?k.bottom+H:Math.max(10,k.top-K-H),f({top:j,left:te});},[u,c]),useEffect(()=>{let k=D=>{b.current&&!b.current.contains(D.target)&&!h.current?.contains(D.target)&&(l(false),d(""));};if(c)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[c]),useEffect(()=>{let k=D=>{D.key==="Escape"&&(l(false),d(""));};if(c)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[c]);let w=k=>{let D=t.includes(k),P=r.find(N=>N.id===k);if(y(null),D){let N=t.filter(K=>K!==k);a(N),N.length===0&&p(false);}else {if(s&&wi(r,k,e)){let K=`Cannot add "${P?.title||k}" as dependency - would create circular reference`;y(K),o?.(k,P?.title||k),setTimeout(()=>y(null),3e3);return}a([...t,k]),p(true);}},T=()=>{let k=!u;p(k),k||a([]);},E=r.filter(k=>k.id!==e).filter(k=>k.title.toLowerCase().includes(i.toLowerCase())||k.id.toLowerCase().includes(i.toLowerCase())),F=t.length>0?"#00E5CC":"#BDC3C7";return jsxs("div",{className:`relative ${n||""}`,children:[jsxs("button",{ref:h,onClick:()=>c?l(false):v(),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:F,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:F},children:t.length})]}),c&&jsx(lr,{children:jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${m.top}px`,left:`${m.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[x&&jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:x})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:T,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:u?"#00E5CC":"transparent",borderColor:u?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:u&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),u&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:i,onChange:k=>d(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:E.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"}):E.map(k=>{let D=t.includes(k.id);return jsxs("button",{onClick:()=>w(k.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:P=>{P.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:P=>{P.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:D?"#00E5CC":"transparent",borderColor:D?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:D&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children: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:()=>{a([]),p(false),l(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 Ln=memo(({card:e,render:t,onClick:r,isSelected:a,disableDrag:n,className:s,onUpdate:o,availableUsers:c=[],allCards:l=[]})=>{let{attributes:i,listeners:d,setNodeRef:u,transform:p,transition:m,isDragging:f}=useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),x={transform:bi.Transform.toString(p),transition:m};if(t)return jsx("div",{ref:u,style:x,...i,...d,onClick:()=>r?.(e),children:t(e)});let y=c.filter(w=>e.assignedUserIds?.includes(w.id)),b=e.progress===100,h=(e.attachments||[]).filter(w=>w.type.startsWith("image/")),v={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:u,style:v,className:g("asakaa-card",f&&"asakaa-card-dragging",a&&"ring-2 ring-asakaa-accent-blue",s),...i,...d,onClick:w=>{w.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||r?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:w=>{w.currentTarget.style.display="none";}})}),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:w=>{w.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((w,T)=>jsxs("div",{className:"relative",children:[jsx("img",{src:w.url,alt:w.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:E=>{E.currentTarget.style.display="none";}}),T===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]})})]},w.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.6:1},children:e.title}),e.description&&jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsx("div",{onClick:w=>w.stopPropagation(),className:"priority-selector",children:jsx(ho,{priority:e.priority,onChange:w=>o?.(e.id,{priority:w})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsx(Ds,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(w,T)=>o?.(e.id,{startDate:w,endDate:T})})}),c.length>0&&jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsx(xo,{assignedUsers:y,availableUsers:c,onChange:w=>o?.(e.id,{assignedUserIds:w.map(T=>T.id)})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsx(Es,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(w=>typeof w=="string"?w:w.taskId):[],availableTasks:l,onChange:w=>o?.(e.id,{dependencies:w})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(w=>jsx("span",{className:"asakaa-label",children:w},w))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#00E5CC"},children:[Math.round(e.progress),"%"]})]}),jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#00E5CC"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(r=>r.id))===JSON.stringify(t.card.attachments?.map(r=>r.id)));Ln.displayName="Card";var ki={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},ep=({icon:e,color:t})=>e==="circle"?jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function tp({status:e="todo",onChange:t,className:r,customStatuses:a=[]}){let[n,s]=useState(false),[o,c]=useState({top:0,left:0}),l=useRef(null),i=useRef(null),d=[...Object.entries(ki).map(([y,b])=>({id:y,label:b.label,color:b.color,icon:b.icon})),...a.filter(y=>!Object.keys(ki).includes(y.id)).map(y=>({id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}))],u=()=>{let y=ki[e];if(y)return {...y,id:e};let b=a.find(h=>h.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...ki.todo,id:"todo"}},p=()=>{if(!i.current)return;let y=i.current.getBoundingClientRect(),b=window.innerHeight,h=window.innerWidth,v=180,w=280,T=4,E=y.right-v;E<10&&(E=y.left),E+v>h-10&&(E=h-v-10);let F=b-y.bottom,k=y.top,D;F>=w+T?D=y.bottom+T:k>=w+T?D=y.top-w-T:D=F>=k?y.bottom+T:Math.max(10,y.top-w-T),c({top:D,left:E}),s(true);};useEffect(()=>{let y=b=>{l.current&&!l.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(n)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[n]),useEffect(()=>{let y=b=>{b.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[n]);let m=y=>{t(y),s(false);},f=u(),x=f.color;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:i,onClick:()=>n?s(false):p(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${x}10`,boxShadow:`0 0 0 2px ${x}30 inset`},title:f.label,children:jsx(ep,{icon:f.icon,color:x})}),n&&jsx(lr,{children:jsxs("div",{ref:l,className:"status-selector-menu",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:d.map(y=>jsxs("button",{onClick:()=>m(y.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:y.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsx(ep,{icon:y.icon,color:y.color}),jsx("span",{className:"font-semibold",children:y.label}),e===y.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},y.id))})]})})]})}var rp={en:{renameColumn:"Rename Column",rename:"Rename",delete:"Delete",columnName:"Column name",columnOptions:"Column options"},es:{renameColumn:"Renombrar Columna",rename:"Renombrar",delete:"Eliminar",columnName:"Nombre de columna",columnOptions:"Opciones de columna"}};function ap({columnTitle:e,onRename:t,onDelete:r,isDeletable:a=false,className:n,locale:s="en"}){let o=rp[s]||rp.en,[c,l]=useState(false),[i,d]=useState(false),[u,p]=useState(e),[m,f]=useState({top:0,left:0}),x=useRef(null),y=useRef(null),b=useRef(null);useEffect(()=>{if(c&&y.current){let T=y.current.getBoundingClientRect();f({top:T.bottom+window.scrollY+8,left:T.left+window.scrollX});}},[c]),useEffect(()=>{let T=E=>{x.current&&!x.current.contains(E.target)&&!y.current?.contains(E.target)&&(l(false),d(false));};if(c)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[c]),useEffect(()=>{let T=E=>{E.key==="Escape"&&(l(false),d(false),p(e));};if(c)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[c,e]),useEffect(()=>{i&&b.current&&(b.current.focus(),b.current.select());},[i]);let h=()=>{d(true),p(e);},v=()=>{let T=u.trim();T&&T!==e&&t(T),d(false),l(false),p(e);},w=T=>{T.key==="Enter"?v():T.key==="Escape"&&(d(false),p(e));};return jsxs("div",{className:`relative ${n||""}`,children:[jsx("button",{ref:y,onClick:()=>l(!c),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:o.columnOptions,"aria-label":o.columnOptions,children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),c&&jsx(lr,{children:jsx("div",{ref:x,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${m.top}px`,left:`${m.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:i?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:o.renameColumn}),jsx("input",{ref:b,type:"text",value:u,onChange:T=>p(T.target.value),onKeyDown:w,onBlur:v,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-[#00E5CC]/50 transition-all",placeholder:o.columnName,maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:h,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-medium",children:o.rename})]}),a&&r&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{r(),l(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:o.delete})]})]})]})})})]})}var Vo=memo(({column:e,cards:t,renderColumn:r,renderCard:a,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:c,availableUsers:l,allCards:i,enableVirtualization:d,cardHeight:u=120,isCollapsed:p,onToggleCollapse:m,onColumnRename:f,onColumnDelete:x,isDeletable:y=false,className:b,renderMetrics:h,locale:v})=>{let{setNodeRef:w,isOver:T}=useDroppable({id:e.id,data:{type:"column",column:e}}),E=useRef(null),F=d??Eu(t.length),k=useVirtualizer({count:t.length,getScrollElement:()=>E.current,estimateSize:()=>u,enabled:F});if(r)return jsx("div",{ref:w,className:b,children:r(e,t)});let P=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let H=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:H}:H>=80?{state:"warning",percentage:H}:H>=60?{state:"approaching",percentage:H}:{state:"ok",percentage:H}})(),N=P.state==="exceeded",K=()=>"asakaa-column-count";return jsxs("div",{ref:w,className:g("asakaa-column",T&&"ring-2 ring-asakaa-accent-blue",N&&"ring-2 ring-asakaa-accent-red",b),children:[n?n(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:g(K()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&P.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${P.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[P.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"})]}),P.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"})]}),P.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"})}),P.state==="ok"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(f||x)&&jsx(ap,{columnTitle:e.title,onRename:H=>f?.(e.id,H),onDelete:x?()=>x(e.id):void 0,isDeletable:y,locale:v}),m&&jsx("button",{onClick:m,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),h&&h(e,t),!p&&jsx("div",{ref:E,className:"asakaa-column-cards",style:{maxHeight:F?"600px":void 0},children:jsx(SortableContext,{items:t.map(H=>H.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"})}):F?jsx("div",{style:{height:`${k.getTotalSize()}px`,position:"relative"},children:k.getVirtualItems().map(H=>{let te=t[H.index];return te?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${H.start}px)`},children:jsx(Ln,{card:te,render:a,onClick:o,onUpdate:c,availableUsers:l,allCards:i})},te.id):null})}):t.map(H=>jsx(Ln,{card:H,render:a,onClick:o,onUpdate:c,availableUsers:l,allCards:i},H.id))})})]})});Vo.displayName="Column";function ac({title:e,onSave:t,className:r}){let[a,n]=useState(false),[s,o]=useState(e),c=useRef(null);useEffect(()=>{a&&c.current&&(c.current.focus(),c.current.select());},[a]);let l=()=>{let d=s.trim();d&&d!==e?t(d):o(e),n(false);},i=d=>{d.key==="Enter"?l():d.key==="Escape"&&(o(e),n(false));};return a?jsx("input",{ref:c,type:"text",value:s,onChange:d=>o(d.target.value),onBlur:l,onKeyDown:i,className:g("asakaa-column-title bg-transparent border-b-2 border-[#00E5CC]","outline-none px-1 -ml-1",r),maxLength:50}):jsx("h2",{className:g("asakaa-column-title cursor-pointer",r),onClick:()=>n(true),title:"Click to edit",children:e})}function th(e,t){let r=e.slice(0,t),a=r.lastIndexOf("@");if(a===-1)return null;let n=r[a-1];if(a>0&&n&&!/\s/.test(n))return null;let s=r.slice(a+1);return /\s/.test(s)?null:{start:a,end:t,query:s.toLowerCase()}}function cp(e,t){let r=[],a=/@(\S+)/g,n;for(;(n=a.exec(e))!==null;){let s=n[1]?.toLowerCase()??"";if(!s)continue;let o=t.find(c=>{let l=c.name.toLowerCase(),i=l.replace(/\s+/g,""),d=l.split(/\s+/);return !!(i===s||l===s||d.some(u=>u===s))});o&&!r.includes(o.id)&&r.push(o.id);}return r}function rh(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ah(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var nh=["\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 dp({value:e,onChange:t,onSubmit:r,users:a,placeholder:n,disabled:s=false,isSubmitting:o=false,theme:c="dark",locale:l="es",currentUser:i,enableEmoji:d=true,enableAttachments:u=true,pendingFiles:p=[],onFilesSelect:m,onRemoveFile:f,maxFileSizeMB:x=10}){let y=c==="dark",[b,h]=useState(false),[v,w]=useState([]),[T,E]=useState(0),[F,k]=useState(null),[D,P]=useState(false),N=useRef(null),K=useRef(null),H=useRef(null),te=useRef(null),I=useCallback((be,ge)=>{let ye=th(be,ge);if(k(ye),ye){let ze=a.filter(ke=>ke.name.toLowerCase().includes(ye.query)||ke.email&&ke.email.toLowerCase().includes(ye.query)).slice(0,5);w(ze),h(ze.length>0),E(0);}else h(false),w([]);},[a]),_=be=>{let ge=be.target.value;if(t(ge),I(ge,be.target.selectionStart||0),N.current){N.current.style.height="24px";let ye=N.current.scrollHeight,ze=280,ke=Math.min(ye,ze);N.current.style.height=`${ke}px`,N.current.style.overflowY=ye>ze?"auto":"hidden";}},j=()=>{N.current&&I(e,N.current.selectionStart||0);},W=useCallback(be=>{if(!F||!N.current)return;let ge=e.slice(0,F.start),ye=e.slice(F.end),ze=`@${be.name.replace(/\s+/g,"")} `,ke=ge+ze+ye;t(ke),h(false),k(null),setTimeout(()=>{if(N.current){let Ie=F.start+ze.length;N.current.selectionStart=Ie,N.current.selectionEnd=Ie,N.current.focus();}},0);},[F,e,t]),B=be=>{if(b&&v.length>0)switch(be.key){case "ArrowDown":be.preventDefault(),E(ge=>ge<v.length-1?ge+1:0);break;case "ArrowUp":be.preventDefault(),E(ge=>ge>0?ge-1:v.length-1);break;case "Enter":{be.preventDefault();let ge=v[T];ge&&W(ge);break}case "Tab":{be.preventDefault();let ge=v[T];ge&&W(ge);break}case "Escape":be.preventDefault(),h(false);break}else be.key==="Enter"&&!be.shiftKey&&(be.preventDefault(),r());};useEffect(()=>{let be=ge=>{K.current&&!K.current.contains(ge.target)&&N.current&&!N.current.contains(ge.target)&&h(false),te.current&&!te.current.contains(ge.target)&&P(false);};return document.addEventListener("mousedown",be),()=>document.removeEventListener("mousedown",be)},[]);let ve=useCallback(be=>{if(!N.current)return;let ge=N.current.selectionStart||e.length,ye=e.slice(0,ge)+be+e.slice(ge);t(ye),P(false),setTimeout(()=>{if(N.current){let ze=ge+be.length;N.current.selectionStart=ze,N.current.selectionEnd=ze,N.current.focus();}},0);},[e,t]),We=useCallback(be=>{if(!m||!be.target.files)return;let ge=Array.from(be.target.files),ye=x*1024*1024,ze=ge.filter(ke=>ke.size>ye?(console.warn(`File ${ke.name} exceeds max size of ${x}MB`),false):true);ze.length>0&&m(ze),be.target.value="";},[m,x]),Le=useCallback(be=>be.type.startsWith("image/")?Image:be.type.includes("pdf")||be.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(b&&K.current){let be=K.current.children[T];be&&be.scrollIntoView({block:"nearest"});}},[T,b]),jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:p.map(be=>{let ge=Le(be.file),ye=be.file.type.startsWith("image/");return jsxs("div",{className:g("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",y?"bg-white/10":"bg-gray-100"),children:[ye&&be.preview?jsx("img",{src:be.preview,alt:be.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(ge,{className:g("w-4 h-4",y?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:g("text-xs truncate",y?"text-white":"text-gray-900"),children:be.file.name}),jsx("p",{className:g("text-xs",y?"text-[#6B7280]":"text-gray-400"),children:ah(be.file.size)})]}),f&&jsx("button",{onClick:()=>f(be.id),className:g("p-0.5 rounded-full transition-colors",y?"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"})})]},be.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[i&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:g("flex-1 relative min-w-0"),children:[jsxs("div",{className:g("flex items-end gap-1 px-2 py-2 rounded-lg",y?"bg-white/5":"bg-white border border-gray-200"),children:[d&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>P(!D),disabled:s||o,className:g("p-1 rounded transition-colors flex-shrink-0",y?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:D&&jsx(motion.div,{ref:te,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:g("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",y?"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:nh.map(be=>jsx("button",{type:"button",onClick:()=>ve(be),className:g("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",y?"hover:bg-white/10":"hover:bg-gray-100"),children:be},be))})})})]}),u&&m&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>H.current?.click(),disabled:s||o,className:g("p-1.5 rounded transition-colors",y?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:l==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:H,type:"file",multiple:true,onChange:We,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:N,value:e,onChange:_,onSelect:j,onKeyDown:B,placeholder:n||(l==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||o,rows:1,className:g("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",y?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||o)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:r,disabled:o||!e.trim()&&p.length===0||s,className:g("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-[#00E5CC] text-white hover:bg-[#00C4AE]":y?"text-[#6B7280]":"text-gray-400",o&&"opacity-50 cursor-not-allowed"),children:o?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]}),jsx(AnimatePresence,{children:b&&v.length>0&&jsx(motion.div,{ref:K,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:g("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",y?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:v.map((be,ge)=>jsxs("button",{type:"button",onClick:()=>W(be),className:g("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",ge===T?y?"bg-white/10":"bg-gray-100":y?"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:be.color||"#8B5CF6"},children:rh(be.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:g("text-sm font-medium truncate",y?"text-white":"text-gray-900"),children:be.name}),be.email&&jsx("p",{className:g("text-xs truncate",y?"text-[#6B7280]":"text-gray-500"),children:be.email})]})]},be.id))})})]})]})]})}function up({content:e,theme:t="dark"}){let r=t==="dark",a=[],n=/@(\S+)/g,s=0,o;for(;(o=n.exec(e))!==null;)o.index>s&&a.push({type:"text",value:e.slice(s,o.index)}),a.push({type:"mention",value:o[0]}),s=o.index+o[0].length;return s<e.length&&a.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:a.map((c,l)=>c.type==="mention"?jsx("span",{className:g("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",r?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:c.value},l):jsx("span",{children:c.value},l))})}var Si=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function jo({selectedTags:e,availableTags:t,onChange:r,onCreateTag:a,theme:n,disabled:s=false,compact:o=true}){let[c,l]=useState(false),[i,d]=useState(""),[u,p]=useState(false),[m,f]=useState(Si[10]||"#00E5CC"),[x,y]=useState({top:0,left:0}),b=useRef(null),h=useRef(null),v=useRef(null),w=useRef(null),T=t.filter(N=>N.name.toLowerCase().includes(i.toLowerCase())),E=t.some(N=>N.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(c&&h.current){let N=h.current.getBoundingClientRect();y({top:N.bottom+6,left:N.left});}},[c]),useEffect(()=>{let N=K=>{let H=K.target,te=b.current?.contains(H),I=v.current?.contains(H);!te&&!I&&(l(false),d(""),p(false));};if(c)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[c]),useEffect(()=>{c&&w.current&&w.current.focus();},[c]);let F=N=>{let K=e.some(H=>H.id===N.id);r(K?e.filter(H=>H.id!==N.id):[...e,N]);},k=async()=>{if(!(!a||!i.trim())){p(true);try{let N=await a(i.trim(),m);N&&(r([...e,N]),d(""),f(Si[Math.floor(Math.random()*Si.length)]||"#00E5CC"));}finally{p(false);}}},D=(N,K)=>{K.stopPropagation(),r(e.filter(H=>H.id!==N));},P={backgroundColor:`${n.textTertiary}15`,border:`1px solid ${n.borderLight}`,color:n.textSecondary};return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{ref:h,type:"button",onClick:()=>!s&&l(!c),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:P,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(N=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${N.color}20`,color:N.color},children:N.name},N.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:n.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:n.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:c&&jsxs(motion.div,{ref:v,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:x.top,left:x.left,zIndex:99999,backgroundColor:n.bgPrimary,border:`1px solid ${n.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:n.border},children:jsx("input",{ref:w,type:"text",value:i,onChange:N=>d(N.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:n.bgSecondary,color:n.textPrimary,border:`1px solid ${n.borderLight}`},onKeyDown:N=>{N.key==="Enter"&&i.trim()&&!E&&a&&k();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:n.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:n.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(N=>jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${N.color}20`,color:N.color},onClick:K=>D(N.id,K),children:[N.name,jsx(X,{className:"w-3 h-3"})]},N.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:T.length>0?T.map(N=>{let K=e.some(H=>H.id===N.id);return jsxs("button",{type:"button",onClick:()=>F(N),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:K?`${N.color}15`:"transparent",color:n.textPrimary},onMouseEnter:H=>{K||(H.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:H=>{K||(H.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N.color}}),jsx("span",{className:"flex-1 text-left",children:N.name}),K&&jsx(Check,{className:"w-4 h-4",style:{color:N.color}})]},N.id)}):i.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!E&&a&&jsxs("div",{className:"p-2 border-t",style:{borderColor:n.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:n.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Si.map(N=>jsx("button",{type:"button",onClick:()=>f(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:m===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),jsxs("button",{type:"button",onClick:k,disabled:u,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:m,color:"#FFFFFF",opacity:u?.7:1},children:[u?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',i.trim(),'"']})]})]})}),document.body)]})}function oc({tag:e,onRemove:t,size:r="sm"}){return jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${r==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function mp({tags:e,maxVisible:t=3,size:r="sm"}){if(!e||e.length===0)return null;let a=e.slice(0,t),n=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[a.map(s=>jsx(oc,{tag:s,size:r},s.id)),n>0&&jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${r==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",n]})]})}var wo=[{name:"Azul",value:"#00E5CC",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#00E5CC",light:"#00E5CC"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function gp(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h${r}m`}function mh(e){switch(e){case "on-track":return {text:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20",border:"border-green-200 dark:border-green-800"};case "at-risk":return {text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-50 dark:bg-yellow-900/20",border:"border-yellow-200 dark:border-yellow-800"};case "over-budget":return {text:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20",border:"border-red-200 dark:border-red-800"};case "no-estimate":default:return {text:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800/50",border:"border-gray-200 dark:border-gray-700"}}}function gh({className:e}){return jsxs("svg",{className:g("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function sc({summary:e,size:t="sm",showEstimate:r=true,onClick:a,className:n}){let s=mh(e.health),o={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},c={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},l=gp(e.loggedMinutes),i=e.estimateMinutes?gp(e.estimateMinutes):null,d=r&&i?`${l} / ${i}`:l;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(a?"button":"span",{className:g("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,o[t],a&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",n),onClick:a,type:a?"button":void 0,children:[jsx(gh,{className:c[t]}),jsx("span",{children:d})]})}function fh(e){let t=e.trim();if(!t)return null;let r;if(t.startsWith("="))r=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))r=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))r=t;else return null;if(!r||!/^[\d+\-*/().\s]+$/.test(r)||/[+\-*/]{2,}/.test(r.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let a=new Function(`"use strict"; return (${r});`)();return typeof a!="number"||!isFinite(a)||a<0?null:a}catch{return null}}function Mi(e){let t=fh(e);return t!==null?String(t):e}function bp(e){let r=Mi(e).trim().toLowerCase();if(r.includes(":")){let[o,c]=r.split(":").map(Number);return (o||0)*60+(c||0)}let a=r.match(/(\d+(?:\.\d+)?)\s*h/),n=r.match(/(\d+)\s*m/);if(a||n){let o=a?.[1]?parseFloat(a[1]):0,c=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+c}let s=parseFloat(r);return isNaN(s)?0:Math.round(s*60)}function Pi(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function yh(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return t>0?`${t}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${r}:${a.toString().padStart(2,"0")}`}function xh({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function vh({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 hp({className:e}){return jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function wh({className:e}){return jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function ic({taskId:e,summary:t,entries:r=[],isTimerRunning:a=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:c,onStopTimer:l,onDiscardTimer:i,onClose:d,className:u}){let[p,m]=useState(""),[f,x]=useState(t.estimateMinutes?Pi(t.estimateMinutes):""),[y,b]=useState(""),[h,v]=useState(false),[w,T]=useState(false),E=useRef(null);useEffect(()=>{E.current?.focus();},[]);let F=async()=>{let P=bp(p);if(!(P<=0||!s)){v(true);try{await s({durationMinutes:P,note:y.trim()||void 0,source:"manual"}),m(""),b("");}finally{v(false);}}},k=async()=>{if(!o)return;let P=f.trim()?bp(f):null;await o(P),T(false);},D=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),F()),P.key==="Escape"&&d?.();};return jsxs("div",{className:g("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",u),children:[jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsx("button",{onClick:d,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(hp,{className:"w-4 h-4"})})]}),jsx("div",{className:"px-3 py-2",children:a?jsxs("div",{className:"flex items-center gap-2",children:[jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxs("span",{className:"relative flex h-2 w-2",children:[jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:yh(n)})]}),jsx("button",{onClick:l,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(vh,{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(hp,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:c,className:g("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsx(xh,{className:"w-4 h-4"}),"Start Timer"]})}),jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"relative flex-1",children:[jsx(wh,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:E,type:"text",value:p,onChange:P=>m(P.target.value),onKeyDown:D,placeholder:"8 (=8h), 2h 30m",className:g("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsx("button",{onClick:F,disabled:h||!p.trim(),className:g("px-3 py-1.5 rounded-lg text-sm font-medium","bg-[#00E5CC] hover:bg-[#00C4AE] text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:y,onChange:P=>b(P.target.value),onKeyDown:D,placeholder:"Note (optional)",className:g("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsxs("div",{className:"px-3 py-2",children:[jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Pi(t.loggedMinutes)})]}),jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),w?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:f,onChange:P=>x(P.target.value),onKeyDown:P=>{P.key==="Enter"&&k(),P.key==="Escape"&&T(false);},onBlur:k,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-[#00E5CC] bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>T(true),className:"font-medium text-gray-900 dark:text-white hover:text-[#00E5CC]",children:t.estimateMinutes?Pi(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxs("div",{className:"mt-2",children:[jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxs("span",{className:g("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsx("div",{className:g("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),r.length>0&&jsxs("div",{className:"px-3 py-2",children:[jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:r.slice(0,3).map(P=>jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsx("span",{className:"truncate flex-1",children:P.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Pi(P.durationMinutes)})]},P.id))})]})]})}function Dh(e){let r=Mi(e).trim().toLowerCase();if(!r||r==="-")return null;if(r.includes(":")){let[o,c]=r.split(":").map(Number);return (o||0)*60+(c||0)}let a=r.match(/(\d+(?:\.\d+)?)\s*h/),n=r.match(/(\d+)\s*m/);if(a||n){let o=a?.[1]?parseFloat(a[1]):0,c=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+c}let s=parseFloat(r);return isNaN(s)?null:Math.round(s*60)}function Sh(e){if(!e||e===0)return "";let t=Math.floor(e/60),r=e%60;return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`}function vn({mode:e,locale:t,isDark:r,currentValue:a,onSave:n,onClose:s,className:o}){let[c,l]=useState(Sh(a)),[i,d]=useState(""),[u,p]=useState(false),m=useRef(null);useEffect(()=>{m.current?.focus();},[]);let f=async()=>{p(true);let v=Dh(c);await n(v&&v>0?v:null,i||void 0),p(false);},x=async()=>{p(true),await n(null),p(false);},y=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),f()),v.key==="Escape"&&s();},b={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},h=t==="es";return jsxs("div",{className:g("w-56",o),style:{background:r?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:r?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:r?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:v=>v.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:r?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Clock,{className:"w-3 h-3",style:{color:r?"#007FFF":"#00E5CC"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:r?"rgba(255,255,255,0.5)":"#6B7280"},children:b[e]})]}),jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:r?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsx(X,{className:"w-3 h-3"})})]}),jsxs("div",{className:"p-3 space-y-2",children:[jsx("input",{ref:m,type:"text",value:c,onChange:v=>l(v.target.value),onKeyDown:y,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:r?"1px solid #333":"1px solid #E5E7EB",background:r?"#1A1A1A":"#F9FAFB",color:r?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:r?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsx("input",{type:"text",value:i,onChange:v=>d(v.target.value),onKeyDown:y,placeholder:h?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:r?"1px solid #333":"1px solid #E5E7EB",background:r?"#1A1A1A":"#F9FAFB",color:r?"rgba(255,255,255,0.7)":"#374151"}}),jsx("button",{type:"button",onClick:f,disabled:u||!c.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:r?"1px solid rgba(0, 229, 204,0.3)":"1px solid #00E5CC",background:r?"rgba(0, 229, 204,0.15)":"#00E5CC",color:r?"#007FFF":"#FFFFFF"},children:u?h?"Guardando...":"Saving...":h?"Registrar":"Save"}),a&&e!=="log"&&jsx("button",{type:"button",onClick:x,disabled:u,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:r?"rgba(255,255,255,0.3)":"#9CA3AF"},children:h?"Quitar":"Clear"})]})]})}function Eh(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 Mh(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 cc({summary:e,showLabel:t=false,size:r="md",className:a}){let n=Eh(e.health),s=Mh(e.health),o={sm:"h-1",md:"h-1.5",lg:"h-2"},c=e.progressPercent??0,l=Math.min(100,c),i=c>100;return e.health==="no-estimate"?jsxs("div",{className:g("flex items-center gap-2",a),children:[jsx("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",o[r]),children:jsx("div",{className:g("h-full w-1/4",n)})}),t&&jsx("span",{className:g("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:g("flex items-center gap-2",a),children:[jsxs("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",o[r]),children:[jsx("div",{className:g("h-full transition-all duration-300",n),style:{width:`${l}%`}}),i&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:g("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[c,"%"]})]})}function _o(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let r=Math.floor(t/60),a=t%60;return a===0?`${r}h`:`${r}h ${a}m`}function Fh(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-[#00E5CC]":"text-[#00C4AE]";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Lh(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-[#00A893]/30 border-[#00C4AE]/50":"bg-[#00E5CC]/15 border-[#00E5CC]/15";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function Ah(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 Ih({summary:e,locale:t,isDark:r}){let a=e.totalVarianceMinutes>0,n=a?r?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?r?"text-red-400":"text-red-600":r?"text-gray-400":"text-gray-600",s=r?"bg-[#1A1D25]":"bg-white",o=r?"border-white/5":"border-gray-200",c=r?"text-[#9CA3AF]":"text-gray-500",l=r?"text-[#E5E7EB]":"text-gray-900";return jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-1",c),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:g("text-2xl font-bold",n),children:[a?"+":"",_o(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:g("text-xs mt-1",c),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-2",c),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:r?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:g("font-medium",l),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:r?"text-[#00E5CC]":"text-[#00C4AE]",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:g("font-medium",l),children:e.atCostTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:r?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsx("span",{className:g("font-medium",l),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-2",c),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:c,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:g("font-medium",l),children:_o(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:c,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:g("font-medium",l),children:_o(e.totalLoggedMinutes)})]}),jsxs("div",{className:g("flex justify-between pt-1 border-t",o),children:[jsx("span",{className:c,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:g("font-medium",l),children:e.totalTasksWithEstimate})]})]})]})]})}function Rh({task:e,locale:t,isDark:r,onClick:a}){let n=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=r?"border-white/5":"border-gray-200",o=r?"text-[#E5E7EB]":"text-gray-900",c=r?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:g("border-b",s,a&&g("cursor-pointer",r?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>a?.(e.taskId),children:[jsxs("td",{className:"px-4 py-3",children:[jsx("div",{className:g("font-medium",o),children:e.taskName}),e.projectName&&jsx("div",{className:g("text-xs mt-1",c),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?_o(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:_o(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:g("font-medium",e.varianceMinutes>0?r?"text-green-400":"text-green-600":e.varianceMinutes<0?r?"text-red-400":"text-red-600":c),children:[n,_o(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:g("font-medium",e.variancePercent>0?r?"text-green-400":"text-green-600":e.variancePercent<0?r?"text-red-400":"text-red-600":c),children:[n,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:g("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Lh(e.status,r),Fh(e.status,r)),children:Ah(e.status,t)})})]})}function dc({report:e,isLoading:t=false,locale:r="en",theme:a="light",className:n,onTaskClick:s}){let o=a==="dark",c=o?"bg-[#050505]":"bg-gray-50",l=o?"bg-[#0A0A0A]":"bg-white",i=o?"border-white/[0.08]":"border-gray-200",d=o?"text-white/[0.92]":"text-gray-900",u=o?"text-white/[0.60]":"text-gray-500",p=o?"bg-[#050505]/50":"bg-gray-50",m=useMemo(()=>e?[...e.tasks].sort((f,x)=>f.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-f.varianceMinutes):[],[e]);return t?jsx("div",{className:g("p-8 text-center",u,n),children:r==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:g("p-8 text-center",u,n),children:r==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:g("space-y-6 p-6",c,n),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:g("text-2xl font-bold",d),children:r==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:g("text-sm mt-1",u),children:r==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(Ih,{summary:e.summary,locale:r,isDark:o}),jsx("div",{className:g("rounded-lg border overflow-hidden",l,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:g("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",u),children:r==="es"?"Tarea":"Task"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:r==="es"?"Ofertado":"Sold"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:r==="es"?"Trabajado":"Logged"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:r==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:"%"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:r==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:g("divide-y",i),children:m.map(f=>jsx(Rh,{task:f,locale:r,isDark:o,onClick:s},f.taskId))})]})})}),jsx("div",{className:g("text-xs text-center",u),children:r==="es"?jsx(Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsx(Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function Ko(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function Yh(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60),a=e%60;return t>0?`${t.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`:`${r.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}`}function Sp(e,t=[]){if("title"in e&&!("name"in e)){let r=e,a=(r.assignedUserIds||[]).map(n=>{let s=t.find(o=>o.id===n);return s||null}).filter(n=>n!==null);return {id:r.id,name:r.title,startDate:r.startDate?new Date(r.startDate):void 0,endDate:r.endDate?new Date(r.endDate):void 0,progress:r.progress||0,status:r.columnId,priority:r.priority?.toLowerCase(),assignees:a,dependencies:Array.isArray(r.dependencies)?r.dependencies.map(n=>typeof n=="string"?n:n.taskId):[],tags:r.tags,subtasks:r.subtasks?.map(n=>({id:n.id,name:n.title,progress:n.completed?100:0,startDate:new Date,endDate:new Date})),color:r.color,description:r.description,effortMinutes:r.effortMinutes,timeLoggedMinutes:r.timeLoggedMinutes,soldEffortMinutes:r.soldEffortMinutes}}return e}function Xh(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 ko({task:e,isOpen:t,onClose:r,onTaskUpdate:a,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:c=[],availableTags:l=[],onCreateTag:i,attachments:d=[],onUploadAttachments:u,onDeleteAttachment:p,availableTasks:m=[],comments:f=[],onAddComment:x,currentUser:y,mentionableUsers:b=[],onUploadCommentAttachments:h,enableTimeTracking:v=false,timeTrackingSummary:w,timeEntries:T=[],isTimerRunning:E=false,timerElapsedSeconds:F=0,onTimeLog:k,onEstimateUpdate:D,onSoldEffortUpdate:P,onTimerStart:N,onTimerStop:K,onTimerDiscard:H,blurFinancials:te=false}){let I=s==="dark",_={textTertiary:I?"#6B7280":"#9CA3AF",textSecondary:I?"#9CA3AF":"#6B7280",textPrimary:I?"#FFFFFF":"#111827",borderLight:I?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:I?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:I?"#1A1D25":"#FFFFFF",bgSecondary:I?"#0A0A0A":"#F9FAFB",hoverBg:I?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},j=e&&"title"in e&&!("name"in e),W=e,[B,ve]=useState(e?Sp(e,c):null),[We,Le]=useState(false),[be,ge]=useState(false),[ye,ze]=useState(false),[ke,Ie]=useState(null),[De,qe]=useState(new Date),[fe,tt]=useState(false),[Be,$e]=useState(false),[gt,Ft]=useState(""),[He,Ae]=useState(false),[ot,Lt]=useState(false),[Fe,Xe]=useState(false),[L,ae]=useState(false),[R,q]=useState(""),U=useRef(null),X$1=useRef(null),[Se,de]=useState(""),et=useRef(null),[rt,Qe]=useState(""),[At,kt]=useState(false),[jt,Gt]=useState([]),[or,br]=useState(""),[da,qt]=useState(false),gr=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 C=Sp(e,c);console.log("\u{1F4E5} After normalizeToTask:",{taskId:C?.id,taskName:C?.name,soldEffortMinutes:C?.soldEffortMinutes,quotedMinutes:C?.quotedMinutes,effortMinutes:C?.effortMinutes,timeLoggedMinutes:C?.timeLoggedMinutes}),ve(C),q(C.description||""),de(C.name||"");}},[e?.id,e?.quotedMinutes,c,t]),useEffect(()=>{if(!t||!R)return;let C=setTimeout(()=>{let $=X$1.current;$&&($.style.height="auto",$.style.height=`${Math.max(100,$.scrollHeight)}px`);},50);return ()=>clearTimeout(C)},[t,R]),useEffect(()=>()=>{U.current&&clearTimeout(U.current),et.current&&clearTimeout(et.current);},[]),useEffect(()=>{t&&gr.current&&f.length>0&&setTimeout(()=>{gr.current&&(gr.current.scrollTop=gr.current.scrollHeight);},100);},[t,f.length]);let St=useCallback(C=>{ve(C),j&&n&&W?n(Xh(C,W)):a&&a(C);},[j,W,n,a]),Lr=useCallback(()=>{Le(false),ge(false),ze(false),Ie(null),$e(false),Ft(""),Ae(false);},[]),Yt=useCallback((C,$)=>{if(!B)return;let ce={...B,[C]:$};St(ce);},[B,St]),tr=useCallback(()=>{let C=X$1.current;C&&(C.style.height="auto",C.style.height=`${Math.max(100,C.scrollHeight)}px`);},[]),kr=useCallback(C=>{q(C),setTimeout(tr,0),U.current&&clearTimeout(U.current),U.current=setTimeout(()=>{if(B){let $={...B,description:C};St($);}},800);},[B,St,tr]),oa=useCallback(C=>{de(C),et.current&&clearTimeout(et.current),et.current=setTimeout(()=>{if(B&&C.trim()){let $={...B,name:C.trim()};St($);}},800);},[B,St]),Ze=useCallback(C=>{let $=C.map(ce=>{let xe={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:ce};return ce.type.startsWith("image/")&&(xe.preview=URL.createObjectURL(ce)),xe});Gt(ce=>[...ce,...$]);},[]),Ye=useCallback(C=>{Gt($=>{let ce=$.find(xe=>xe.id===C);return ce?.preview&&URL.revokeObjectURL(ce.preview),$.filter(xe=>xe.id!==C)});},[]),ua=useCallback(async()=>{if(!(!B||!rt.trim()&&jt.length===0||!x)){kt(true);try{let C=cp(rt,b),$=[];if(jt.length>0&&h){let ce=jt.map(xe=>xe.file);$=await h(ce);}await x(B.id,rt.trim(),C.length>0?C:void 0,$.length>0?$:void 0),Qe(""),jt.forEach(ce=>{ce.preview&&URL.revokeObjectURL(ce.preview);}),Gt([]);}finally{kt(false);}}},[B,rt,jt,x,b,h]),Xt=useCallback(()=>{if(!B||!or.trim())return;let C=B.subtasks||[],$={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:or.trim(),progress:0,startDate:new Date,endDate:new Date,position:C.length},ce=[...C,$],xe={...B,subtasks:ce};St(xe),br(""),qt(false);},[B,or,St]),Zr=useCallback(C=>{if(!B?.subtasks)return;let $=B.subtasks.map(xe=>xe.id===C?{...xe,progress:xe.progress===100?0:100}:xe),ce={...B,subtasks:$};St(ce);},[B,St]),ne=useCallback(C=>{if(!B?.subtasks)return;let $=B.subtasks.filter(xe=>xe.id!==C),ce={...B,subtasks:$};St(ce);},[B,St]),pe=useCallback(C=>{let $=typeof C=="string"?new Date(C):C,xe=new Date().getTime()-$.getTime(),ee=Math.floor(xe/6e4),Je=Math.floor(xe/36e5),_e=Math.floor(xe/864e5);return ee<1?o==="es"?"Ahora":"Just now":ee<60?o==="es"?`Hace ${ee} min`:`${ee}m ago`:Je<24?o==="es"?`Hace ${Je}h`:`${Je}h ago`:_e<7?o==="es"?`Hace ${_e}d`:`${_e}d ago`:$.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),pt=useCallback(C=>{if(!B)return;let $=B.progress||0;C==="completed"?$=100:C==="in-progress"&&$===0?$=10:C==="todo"&&($=0);let ce={...B,status:C,progress:$};St(ce),Le(false);},[B,St]),je=useCallback((C,$)=>{if(!B)return;let ce={...B,startDate:C,endDate:$};St(ce);},[B,St]),it=useCallback(()=>{let C=De.getFullYear(),$=De.getMonth(),ce=new Date(C,$,1),ee=new Date(C,$+1,0).getDate(),Je=ce.getDay(),_e=[],Rt=new Date(C,$,0).getDate();for(let Nt=Je-1;Nt>=0;Nt--)_e.push({date:new Date(C,$-1,Rt-Nt),isCurrentMonth:false});for(let Nt=1;Nt<=ee;Nt++)_e.push({date:new Date(C,$,Nt),isCurrentMonth:true});let Et=42-_e.length;for(let Nt=1;Nt<=Et;Nt++)_e.push({date:new Date(C,$+1,Nt),isCurrentMonth:false});return _e},[De]),V=useCallback(async C=>{if(C.preventDefault(),C.stopPropagation(),Xe(false),!B||!u)return;let $=Array.from(C.dataTransfer.files);if($.length!==0){ae(true);try{await u(B.id,$);}finally{ae(false);}}},[B,u]),le=useCallback(async C=>{if(!B||!u||!C.target.files)return;let $=Array.from(C.target.files);if($.length!==0){ae(true);try{await u(B.id,$);}finally{ae(false);}C.target.value="";}},[B,u]),J=useCallback(C=>{C.preventDefault(),C.stopPropagation(),Xe(true);},[]),O=useCallback(C=>{C.preventDefault(),C.stopPropagation(),Xe(false);},[]),Z=useCallback(C=>C<1024?`${C} B`:C<1024*1024?`${(C/1024).toFixed(1)} KB`:`${(C/(1024*1024)).toFixed(1)} MB`,[]),Te=useCallback(C=>C.startsWith("image/")?Image:C.includes("pdf")||C.includes("document")?FileText:File,[]);return !t||!B?null:jsx(AnimatePresence,{children:t&&B&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:r,className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:g("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",I?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:g("px-6 py-3 border-b flex items-center gap-3 h-[49px]",I?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:g("w-4 h-4",I?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:g("text-xs px-2 py-0.5 rounded",I?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[o==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:g("text-xs font-mono",I?"text-[#6B7280]":"text-gray-400"),children:B.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let C=B.progress===100?0:100,ce={...B,progress:C,status:C===100?"completed":"todo"};St(ce);},className:g("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",B.progress===100?"bg-green-500 border-green-500":I?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:B.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Se,onChange:C=>oa(C.target.value),placeholder:o==="es"?"Nombre de la tarea...":"Task name...",className:g("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",B.progress===100?"line-through text-[#6B7280]":I?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Lr(),Le(!We);},className:g("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",B.progress===100||B.status==="completed"?"bg-green-500/20 text-green-400":B.progress&&B.progress>0||B.status==="in-progress"?"bg-[#00E5CC]/20 text-[#00E5CC]":I?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.progress===100||B.status==="completed"?o==="es"?"COMPLETADO":"DONE":B.progress&&B.progress>0||B.status==="in-progress"?o==="es"?"EN PROGRESO":"IN PROGRESS":o==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:We&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Le(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:o==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:o==="es"?"En progreso":"In Progress",color:"bg-[#00E5CC]"},{id:"completed",label:o==="es"?"Completado":"Done",color:"bg-green-500"}].map(C=>jsxs("button",{onClick:()=>pt(C.id),className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",I?"hover:bg-white/5":"hover:bg-gray-50",B.status===C.id&&(I?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",C.color)}),jsx("span",{className:I?"text-white":"text-gray-900",children:C.label})]},C.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Lr(),ze(!ye);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[B.assignees&&B.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[B.assignees.slice(0,3).map((C,$)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:C.color||"#8B5CF6"},title:C.name,children:C.initials||C.name.slice(0,2).toUpperCase()},$)),B.assignees.length>3&&jsxs("span",{className:g("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:["+",B.assignees.length-3]})]}):jsx("span",{className:g("text-sm",I?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:g("w-3 h-3",I?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:ye&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ze(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:c.length>0?c.map(C=>{let $=B.assignees?.some(ce=>ce.name===C.name);return jsxs("button",{onClick:()=>{let ce=B.assignees||[],xe;$?xe=ce.filter(ee=>ee.name!==C.name):xe=[...ce,C],Yt("assignees",xe);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",I?"hover:bg-white/5":"hover:bg-gray-50",$&&(I?"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:C.color||"#8B5CF6"},children:C.initials||C.name.slice(0,2).toUpperCase()}),jsx("span",{className:g("flex-1",I?"text-white":"text-gray-900"),children:C.name}),$&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},C.name)}):jsx("div",{className:g("px-3 py-4 text-sm text-center",I?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{Ie(ke?null:"start"),qe(B.startDate||new Date);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[B.startDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Inicio":"Start"),jsx("span",{className:g("mx-1",I?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),B.endDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:ke&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ie(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:g("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:C=>C.stopPropagation(),children:[jsxs("div",{className:g("w-44 py-2 border-r",I?"border-white/10":"border-gray-200"),children:[(()=>{let C=new Date,$=new Date(C);$.setDate(C.getDate()+1);let ce=new Date(C);ce.setDate(C.getDate()+((6-C.getDay()+7)%7||7));let xe=new Date(C);xe.setDate(C.getDate()+((1-C.getDay()+7)%7||7));let ee=new Date(C);ee.setDate(C.getDate()+(6-C.getDay()+7)%7+7);let Je=new Date(C);Je.setDate(C.getDate()+14);let _e=new Date(C);return _e.setDate(C.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:C,display:C.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:$,display:$.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:ce,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:xe,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:ee,display:ee.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:Je,display:Je.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:_e,display:_e.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Et,Nt)=>jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",I?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(ke==="start"){let Cr=B.endDate&&Et.date>B.endDate?Et.date:B.endDate;je(Et.date,Cr),Ie("end");}else {let Cr=B.startDate&&Et.date<B.startDate?Et.date:B.startDate;je(Cr,Et.date),Ie(null);}},children:[jsx("span",{children:Et.label}),jsx("span",{className:g("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:Et.display})]},Nt))})(),jsx("div",{className:g("border-t mt-2 pt-2",I?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{je(void 0,void 0),Ie(null);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",I?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",I?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:ke==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:g("font-medium",I?"text-white":"text-gray-900"),children:De.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>qe(new Date),className:g("p-1 rounded text-sm transition-colors",I?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>qe(new Date(De.getFullYear(),De.getMonth()-1)),className:g("p-1 rounded",I?"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:()=>qe(new Date(De.getFullYear(),De.getMonth()+1)),className:g("p-1 rounded",I?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(C=>jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",I?"text-[#6B7280]":"text-gray-400"),children:C},C))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:it().map((C,$)=>{let ce=C.date.toDateString()===new Date().toDateString(),xe=B.startDate?.toDateString()===C.date.toDateString(),ee=B.endDate?.toDateString()===C.date.toDateString(),Je=xe||ee,_e=B.startDate&&B.endDate&&C.date>=B.startDate&&C.date<=B.endDate;return jsx("button",{onClick:()=>{let Rt=new Date(C.date);if(ke==="start"){let Et=B.endDate&&Rt>B.endDate?Rt:B.endDate;je(Rt,Et),Ie("end");}else {let Et=B.startDate&&Rt<B.startDate?Rt:B.startDate;je(Et,Rt),Ie(null);}},className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!C.isCurrentMonth&&(I?"text-[#4B5563]":"text-gray-300"),C.isCurrentMonth&&(I?"text-white":"text-gray-900"),ce&&"ring-2 ring-[#00E5CC]",xe&&"bg-[#00E5CC] text-white",ee&&!xe&&"bg-[#7C3AED] text-white",_e&&!Je&&(I?"bg-[#7C3AED]/20":"bg-purple-100"),!Je&&(I?"hover:bg-white/10":"hover:bg-gray-100")),children:C.date.getDate()},$)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Lr(),ge(!be);},className:g("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",B.priority==="high"||B.priority==="urgent"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":B.priority==="low"?"bg-green-500/20 text-green-400":I?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.priority?B.priority==="high"||B.priority==="urgent"?o==="es"?"Alta":"High":B.priority==="medium"?o==="es"?"Media":"Medium":o==="es"?"Baja":"Low":o==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:be&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ge(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:o==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:o==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:o==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:o==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:o==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(C=>jsxs("button",{onClick:()=>{Yt("priority",C.id),ge(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",I?"hover:bg-white/5":"hover:bg-gray-50",B.priority===C.id&&(I?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",C.color)}),jsx("span",{className:I?"text-white":"text-gray-900",children:C.label})]},C.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:g("text-sm",I?"text-white":"text-gray-900"),children:B.startDate&&B.endDate?`${Math.ceil((B.endDate.getTime()-B.startDate.getTime())/(1e3*60*60*24))} ${o==="es"?"d\xEDas":"days"}`:o==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:g("w-4 h-4 rounded-full border-2",I?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[fe?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:B.progress||0,onChange:C=>{let $=parseInt(C.target.value),ce=B.status;$===100?ce="completed":$>0?ce="in-progress":ce="todo";let xe={...B,progress:$,status:ce};St(xe);},onBlur:()=>tt(false),className:g("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",I?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#00E5CC] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>tt(true),className:g("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",I?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:g("h-full rounded-full transition-all",B.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${B.progress||0}%`}})}),jsxs("span",{className:g("text-sm font-medium min-w-[40px]",I?"text-white":"text-gray-900"),children:[B.progress||0,"%"]})]})]}),v&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:B.status==="completed"||B.progress===100?jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",I?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:w?.estimateMinutes?Ko(w.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsx("button",{type:"button",onClick:()=>Lt("estimate"),className:g("text-sm px-2 py-0.5 rounded",I?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Ko(w.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>Lt("estimate"),className:g("text-sm",I?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:ot==="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(vn,{mode:"estimate",locale:o,isDark:I,currentValue:w?.estimateMinutes||null,onSave:async C=>{await D?.(B.id,C),Lt(false);},onClose:()=>Lt(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:te?jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",I?"text-[#94A3B8]":"text-gray-500"),title:o==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):B.status==="completed"||B.progress===100?jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",I?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:B.quotedMinutes?Ko(B.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):B.quotedMinutes?jsx("button",{type:"button",onClick:()=>Lt("quoted"),className:g("text-sm px-2 py-0.5 rounded",I?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Ko(B.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>Lt("quoted"),className:g("text-sm",I?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:ot==="quoted"&&!te&&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(vn,{mode:"quoted",locale:o,isDark:I,currentValue:B.quotedMinutes||null,onSave:async C=>{P?(await P(B.id,C),ve($=>$?{...$,quotedMinutes:C}:null)):Yt("quotedMinutes",C),Lt(false);},onClose:()=>Lt(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[B.status==="completed"||B.progress===100?jsx("div",{className:g("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",I?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):E?jsxs("button",{type:"button",onClick:()=>K?.(B.id),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsx(Square,{className:"w-3.5 h-3.5 fill-current"}),Yh(F||0)]}):jsx("button",{type:"button",onClick:()=>N?.(B.id),className:g("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",I?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:o==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),B.status==="completed"||B.progress===100?jsxs("div",{className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",I?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>Lt("log"),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",I?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}),w&&w.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:g("text-sm font-medium",w.health==="over-budget"?"text-red-500":w.health==="at-risk"?"text-yellow-500":I?"text-white":"text-gray-900"),children:[Ko(w.loggedMinutes),w.estimateMinutes&&jsxs("span",{className:g("font-normal",I?"text-[#6B7280]":"text-gray-400"),children:[" / ",Ko(w.estimateMinutes)]})]}),w.health!=="no-estimate"&&jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsx("div",{className:g("h-full rounded-full transition-all",w.health==="over-budget"?"bg-red-500":w.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,w.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:ot==="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(vn,{mode:"log",locale:o,isDark:I,currentValue:null,onSave:async(C,$)=>{C&&await k?.(B.id,{durationMinutes:C,note:$,source:"manual"}),Lt(false);},onClose:()=>Lt(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Etiquetas":"Tags"}),jsx(jo,{selectedTags:B.tags||[],availableTags:l,onChange:C=>{Yt("tags",C);},onCreateTag:i,theme:_})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:g("w-4 h-4 mt-1.5",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0 mt-1",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[B.dependencies&&B.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:B.dependencies.map(C=>{let $=m.find(ce=>ce.id===C);return jsxs("span",{className:g("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",I?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:[$?.name||C.slice(0,8),jsx("button",{onClick:()=>{let ce=(B.dependencies||[]).filter(xe=>xe!==C);Yt("dependencies",ce);},className:g("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},C)})}),jsxs("button",{onClick:()=>{Lr(),$e(!Be);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:g("text-sm",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:Be&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{$e(false),Ft("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:g("p-2 border-b",I?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:gt,onChange:C=>Ft(C.target.value),placeholder:o==="es"?"Buscar tarea...":"Search task...",className:g("w-full px-3 py-2 rounded-md text-sm outline-none",I?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:m.length>0?m.filter(C=>C.id!==B.id).filter(C=>gt===""||C.name.toLowerCase().includes(gt.toLowerCase())).map(C=>{let $=B.dependencies?.includes(C.id);return jsxs("button",{onClick:()=>{let ce=B.dependencies||[],xe;$?xe=ce.filter(ee=>ee!==C.id):xe=[...ce,C.id],Yt("dependencies",xe);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",I?"hover:bg-white/5":"hover:bg-gray-50",$&&(I?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:g("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",$?"bg-[#00E5CC] border-[#00E5CC]":I?"border-white/30":"border-gray-300"),children:$&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:g("block truncate",I?"text-white":"text-gray-900"),children:C.name}),jsx("span",{className:g("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:C.id.slice(0,8)})]})]},C.id)}):jsx("div",{className:g("px-3 py-4 text-sm text-center",I?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Lr(),Ae(!He);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:B.color||"#6366F1"}}),jsx("span",{className:g("text-sm",I?"text-white":"text-gray-900"),children:wo.find(C=>C.value===B.color)?.name||(o==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:g("w-3 h-3",I?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:He&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ae(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",I?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:wo.map(C=>{let $=B.color===C.value;return jsx("button",{onClick:()=>{Yt("color",C.value),Ae(false);},className:g("w-7 h-7 rounded-full flex items-center justify-center transition-all",$&&"ring-2 ring-offset-2",I?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:C.value,outlineColor:$?C.value:void 0},title:C.name,children:$&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},C.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:B.isMilestone||false,onChange:C=>Yt("isMilestone",C.target.checked),className:g("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",B.isMilestone?"bg-purple-500 border-purple-500":I?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:g("text-sm",I?"text-white":"text-gray-900"),children:o==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",I?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:g("w-4 h-4",I?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:g("text-sm font-semibold",I?"text-white":"text-gray-900"),children:o==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:X$1,value:R,onChange:C=>kr(C.target.value),placeholder:o==="es"?"Agregar descripci\xF3n...":"Add description...",className:g("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",I?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",I?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:g("text-sm font-semibold",I?"text-white":"text-gray-900"),children:[o==="es"?"Subtareas":"Subtasks",B.subtasks&&B.subtasks.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",I?"text-[#6B7280]":"text-gray-400"),children:["(",B.subtasks.filter(C=>C.progress===100).length,"/",B.subtasks.length,")"]})]})}),B.subtasks&&B.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...B.subtasks].sort((C,$)=>(C.position??0)-($.position??0)).map(C=>jsxs("div",{className:g("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",I?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>Zr(C.id),className:g("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",C.progress===100?"bg-green-500 border-green-500":I?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:C.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:g("text-sm flex-1",C.progress===100?"line-through text-[#6B7280]":I?"text-white":"text-gray-900"),children:C.name}),jsx("button",{onClick:()=>ne(C.id),className:g("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",I?"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"})})]},C.id))}),da?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:or,onChange:C=>br(C.target.value),onKeyDown:C=>{C.key==="Enter"&&or.trim()?Xt():C.key==="Escape"&&(qt(false),br(""));},placeholder:o==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:g("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",I?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-[#00E5CC]/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-[#00E5CC]")}),jsx("button",{onClick:Xt,disabled:!or.trim(),className:g("px-3 py-2 rounded-lg text-sm font-medium transition-colors",or.trim()?"bg-[#00E5CC] hover:bg-[#00C4AE] text-white":I?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:o==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{qt(false),br("");},className:g("p-2 rounded-lg transition-colors",I?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>qt(true),className:g("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",I?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),o==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",I?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:g("text-sm font-semibold mb-3",I?"text-white":"text-gray-900"),children:[o==="es"?"Adjuntos":"Attachments",d.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",I?"text-[#6B7280]":"text-gray-400"),children:["(",d.length,")"]})]}),d.length>0&&jsx("div",{className:"space-y-2 mb-4",children:d.map(C=>{let $=Te(C.type),ce=C.type.startsWith("image/");return jsxs("div",{className:g("flex items-center gap-3 p-2 rounded-lg group transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[ce&&C.thumbnailUrl?jsx("img",{src:C.thumbnailUrl,alt:C.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:g("w-10 h-10 rounded flex items-center justify-center",I?"bg-white/10":"bg-gray-200"),children:jsx($,{className:g("w-5 h-5",I?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:C.url,target:"_blank",rel:"noopener noreferrer",className:g("text-sm font-medium truncate block hover:underline",I?"text-white":"text-gray-900"),children:C.name}),jsx("p",{className:g("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:Z(C.size)})]}),p&&jsx("button",{onClick:()=>p(C.id),className:g("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",I?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:o==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},C.id)})}),jsxs("div",{onDragOver:J,onDragLeave:O,onDrop:V,className:g("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Fe?I?"border-[#00E5CC] bg-[#00E5CC]/10":"border-[#00E5CC] bg-[#00E5CC]/15":I?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",L&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:le,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!u||L}),L?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-[#00E5CC] border-t-transparent rounded-full animate-spin"}),jsx("p",{className:g("text-sm",I?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:g("w-6 h-6 mx-auto mb-2",Fe?"text-[#00E5CC]":I?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:g("text-sm",I?"text-[#9CA3AF]":"text-gray-500"),children:Fe?o==="es"?"Suelta los archivos aqu\xED":"Drop files here":o==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!u&&jsx("p",{className:g("text-xs mt-1",I?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:g("w-96 border-l flex flex-col",I?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:g("px-4 py-3 border-b flex items-center justify-between h-[49px]",I?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:g("text-sm font-semibold",I?"text-white":"text-gray-900"),children:[o==="es"?"Actividad":"Activity",f.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",I?"text-[#6B7280]":"text-gray-400"),children:["(",f.length,")"]})]}),jsx("button",{onClick:r,className:g("p-1.5 rounded transition-colors",I?"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: ${I?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
17
17
  }
18
- `}),jsx("div",{ref:Mt,className:c("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",I?"scrollbar-slim":"scrollbar-slim-light"),children:f.length>0?jsx("div",{className:"space-y-4",children:[...f].sort((C,$)=>{let fe=typeof C.createdAt=="string"?new Date(C.createdAt):C.createdAt,De=typeof $.createdAt=="string"?new Date($.createdAt):$.createdAt;return fe.getTime()-De.getTime()}).map(C=>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:C.user?.color||"#8B5CF6"},children:C.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:c("text-sm font-medium",I?"text-white":"text-gray-900"),children:C.user?.name||(o==="es"?"Usuario":"User")}),jsx("span",{className:c("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:ve(C.createdAt)})]}),jsx("div",{className:c("text-sm",I?"text-[#9CA3AF]":"text-gray-600"),children:jsx(lp,{content:C.content,theme:s})}),C.attachments&&C.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:C.attachments.map($=>{let fe=$.type.startsWith("image/");return jsxs("a",{href:$.url,target:"_blank",rel:"noopener noreferrer",className:c("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[fe?jsx(Image,{className:c("w-4 h-4",I?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:c("w-4 h-4",I?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:c("text-xs truncate max-w-[100px]",I?"text-white":"text-gray-900"),children:$.name})]},$.id)})})]})]},C.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:c("w-10 h-10 mb-3",I?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:c("text-sm",I?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:c("py-4 pl-4 pr-2 border-t",I?"border-white/10":"border-gray-200"),children:jsx(ip,{value:Ae,onChange:Pe,onSubmit:ft,users:b,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!v,isSubmitting:ct,theme:s,locale:o,currentUser:y,enableEmoji:true,enableAttachments:!!h,pendingFiles:st,onFilesSelect:W,onRemoveFile:ne})})]})]})]})})}function ad(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(n=>{t(n);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function jo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:n,availableUsers:s=[],className:o,style:l,isLoading:d,error:i,children:u,availableTags:m=[],onCreateTag:p,attachmentsByCard:g,onUploadAttachments:f,onDeleteAttachment:v,comments:y,onAddComment:b,currentUser:h,mentionableUsers:x,onTaskOpen:w,onUploadCommentAttachments:N,enableTimeTracking:D,timeTrackingSummary:A,timeEntries:T,timerState:E,onLogTime:P,onUpdateEstimate:k,onUpdateSoldEffort:K,onStartTimer:H,onStopTimer:ee,onDiscardTimer:I,blurFinancials:Y=false,sidePanel:q,renderColumnMetrics:V,suppressDetailModal:B=false}){let[X,Te]=ad(),[He,z]=useState(null),[te,xe]=useState(false),je=useRef(null),Ne=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),ze=n?.theme||"dark",Me=ze==="dark"||ze==="neutral",at=Me?"dark":"",be=useCallback((F,le)=>{t.onCardUpdate?.(F,le);},[t]),pt=useCallback((F,le)=>{t.onColumnUpdate?.(F,{title:le});},[t]),Ke=useCallback(F=>{t.onColumnDelete?.(F);},[t]),Ue=["todo","in-progress","completed"],kt=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Ht=useMemo(()=>{let F=new Map;return e.columns.forEach(le=>{let R=le.cardIds.map(J=>e.cards.find(O=>O.id===J)).filter(J=>J!==void 0).sort((J,O)=>J.position-O.position);F.set(le.id,R);}),F},[e.cards,e.columns]);useEffect(()=>{let F=je.current;if(!F)return;let le=Z=>{let Ve=Z.target,ke=Z.button===1,Re=Ve===F||Ve.classList.contains("asakaa-column")&&!Ve.closest(".asakaa-card");(ke||Z.button===0&&Re&&!X.isDragging)&&(Z.preventDefault(),xe(true),Ne.current={x:Z.clientX,y:Z.clientY,scrollLeft:F.scrollLeft,scrollTop:F.scrollTop},F.style.cursor="grabbing",F.style.userSelect="none");},R=Z=>{if(!te)return;let Ve=Z.clientX-Ne.current.x,ke=Z.clientY-Ne.current.y;F.scrollLeft=Ne.current.scrollLeft-Ve,F.scrollTop=Ne.current.scrollTop-ke;},J=()=>{te&&(xe(false),F.style.cursor="",F.style.userSelect="");},O=()=>{te&&(xe(false),F.style.cursor="",F.style.userSelect="");};return F.addEventListener("mousedown",le),document.addEventListener("mousemove",R),document.addEventListener("mouseup",J),F.addEventListener("mouseleave",O),()=>{F.removeEventListener("mousedown",le),document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",J),F.removeEventListener("mouseleave",O);}},[te,X.isDragging]);let qe=useMemo(()=>e.cards.map(F=>({id:F.id,name:F.title,startDate:F.startDate?new Date(F.startDate):void 0,endDate:F.endDate?new Date(F.endDate):void 0,progress:F.progress||0,status:F.columnId,priority:F.priority?.toLowerCase(),dependencies:Array.isArray(F.dependencies)?F.dependencies.map(le=>typeof le=="string"?le:le.taskId):[]})),[e.cards]),We=useCallback(F=>{let{active:le}=F,R=e.cards.find(J=>J.id===le.id);R&&Te({isDragging:true,draggedCardId:R.id,sourceColumnId:R.columnId,targetColumnId:R.columnId});},[e.cards,Te]),ot=useCallback(F=>{let{active:le,over:R}=F;if(!R||!e.cards.find(Z=>Z.id===le.id))return;let O=null;R.data.current?.type==="column"?O=R.id:R.data.current?.type==="card"&&(O=e.cards.find(Ve=>Ve.id===R.id)?.columnId||null),O&&O!==X.targetColumnId&&Te({...X,targetColumnId:O});},[e.cards,X,Te]),zt=useCallback(async F=>{let{active:le,over:R}=F;if(Te({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!R)return;let J=e.cards.find(ke=>ke.id===le.id);if(!J)return;let O,Z;if(R.data.current?.type==="column"){O=R.id;let ke=Ht.get(O)||[];Z=$l(ke,0);}else {let ke=e.cards.find(Pe=>Pe.id===R.id);if(!ke)return;O=ke.columnId;let Re=Ht.get(O)||[],Ae=Re.findIndex(Pe=>Pe.id===R.id);Z=$l(Re,Ae);}let Ve=e.columns.find(ke=>ke.id===O);if(Ve&&Ve.wipLimit&&Ve.wipLimitType==="hard"){let ke=Ht.get(O)||[];if(J.columnId!==O&&ke.length>=Ve.wipLimit){t.onWipLimitExceeded?.(Ve,J);return}}(J.columnId!==O||J.position!==Z)&&await t.onCardMove?.(J.id,O,Z);},[e.cards,e.columns,Ht,t,Te]),Ee=useCallback(F=>{B||z(F),a?.(F),w?.(F.id);},[a,w,B]),nt=useCallback(F=>{t.onCardUpdate?.(F.id,F),z(F);},[t]);return d?jsx("div",{className:c("asakaa-board",at,o),style:l,children:jsx(zh,{columnCount:3})}):i?jsx("div",{className:c("asakaa-board",at,o),style:l,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof i=="string"?i:i.message})]})})}):jsxs(Ru,{themeName:ze,children:[jsxs("div",{className:c("flex h-full overflow-hidden",q?"flex-row":""),children:[jsxs(DndContext,{sensors:kt,collisionDetection:closestCorners,onDragStart:We,onDragOver:ot,onDragEnd:zt,children:[jsxs("div",{ref:je,className:c("asakaa-board",q?"flex-1":"",at,o),style:{...l,cursor:te?"grabbing":void 0},"data-theme":ze,children:[e.columns.sort((F,le)=>F.position-le.position).map(F=>{let le=Ht.get(F.id)||[],R=!Ue.includes(F.id),J=r?.renderColumnFooter?.(F);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(Hn,{column:F,cards:le,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:V?(O,Z)=>V(O,Z):void 0,onCardClick:Ee,onCardUpdate:be,onColumnRename:t.onColumnUpdate?pt:void 0,onColumnDelete:t.onColumnDelete?Ke:void 0,isDeletable:R,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight}),J]},F.id)}),u]}),jsx(DragOverlay,{children:X.draggedCardId?jsx(So,{card:e.cards.find(F=>F.id===X.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),q]}),!B&&jsx(Mo,{task:He,isOpen:!!He,onClose:()=>z(null),onCardUpdate:nt,theme:Me?"dark":"light",locale:n?.locale==="es"?"es":"en",availableUsers:s,availableTags:m,onCreateTag:p,attachments:He?g?.get(He.id)||[]:[],onUploadAttachments:f,onDeleteAttachment:v,availableTasks:qe,comments:y,onAddComment:b,currentUser:h,mentionableUsers:x,onUploadCommentAttachments:N,enableTimeTracking:D,timeTrackingSummary:A,timeEntries:T,isTimerRunning:E?.isRunning,timerElapsedSeconds:E?.elapsedSeconds,onTimeLog:P,onEstimateUpdate:k,onSoldEffortUpdate:K,onTimerStart:H,onTimerStop:ee,onTimerDiscard:I,blurFinancials:Y})]})}function zh({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 jh={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 229, 204, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},_h={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#00E5CC",accentLight:"rgba(0, 229, 204, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Kh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},qh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Yh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:n}){let[s,o]=useState(false),l=useRef(null);useEffect(()=>{let i=u=>{l.current&&!l.current.contains(u.target)&&o(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let d=i=>{t(i),o(false);};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:n||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((i,u)=>i.position-u.position).map((i,u)=>jsxs(motion.button,{onClick:()=>d(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:i.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function Xh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:n}){let[s,o]=useState(false),[l,d]=useState(null),i=useRef(null);if(useEffect(()=>{let g=f=>{i.current&&!i.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||n))return null;let m=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:n}].filter(g=>g.handler),p=async(g,f)=>{if(f){d(g);try{await f();}catch(v){console.error(`Export ${g} failed:`,v);}finally{d(null),o(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:m.map((g,f)=>jsxs(motion.button,{onClick:()=>p(g.id,g.handler),disabled:l!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:f<m.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:f*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===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 Jh({onClick:e,label:t}){return jsxs(motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function od({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:l,onExportExcel:d,translations:i,toolbarRightContent:u,toolbarEndContent:m}){let p=r==="dark"?jh:_h,g={...n==="es"?Kh:qh,...i},f=o||l||d;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxs("div",{className:"flex items-center gap-3",children:[u&&jsxs(Fragment,{children:[u,jsx("div",{className:"w-px h-5",style:{backgroundColor:p.borderLight}})]}),f&&jsxs(Fragment,{children:[jsx(Xh,{theme:p,t:g,onExportCSV:o,onExportJSON:l,onExportExcel:d}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),m,t&&(s?jsx(Yh,{columns:e,onSelect:t,theme:p,t:g,createTaskLabel:a}):jsx(Jh,{onClick:()=>t(),label:a||g.newTask}))]})})}function sd({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:n=false}){let[s,o]=useState(false),[l,d]=useState(""),i=useCallback(()=>{let p=l.trim();p&&(e(p),d(""),o(false));},[l,e]),u=useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(d(""),o(false));},[i]),m=useCallback(()=>{setTimeout(()=>{l.trim()||o(false);},150);},[l]);return s?jsx("div",{className:c("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=>d(p.target.value),onKeyDown:u,onBlur:m,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:()=>{d(""),o(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:c("asakaa-add-column",t),children:jsxs("button",{onClick:()=>o(true),disabled:n,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function bn({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:n="es",defaultDate:s,className:o,dropdownDirection:l="up"}){let[d,i]=useState(""),[u,m]=useState(void 0),[p,g]=useState(null),[f,v]=useState(null),[y,b]=useState(false),[h,x]=useState(false),[w,N]=useState(false),[D,A]=useState(s||new Date),T=useRef(null),E=n==="es",P=l==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{T.current?.focus();},[]);let k=useCallback(()=>{b(false),x(false),N(false);},[]),K=useCallback(()=>{i(""),m(void 0),g(null),v(null),k(),t();},[t,k]),H=useCallback(()=>{let Y=d.trim();if(!Y)return;let q=a.find(B=>B.id===p),V=f||s;e({name:Y,priority:u,assignee:q||void 0,assigneeId:p,startDate:V,endDate:V}),i(""),m(void 0),g(null),v(null),k(),T.current?.focus();},[d,u,p,f,s,a,e,k]),ee=useCallback(Y=>{Y.key==="Enter"&&d.trim()&&(Y.preventDefault(),H()),Y.key==="Escape"&&K();},[H,K,d]),I=f||s||new Date;return jsxs("div",{className:c("quick-task-create",o),onClick:()=>k(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:T,type:"text",value:d,onChange:Y=>i(Y.target.value),placeholder:E?"Nombre de la tarea...":"Task name...",className:c("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:ee})}),jsxs("div",{className:c("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:Y=>{Y.stopPropagation(),b(!y),x(false),N(false);},type:"button",className:c("p-1 rounded transition-colors",u?u==="urgent"||u==="high"?"text-red-400 bg-red-500/20":u==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:c("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",P,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>Y.stopPropagation(),children:[{id:"urgent",label:E?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:E?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:E?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:E?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:E?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(Y=>jsxs("button",{onClick:()=>{m(Y.id),b(false);},type:"button",className:c("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",u===Y.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:c("w-2 h-2 rounded-full",Y.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:Y.label})]},Y.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:Y=>{Y.stopPropagation(),N(!w),b(false),x(false),A(f||s||new Date);},type:"button",className:c("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",f?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-[#00E5CC]/20 text-[#00C4AE]":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),I.toLocaleDateString(E?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:w&&jsxs(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:c("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",P,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>Y.stopPropagation(),children:[jsx("div",{className:c("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let Y=new Date,q=new Date(Y);q.setDate(Y.getDate()+1);let V=new Date(Y);V.setDate(Y.getDate()+((6-Y.getDay()+7)%7||7));let B=new Date(Y);B.setDate(Y.getDate()+((1-Y.getDay()+7)%7||7));let X=new Date(Y);X.setDate(Y.getDate()+14);let Te=new Date(Y);Te.setDate(Y.getDate()+28);let He=E?"es-ES":"en-US";return [{label:E?"Hoy":"Today",date:Y,display:Y.toLocaleDateString(He,{weekday:"short"}).slice(0,3)+"."},{label:E?"Ma\xF1ana":"Tomorrow",date:q,display:q.toLocaleDateString(He,{weekday:"short"}).slice(0,3)+"."},{label:E?"Este fin de semana":"This weekend",date:V,display:E?"s\xE1b.":"sat."},{label:E?"Pr\xF3xima semana":"Next week",date:B,display:E?"lun.":"mon."},{label:E?"2 semanas":"2 weeks",date:X,display:X.toLocaleDateString(He,{day:"numeric",month:"short"})},{label:E?"4 semanas":"4 weeks",date:Te,display:Te.toLocaleDateString(He,{day:"numeric",month:"short"})}].map((te,xe)=>jsxs("button",{type:"button",className:c("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{v(te.date),N(false);},children:[jsx("span",{children:te.label}),jsx("span",{className:c("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:te.display})]},xe))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:c("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:D.toLocaleDateString(E?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>A(new Date),className:c("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:E?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>A(new Date(D.getFullYear(),D.getMonth()-1)),className:c("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:()=>A(new Date(D.getFullYear(),D.getMonth()+1)),className:c("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(E?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(Y=>jsx("div",{className:c("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:Y},Y))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Y=D.getFullYear(),q=D.getMonth(),V=new Date(Y,q,1).getDay(),B=new Date(Y,q+1,0).getDate(),X=new Date(Y,q,0).getDate(),Te=new Date().toDateString(),He=[];for(let te=V-1;te>=0;te--)He.push({dayNum:X-te,isCurrent:false,date:new Date(Y,q-1,X-te)});for(let te=1;te<=B;te++)He.push({dayNum:te,isCurrent:true,date:new Date(Y,q,te)});let z=42-He.length;for(let te=1;te<=z;te++)He.push({dayNum:te,isCurrent:false,date:new Date(Y,q+1,te)});return He.map((te,xe)=>{let je=te.date.toDateString()===Te,Ne=(f||s)?.toDateString()===te.date.toDateString();return jsx("button",{type:"button",className:c("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!te.isCurrent&&(r?"text-white/20":"text-gray-300"),te.isCurrent&&(r?"text-white":"text-gray-900"),je&&"ring-1 ring-[#007FFF]",Ne&&"bg-[#007FFF] text-white",!Ne&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{v(te.date),N(false);},children:te.dayNum},xe)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:Y=>{Y.stopPropagation(),x(!h),b(false),N(false);},type:"button",className:c("p-1 rounded transition-colors",p?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:p?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(Y=>Y.id===p)?.color||"#007FFF"},children:a.find(Y=>Y.id===p)?.initials||a.find(Y=>Y.id===p)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:h&&jsxs(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:c("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",P,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>Y.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{g(null),x(false);},className:c("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!p&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:c("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:r?"text-white/40":"text-gray-500",children:E?"Sin asignar":"Unassigned"})]}),a.map(Y=>jsxs("button",{type:"button",onClick:()=>{g(Y.id),x(false);},className:c("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===Y.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:Y.color||"#007FFF"},children:Y.initials||Y.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:Y.name})]},Y.id)),a.length===0&&jsx("div",{className:c("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:E?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:H,disabled:!d.trim(),type:"button",className:c("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",d.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:E?"Guardar":"Save"})]})]})}function ud({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:n,disabled:s=false,theme:o="dark",locale:l="es"}){let[d,i]=useState(false),u=useRef(null),m=useRef(null),[p,g]=useState({}),[f,v]=useState(false),y=o==="dark",h={buttonLabel:n||(l==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!d||!u.current)return;let w=90,N=()=>{let D=u.current.getBoundingClientRect(),T=window.innerHeight-D.bottom<w+8;v(T),g({position:"fixed",...T?{bottom:window.innerHeight-D.top+4}:{top:D.bottom+4},left:D.left,width:D.width,zIndex:9999});};return N(),window.addEventListener("scroll",N,true),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,true),window.removeEventListener("resize",N);}},[d]),useEffect(()=>{if(!d)return;let w=N=>{let D=N.target;m.current&&!m.current.contains(D)&&u.current&&!u.current.contains(D)&&i(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[d]);let x=useCallback(w=>{t({name:w.name,columnId:e,assigneeIds:w.assigneeId?[w.assigneeId]:void 0,startDate:w.startDate,endDate:w.endDate,priority:w.priority});},[t,e]);return jsxs("div",{ref:u,className:c("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>i(!d),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),h.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:d&&jsx(motion.div,{ref:m,initial:{opacity:0,y:f?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:f?4:-4,scale:.97},transition:{duration:.12},style:p,className:c("rounded-lg shadow-2xl",y?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(bn,{onSubmit:x,onCancel:()=>i(false),availableUsers:a,isDark:y,locale:l,dropdownDirection:"up"})})}),document.body)]})}var Ps=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(jo,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let n=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,n?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(n=>`"${n}"`).join(",")).join(`
19
- `)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((n,s)=>{r.toBlob(o=>{o?n(o):s(new Error("Failed to create PNG blob"));},"image/png");})}};function zp(e={}){return new Ps(e)}var Wn=class extends Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:n,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),n)try{n(a,r);}catch(o){console.error("Error in error handler:",o);}}render(){let{hasError:a,error:r}=this.state,{children:n,fallback:s,componentName:o}=this.props;return a&&r?s?s(r,this.resetError):jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxs("div",{className:"flex items-start gap-3",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:o?`Error in ${o}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxs("details",{className:"mb-3",children:[jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):n}};function pd(e,t){let a=r=>jsx(Wn,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function gd({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:l,onOpenAIUsage:d,shortcut:i="k",className:u=""}){let[m,p]=useState(false),[g,f]=useState(""),[v,y]=useState("home"),[b,h]=useState(""),[x,w]=useState("");useEffect(()=>{let T=E=>{(E.metaKey||E.ctrlKey)&&E.key===i&&(E.preventDefault(),p(P=>!P)),E.key==="Escape"&&(p(false),y("home"),f(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i]),useEffect(()=>{m||(y("home"),f(""),h(""),w(""));},[m]);let N=useCallback(()=>{p(false);},[]),D=useCallback(T=>{let[E,P]=T.split(":");switch(E){case "create-card":y("create-card");break;case "create-card-in":h(P||"");break;case "navigate":P?(a?.(P),N()):y("navigate");break;case "search":r?.(g),N();break;case "priority":y("priority");break;case "set-priority":x&&P&&(n?.(x,P),N());break;case "assign":y("assign");break;case "assign-user":x&&P&&(s?.(x,P),N());break;case "ai":y("ai");break;case "ai-generate-plan":o?.(),N();break;case "ai-predict-risks":l?.(),N();break;case "ai-usage":d?.(),N();break;case "back":y("home");break;}},[g,x,t,a,r,n,s,o,l,d,N]),A=useCallback(()=>{b&&g.trim()&&(t?.(b,g.trim()),N());},[b,g,t,N]);return m?jsx(ra,{children:jsx("div",{className:"command-palette-overlay",onClick:N,children:jsx("div",{className:`command-palette ${u}`,onClick:T=>T.stopPropagation(),children:jsxs(Command,{value:g,onValueChange:f,label:"Command Menu",children:[jsxs("div",{className:"command-palette-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx(Command.Input,{placeholder:v==="create-card"&&b?"Type card title and press Enter...":v==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&v==="create-card"&&b&&A();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),v==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect: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(T=>jsxs(Command.Item,{value:`navigate:${T.id}`,onSelect:D,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(E=>jsx("span",{className:"command-palette-item-label",children:E},E))})]},T.id))})]}),v==="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(T=>jsxs(Command.Item,{value:`create-card-in:${T.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:T.title}),jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),v==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect: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(T=>{let E=e.columns.find(P=>P.id===T.columnId);return jsxs(Command.Item,{value:`navigate:${T.id}`,onSelect:D,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:T.title}),jsx("div",{className:"command-palette-item-meta",children:E?.title})]}),T.labels&&T.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(P=>jsx("span",{className:"command-palette-item-label",children:P},P))})]},T.id)})})]}),v==="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 Vp(e,t,a,r,n){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let o=document.createElement("div");o.id="attachment-lightbox-native",o.className="attachment-lightbox",o.style.cssText=`
18
+ `}),jsx("div",{ref:gr,className:g("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",I?"scrollbar-slim":"scrollbar-slim-light"),children:f.length>0?jsx("div",{className:"space-y-4",children:[...f].sort((C,$)=>{let ce=typeof C.createdAt=="string"?new Date(C.createdAt):C.createdAt,xe=typeof $.createdAt=="string"?new Date($.createdAt):$.createdAt;return ce.getTime()-xe.getTime()}).map(C=>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:C.user?.color||"#8B5CF6"},children:C.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:g("text-sm font-medium",I?"text-white":"text-gray-900"),children:C.user?.name||(o==="es"?"Usuario":"User")}),jsx("span",{className:g("text-xs",I?"text-[#6B7280]":"text-gray-400"),children:pe(C.createdAt)})]}),jsx("div",{className:g("text-sm",I?"text-[#9CA3AF]":"text-gray-600"),children:jsx(up,{content:C.content,theme:s})}),C.attachments&&C.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:C.attachments.map($=>{let ce=$.type.startsWith("image/");return jsxs("a",{href:$.url,target:"_blank",rel:"noopener noreferrer",className:g("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",I?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[ce?jsx(Image,{className:g("w-4 h-4",I?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:g("w-4 h-4",I?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:g("text-xs truncate max-w-[100px]",I?"text-white":"text-gray-900"),children:$.name})]},$.id)})})]})]},C.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:g("w-10 h-10 mb-3",I?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:g("text-sm",I?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:g("py-4 pl-4 pr-2 border-t",I?"border-white/10":"border-gray-200"),children:jsx(dp,{value:rt,onChange:Qe,onSubmit:ua,users:b,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:At,theme:s,locale:o,currentUser:y,enableEmoji:true,enableAttachments:!!h,pendingFiles:jt,onFilesSelect:Ze,onRemoveFile:Ye})})]})]})]})})}function pc(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(n=>{t(n);}),[]);let r=useCallback(a=>{dragStore.setState(a);},[]);return [e,r]}function Jn({board:e,callbacks:t,onCardClick:r,renderProps:a,config:n,availableUsers:s=[],className:o,style:c,isLoading:l,error:i,children:d,availableTags:u=[],onCreateTag:p,attachmentsByCard:m,onUploadAttachments:f,onDeleteAttachment:x,comments:y,onAddComment:b,currentUser:h,mentionableUsers:v,onTaskOpen:w,onUploadCommentAttachments:T,enableTimeTracking:E,timeTrackingSummary:F,timeEntries:k,timerState:D,onLogTime:P,onUpdateEstimate:N,onUpdateSoldEffort:K,onStartTimer:H,onStopTimer:te,onDiscardTimer:I,blurFinancials:_=false,sidePanel:j,renderColumnMetrics:W,suppressDetailModal:B=false}){let[ve,We]=pc(),[Le,be]=useState(null),[ge,ye]=useState(false),ze=useRef(null),ke=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Ie=n?.theme||"dark",De=Ie==="dark"||Ie==="neutral",qe=De?"dark":"",fe=useCallback((L,ae)=>{t.onCardUpdate?.(L,ae);},[t]),tt=useCallback((L,ae)=>{t.onColumnUpdate?.(L,{title:ae});},[t]),Be=useCallback(L=>{t.onColumnDelete?.(L);},[t]),$e=["todo","in-progress","completed"],gt=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Ft=useMemo(()=>{let L=new Map;return e.columns.forEach(ae=>{let R=ae.cardIds.map(q=>e.cards.find(U=>U.id===q)).filter(q=>q!==void 0).sort((q,U)=>q.position-U.position);L.set(ae.id,R);}),L},[e.cards,e.columns]);useEffect(()=>{let L=ze.current;if(!L)return;let ae=X=>{let Se=X.target,de=X.button===1,et=Se===L||Se.classList.contains("asakaa-column")&&!Se.closest(".asakaa-card");(de||X.button===0&&et&&!ve.isDragging)&&(X.preventDefault(),ye(true),ke.current={x:X.clientX,y:X.clientY,scrollLeft:L.scrollLeft,scrollTop:L.scrollTop},L.style.cursor="grabbing",L.style.userSelect="none");},R=X=>{if(!ge)return;let Se=X.clientX-ke.current.x,de=X.clientY-ke.current.y;L.scrollLeft=ke.current.scrollLeft-Se,L.scrollTop=ke.current.scrollTop-de;},q=()=>{ge&&(ye(false),L.style.cursor="",L.style.userSelect="");},U=()=>{ge&&(ye(false),L.style.cursor="",L.style.userSelect="");};return L.addEventListener("mousedown",ae),document.addEventListener("mousemove",R),document.addEventListener("mouseup",q),L.addEventListener("mouseleave",U),()=>{L.removeEventListener("mousedown",ae),document.removeEventListener("mousemove",R),document.removeEventListener("mouseup",q),L.removeEventListener("mouseleave",U);}},[ge,ve.isDragging]);let He=useMemo(()=>e.cards.map(L=>({id:L.id,name:L.title,startDate:L.startDate?new Date(L.startDate):void 0,endDate:L.endDate?new Date(L.endDate):void 0,progress:L.progress||0,status:L.columnId,priority:L.priority?.toLowerCase(),dependencies:Array.isArray(L.dependencies)?L.dependencies.map(ae=>typeof ae=="string"?ae:ae.taskId):[]})),[e.cards]),Ae=useCallback(L=>{let{active:ae}=L,R=e.cards.find(q=>q.id===ae.id);R&&We({isDragging:true,draggedCardId:R.id,sourceColumnId:R.columnId,targetColumnId:R.columnId});},[e.cards,We]),ot=useCallback(L=>{let{active:ae,over:R}=L;if(!R||!e.cards.find(X=>X.id===ae.id))return;let U=null;R.data.current?.type==="column"?U=R.id:R.data.current?.type==="card"&&(U=e.cards.find(Se=>Se.id===R.id)?.columnId||null),U&&U!==ve.targetColumnId&&We({...ve,targetColumnId:U});},[e.cards,ve,We]),Lt=useCallback(async L=>{let{active:ae,over:R}=L;if(We({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!R)return;let q=e.cards.find(de=>de.id===ae.id);if(!q)return;let U,X;if(R.data.current?.type==="column"){U=R.id;let de=Ft.get(U)||[];X=ql(de,0);}else {let de=e.cards.find(Qe=>Qe.id===R.id);if(!de)return;U=de.columnId;let et=Ft.get(U)||[],rt=et.findIndex(Qe=>Qe.id===R.id);X=ql(et,rt);}let Se=e.columns.find(de=>de.id===U);if(Se&&Se.wipLimit&&Se.wipLimitType==="hard"){let de=Ft.get(U)||[];if(q.columnId!==U&&de.length>=Se.wipLimit){t.onWipLimitExceeded?.(Se,q);return}}(q.columnId!==U||q.position!==X)&&await t.onCardMove?.(q.id,U,X);},[e.cards,e.columns,Ft,t,We]),Fe=useCallback(L=>{B||be(L),r?.(L),w?.(L.id);},[r,w,B]),Xe=useCallback(L=>{t.onCardUpdate?.(L.id,L),be(L);},[t]);return l?jsx("div",{className:g("asakaa-board",qe,o),style:c,children:jsx(ly,{columnCount:3})}):i?jsx("div",{className:g("asakaa-board",qe,o),style:c,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(Hu,{themeName:Ie,children:[jsxs("div",{className:g("flex h-full overflow-hidden",j?"flex-row":""),children:[jsxs(DndContext,{sensors:gt,collisionDetection:closestCorners,onDragStart:Ae,onDragOver:ot,onDragEnd:Lt,children:[jsxs("div",{ref:ze,className:g("asakaa-board",j?"flex-1":"",qe,o),style:{...c,cursor:ge?"grabbing":void 0},"data-theme":Ie,children:[e.columns.sort((L,ae)=>L.position-ae.position).map(L=>{let ae=Ft.get(L.id)||[],R=!$e.includes(L.id),q=a?.renderColumnFooter?.(L);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(Vo,{column:L,cards:ae,renderCard:a?.renderCard,renderColumn:a?.renderColumn,renderHeader:a?.renderColumnHeader,renderEmptyState:a?.renderEmptyState,renderMetrics:W?(U,X)=>W(U,X):void 0,onCardClick:Fe,onCardUpdate:fe,onColumnRename:t.onColumnUpdate?tt:void 0,onColumnDelete:t.onColumnDelete?Be:void 0,isDeletable:R,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight}),q]},L.id)}),d]}),jsx(DragOverlay,{children:ve.draggedCardId?jsx(Ln,{card:e.cards.find(L=>L.id===ve.draggedCardId),render:a?.renderCardOverlay||a?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),j]}),!B&&jsx(ko,{task:Le,isOpen:!!Le,onClose:()=>be(null),onCardUpdate:Xe,theme:De?"dark":"light",locale:n?.locale==="es"?"es":"en",availableUsers:s,availableTags:u,onCreateTag:p,attachments:Le?m?.get(Le.id)||[]:[],onUploadAttachments:f,onDeleteAttachment:x,availableTasks:He,comments:y,onAddComment:b,currentUser:h,mentionableUsers:v,onUploadCommentAttachments:T,enableTimeTracking:E,timeTrackingSummary:F,timeEntries:k,isTimerRunning:D?.isRunning,timerElapsedSeconds:D?.elapsedSeconds,onTimeLog:P,onEstimateUpdate:N,onSoldEffortUpdate:K,onTimerStart:H,onTimerStop:te,onTimerDiscard:I,blurFinancials:_})]})}function ly({columnCount:e}){return jsx(Fragment,{children:Array.from({length:e}).map((t,r)=>jsxs("div",{className:"asakaa-column",children:[jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxs("div",{className:"flex flex-col gap-2",children:[jsx("div",{className:"asakaa-skeleton h-24"}),jsx("div",{className:"asakaa-skeleton h-32"}),jsx("div",{className:"asakaa-skeleton h-28"})]})]},r))})}var my={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 229, 204, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},gy={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#00E5CC",accentLight:"rgba(0, 229, 204, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},fy={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},by={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function hy({columns:e,onSelect:t,theme:r,t:a,createTaskLabel:n}){let[s,o]=useState(false),c=useRef(null);useEffect(()=>{let i=d=>{c.current&&!c.current.contains(d.target)&&o(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let l=i=>{t(i),o(false);};return jsxs("div",{ref:c,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:n||a.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:r.textTertiary},children:a.selectColumn}),e.sort((i,d)=>i.position-d.position).map((i,d)=>jsxs(motion.button,{onClick:()=>l(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:d<e.length-1?`1px solid ${r.borderLight}`:"none"},whileHover:{backgroundColor:r.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:d*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.color||r.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:r.textPrimary},children:i.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:r.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function yy({theme:e,t,onExportCSV:r,onExportJSON:a,onExportExcel:n}){let[s,o]=useState(false),[c,l]=useState(null),i=useRef(null);if(useEffect(()=>{let m=f=>{i.current&&!i.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]),!(r||a||n))return null;let u=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:r},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:a},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:n}].filter(m=>m.handler),p=async(m,f)=>{if(f){l(m);try{await f();}catch(x){console.error(`Export ${m} failed:`,x);}finally{l(null),o(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:u.map((m,f)=>jsxs(motion.button,{onClick:()=>p(m.id,m.handler),disabled:c!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:f<u.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:f*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:c===m.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):m.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:m.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:m.description})]})]},m.id))})})})]})}function xy({onClick:e,label:t}){return jsxs(motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function gc({columns:e,onCreateTask:t,createTaskLabel:r,theme:a="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:c,onExportExcel:l,translations:i,toolbarRightContent:d,toolbarEndContent:u}){let p=a==="dark"?my:gy,m={...n==="es"?fy:by,...i},f=o||c||l;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxs("div",{className:"flex items-center gap-3",children:[d&&jsxs(Fragment,{children:[d,jsx("div",{className:"w-px h-5",style:{backgroundColor:p.borderLight}})]}),f&&jsxs(Fragment,{children:[jsx(yy,{theme:p,t:m,onExportCSV:o,onExportJSON:c,onExportExcel:l}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),u,t&&(s?jsx(hy,{columns:e,onSelect:t,theme:p,t:m,createTaskLabel:r}):jsx(xy,{onClick:()=>t(),label:r||m.newTask}))]})})}function bc({onAddColumn:e,className:t,placeholder:r="Nombre de la columna...",buttonLabel:a="Agregar Columna",disabled:n=false}){let[s,o]=useState(false),[c,l]=useState(""),i=useCallback(()=>{let p=c.trim();p&&(e(p),l(""),o(false));},[c,e]),d=useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(l(""),o(false));},[i]),u=useCallback(()=>{setTimeout(()=>{c.trim()||o(false);},150);},[c]);return s?jsx("div",{className:g("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:c,onChange:p=>l(p.target.value),onKeyDown:d,onBlur:u,placeholder:r,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!c.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:()=>{l(""),o(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:g("asakaa-add-column",t),children:jsxs("button",{onClick:()=>o(true),disabled:n,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),a]})})}function Bs({onSubmit:e,onCancel:t,availableUsers:r=[],isDark:a=true,locale:n="es",defaultDate:s,className:o,dropdownDirection:c="up"}){let[l,i]=useState(""),[d,u]=useState(void 0),[p,m]=useState(null),[f,x]=useState(null),[y,b]=useState(false),[h,v]=useState(false),[w,T]=useState(false),[E,F]=useState(s||new Date),k=useRef(null),D=n==="es",P=c==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{k.current?.focus();},[]);let N=useCallback(()=>{b(false),v(false),T(false);},[]),K=useCallback(()=>{i(""),u(void 0),m(null),x(null),N(),t();},[t,N]),H=useCallback(()=>{let _=l.trim();if(!_)return;let j=r.find(B=>B.id===p),W=f||s;e({name:_,priority:d,assignee:j||void 0,assigneeId:p,startDate:W,endDate:W}),i(""),u(void 0),m(null),x(null),N(),k.current?.focus();},[l,d,p,f,s,r,e,N]),te=useCallback(_=>{_.key==="Enter"&&l.trim()&&(_.preventDefault(),H()),_.key==="Escape"&&K();},[H,K,l]),I=f||s||new Date;return jsxs("div",{className:g("quick-task-create",o),onClick:()=>N(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:k,type:"text",value:l,onChange:_=>i(_.target.value),placeholder:D?"Nombre de la tarea...":"Task name...",className:g("w-full bg-transparent text-sm outline-none font-mono",a?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:te})}),jsxs("div",{className:g("px-2.5 py-2 flex items-center justify-between border-t",a?"border-white/[0.08]":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:_=>{_.stopPropagation(),b(!y),v(false),T(false);},type:"button",className:g("p-1 rounded transition-colors",d?d==="urgent"||d==="high"?"text-red-400 bg-red-500/20":d==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":a?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,y:c==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:c==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:_=>_.stopPropagation(),children:[{id:"urgent",label:D?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:D?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:D?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:D?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:D?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(_=>jsxs("button",{onClick:()=>{u(_.id),b(false);},type:"button",className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",d===_.id&&(a?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",_.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:_.label})]},_.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:_=>{_.stopPropagation(),T(!w),b(false),v(false),F(f||s||new Date);},type:"button",className:g("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",f?a?"bg-[#007FFF]/20 text-[#007FFF]":"bg-[#00E5CC]/20 text-[#00C4AE]":a?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),I.toLocaleDateString(D?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:w&&jsxs(motion.div,{initial:{opacity:0,y:c==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:c==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:_=>_.stopPropagation(),children:[jsx("div",{className:g("w-40 py-2 border-r",a?"border-white/10":"border-gray-200"),children:(()=>{let _=new Date,j=new Date(_);j.setDate(_.getDate()+1);let W=new Date(_);W.setDate(_.getDate()+((6-_.getDay()+7)%7||7));let B=new Date(_);B.setDate(_.getDate()+((1-_.getDay()+7)%7||7));let ve=new Date(_);ve.setDate(_.getDate()+14);let We=new Date(_);We.setDate(_.getDate()+28);let Le=D?"es-ES":"en-US";return [{label:D?"Hoy":"Today",date:_,display:_.toLocaleDateString(Le,{weekday:"short"}).slice(0,3)+"."},{label:D?"Ma\xF1ana":"Tomorrow",date:j,display:j.toLocaleDateString(Le,{weekday:"short"}).slice(0,3)+"."},{label:D?"Este fin de semana":"This weekend",date:W,display:D?"s\xE1b.":"sat."},{label:D?"Pr\xF3xima semana":"Next week",date:B,display:D?"lun.":"mon."},{label:D?"2 semanas":"2 weeks",date:ve,display:ve.toLocaleDateString(Le,{day:"numeric",month:"short"})},{label:D?"4 semanas":"4 weeks",date:We,display:We.toLocaleDateString(Le,{day:"numeric",month:"short"})}].map((ge,ye)=>jsxs("button",{type:"button",className:g("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",a?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{x(ge.date),T(false);},children:[jsx("span",{children:ge.label}),jsx("span",{className:g("text-[10px] font-mono",a?"text-white/30":"text-gray-400"),children:ge.display})]},ye))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:g("text-xs font-medium font-mono",a?"text-white":"text-gray-900"),children:E.toLocaleDateString(D?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>F(new Date),className:g("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",a?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:D?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>F(new Date(E.getFullYear(),E.getMonth()-1)),className:g("p-0.5 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:()=>F(new Date(E.getFullYear(),E.getMonth()+1)),className:g("p-0.5 rounded",a?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(D?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(_=>jsx("div",{className:g("w-6 h-6 flex items-center justify-center text-[10px] font-mono",a?"text-white/30":"text-gray-400"),children:_},_))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let _=E.getFullYear(),j=E.getMonth(),W=new Date(_,j,1).getDay(),B=new Date(_,j+1,0).getDate(),ve=new Date(_,j,0).getDate(),We=new Date().toDateString(),Le=[];for(let ge=W-1;ge>=0;ge--)Le.push({dayNum:ve-ge,isCurrent:false,date:new Date(_,j-1,ve-ge)});for(let ge=1;ge<=B;ge++)Le.push({dayNum:ge,isCurrent:true,date:new Date(_,j,ge)});let be=42-Le.length;for(let ge=1;ge<=be;ge++)Le.push({dayNum:ge,isCurrent:false,date:new Date(_,j+1,ge)});return Le.map((ge,ye)=>{let ze=ge.date.toDateString()===We,ke=(f||s)?.toDateString()===ge.date.toDateString();return jsx("button",{type:"button",className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!ge.isCurrent&&(a?"text-white/20":"text-gray-300"),ge.isCurrent&&(a?"text-white":"text-gray-900"),ze&&"ring-1 ring-[#007FFF]",ke&&"bg-[#007FFF] text-white",!ke&&(a?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(ge.date),T(false);},children:ge.dayNum},ye)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:_=>{_.stopPropagation(),v(!h),b(false),T(false);},type:"button",className:g("p-1 rounded transition-colors",p?"text-[#007FFF] bg-[#007FFF]/20":a?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:p?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:r.find(_=>_.id===p)?.color||"#007FFF"},children:r.find(_=>_.id===p)?.initials||r.find(_=>_.id===p)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:h&&jsxs(motion.div,{initial:{opacity:0,y:c==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:c==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",P,a?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:_=>_.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{m(null),v(false);},className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",!p&&(a?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:g("w-5 h-5 rounded-full flex items-center justify-center",a?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:a?"text-white/40":"text-gray-500",children:D?"Sin asignar":"Unassigned"})]}),r.map(_=>jsxs("button",{type:"button",onClick:()=>{m(_.id),v(false);},className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",a?"hover:bg-white/5":"hover:bg-gray-50",p===_.id&&(a?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:_.color||"#007FFF"},children:_.initials||_.name?.slice(0,2).toUpperCase()}),jsx("span",{className:a?"text-white":"text-gray-900",children:_.name})]},_.id)),r.length===0&&jsx("div",{className:g("px-3 py-2 text-xs font-mono",a?"text-white/30":"text-gray-400"),children:D?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:H,disabled:!l.trim(),type:"button",className:g("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",l.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":a?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:D?"Guardar":"Save"})]})]})}function wc({columnId:e,onAddCard:t,availableUsers:r=[],className:a,buttonLabel:n,disabled:s=false,theme:o="dark",locale:c="es"}){let[l,i]=useState(false),d=useRef(null),u=useRef(null),[p,m]=useState({}),[f,x]=useState(false),y=o==="dark",h={buttonLabel:n||(c==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!l||!d.current)return;let w=90,T=()=>{let E=d.current.getBoundingClientRect(),k=window.innerHeight-E.bottom<w+8;x(k),m({position:"fixed",...k?{bottom:window.innerHeight-E.top+4}:{top:E.bottom+4},left:E.left,width:E.width,zIndex:9999});};return T(),window.addEventListener("scroll",T,true),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,true),window.removeEventListener("resize",T);}},[l]),useEffect(()=>{if(!l)return;let w=T=>{let E=T.target;u.current&&!u.current.contains(E)&&d.current&&!d.current.contains(E)&&i(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[l]);let v=useCallback(w=>{t({name:w.name,columnId:e,assigneeIds:w.assigneeId?[w.assigneeId]:void 0,startDate:w.startDate,endDate:w.endDate,priority:w.priority});},[t,e]);return jsxs("div",{ref:d,className:g("asakaa-add-card",a),children:[jsxs("button",{onClick:()=>i(!l),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),h.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:l&&jsx(motion.div,{ref:u,initial:{opacity:0,y:f?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:f?4:-4,scale:.97},transition:{duration:.12},style:p,className:g("rounded-lg shadow-2xl",y?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(Bs,{onSubmit:v,onCancel:()=>i(false),availableUsers:r,isDark:y,locale:c,dropdownDirection:"up"})})}),document.body)]})}var Os=class extends BaseViewAdapter{constructor(r={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=r,this.options={animations:r.viewOptions?.animations??true,virtualScrolling:r.viewOptions?.virtualScrolling??false,theme:r.viewOptions?.theme??"dark",readonly:r.viewOptions?.readonly??false};}mount(r,a){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=r,this.data=a,this.root=createRoot(r),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(r){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=r,this.render(),this.emit("view:updated",{viewId:this.id,data:r});}configure(r){this.options={...this.options,...r},this.isMounted()&&this.render();}async export(r){if(!this.data)throw new Error("No data to export");switch(r){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${r}`)}}render(){if(!this.root||!this.data)return;let r={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsx(Jn,{board:r,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let r=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(a=>{let n=this.data.columns.find(s=>s.id===a.columnId);r.push([a.id,a.title,n?.title||"",a.description||"",a.labels?.join(", ")||"",a.assignedUserIds?.join(", ")||a.assigneeId||"",a.dueDate?.toString()||"",a.position.toString()]);}),r.map(a=>a.map(n=>`"${n}"`).join(",")).join(`
19
+ `)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let a=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((n,s)=>{a.toBlob(o=>{o?n(o):s(new Error("Failed to create PNG blob"));},"image/png");})}};function Gp(e={}){return new Os(e)}var qo=class extends Component{constructor(r){super(r);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(r){return {hasError:true,error:r}}componentDidCatch(r,a){let{onError:n,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,r),console.error("Error Info:",a)),this.setState({errorInfo:a}),n)try{n(r,a);}catch(o){console.error("Error in error handler:",o);}}render(){let{hasError:r,error:a}=this.state,{children:n,fallback:s,componentName:o}=this.props;return r&&a?s?s(a,this.resetError):jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxs("div",{className:"flex items-start gap-3",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:o?`Error in ${o}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:a.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxs("details",{className:"mb-3",children:[jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:a.stack})]}),jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):n}};function kc(e,t){let r=a=>jsx(qo,{...t,children:jsx(e,{...a})});return r.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,r}function Tc({board:e,onCreateCard:t,onNavigateToCard:r,onSearch:a,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:c,onOpenAIUsage:l,shortcut:i="k",className:d=""}){let[u,p]=useState(false),[m,f]=useState(""),[x,y]=useState("home"),[b,h]=useState(""),[v,w]=useState("");useEffect(()=>{let k=D=>{(D.metaKey||D.ctrlKey)&&D.key===i&&(D.preventDefault(),p(P=>!P)),D.key==="Escape"&&(p(false),y("home"),f(""));};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i]),useEffect(()=>{u||(y("home"),f(""),h(""),w(""));},[u]);let T=useCallback(()=>{p(false);},[]),E=useCallback(k=>{let[D,P]=k.split(":");switch(D){case "create-card":y("create-card");break;case "create-card-in":h(P||"");break;case "navigate":P?(r?.(P),T()):y("navigate");break;case "search":a?.(m),T();break;case "priority":y("priority");break;case "set-priority":v&&P&&(n?.(v,P),T());break;case "assign":y("assign");break;case "assign-user":v&&P&&(s?.(v,P),T());break;case "ai":y("ai");break;case "ai-generate-plan":o?.(),T();break;case "ai-predict-risks":c?.(),T();break;case "ai-usage":l?.(),T();break;case "back":y("home");break;}},[m,v,t,r,a,n,s,o,c,l,T]),F=useCallback(()=>{b&&m.trim()&&(t?.(b,m.trim()),T());},[b,m,t,T]);return u?jsx(lr,{children:jsx("div",{className:"command-palette-overlay",onClick:T,children:jsx("div",{className:`command-palette ${d}`,onClick:k=>k.stopPropagation(),children:jsxs(Command,{value:m,onValueChange:f,label:"Command Menu",children:[jsxs("div",{className:"command-palette-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx(Command.Input,{placeholder:x==="create-card"&&b?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:k=>{k.key==="Enter"&&x==="create-card"&&b&&F();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),x==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:E,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:E,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:E,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:E,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:E,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"?"#00E5CC":"#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(D=>jsx("span",{className:"command-palette-item-label",children:D},D))})]},k.id))})]}),x==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:E,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:E,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))})]}),x==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:E,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 D=e.columns.find(P=>P.id===k.columnId);return jsxs(Command.Item,{value:`navigate:${k.id}`,onSelect:E,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"?"#00E5CC":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:k.title}),jsx("div",{className:"command-palette-item-meta",children:D?.title})]}),k.labels&&k.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:k.labels.slice(0,2).map(P=>jsx("span",{className:"command-palette-item-label",children:P},P))})]},k.id)})})]}),x==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:E,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:E,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:E,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:E,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 _p(e,t,r,a,n){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let o=document.createElement("div");o.id="attachment-lightbox-native",o.className="attachment-lightbox",o.style.cssText=`
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 l=document.createElement("img");l.src=e,l.alt=t,l.className="attachment-lightbox-image",l.style.cssText=`
28
+ `;let c=document.createElement("img");c.src=e,c.alt=t,c.className="attachment-lightbox-image",c.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
- `,l.onclick=m=>m.stopPropagation();let d=document.createElement("div");d.className="attachment-lightbox-hint",d.textContent="Click anywhere or press ESC to close",d.style.cssText=`
33
+ `,c.onclick=u=>u.stopPropagation();let l=document.createElement("div");l.className="attachment-lightbox-hint",l.textContent="Click anywhere or press ESC to close",l.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=()=>{o.remove(),document.removeEventListener("keydown",u);},u=m=>{if(m.key==="Escape")i();else if(m.key==="ArrowLeft"&&a.length>1){let p=r>0?r-1:a.length-1;i(),n(p);}else if(m.key==="ArrowRight"&&a.length>1){let p=r<a.length-1?r+1:0;i(),n(p);}};if(o.onclick=i,document.addEventListener("keydown",u),a.length>1){let m=document.createElement("div");m.className="attachment-lightbox-dots",m.style.cssText=`
41
+ `;let i=()=>{o.remove(),document.removeEventListener("keydown",d);},d=u=>{if(u.key==="Escape")i();else if(u.key==="ArrowLeft"&&r.length>1){let p=a>0?a-1:r.length-1;i(),n(p);}else if(u.key==="ArrowRight"&&r.length>1){let p=a<r.length-1?a+1:0;i(),n(p);}};if(o.onclick=i,document.addEventListener("keydown",d),r.length>1){let u=document.createElement("div");u.className="attachment-lightbox-dots",u.style.cssText=`
42
42
  position: absolute !important;
43
43
  bottom: 48px !important;
44
44
  left: 50% !important;
@@ -48,15 +48,15 @@ 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
- `,m.onclick=f=>f.stopPropagation(),a.forEach((f,v)=>{let y=document.createElement("button");y.className=`attachment-lightbox-dot ${v===r?"active":""}`,y.style.cssText=`
51
+ `,u.onclick=f=>f.stopPropagation(),r.forEach((f,x)=>{let y=document.createElement("button");y.className=`attachment-lightbox-dot ${x===a?"active":""}`,y.style.cssText=`
52
52
  width: 8px !important;
53
53
  height: 8px !important;
54
54
  border-radius: 50% !important;
55
- background: ${v===r?"white":"rgba(255, 255, 255, 0.3)"} !important;
55
+ background: ${x===a?"white":"rgba(255, 255, 255, 0.3)"} !important;
56
56
  border: none !important;
57
57
  padding: 0 !important;
58
58
  cursor: pointer !important;
59
- `,y.onclick=b=>{b.stopPropagation(),i(),n(v);},m.appendChild(y);});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=`
59
+ `,y.onclick=b=>{b.stopPropagation(),i(),n(x);},u.appendChild(y);});let p=document.createElement("button");p.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",p.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',p.style.cssText=`
60
60
  position: absolute !important;
61
61
  left: 0 !important;
62
62
  top: 0 !important;
@@ -69,7 +69,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
69
69
  border: none !important;
70
70
  cursor: pointer !important;
71
71
  opacity: 0.5 !important;
72
- `,p.onmouseenter=()=>{p.style.opacity="1";},p.onmouseleave=()=>{p.style.opacity="0.5";},p.onclick=f=>{f.stopPropagation();let v=r>0?r-1:a.length-1;i(),n(v);};let g=document.createElement("button");g.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",g.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',g.style.cssText=`
72
+ `,p.onmouseenter=()=>{p.style.opacity="1";},p.onmouseleave=()=>{p.style.opacity="0.5";},p.onclick=f=>{f.stopPropagation();let x=a>0?a-1:r.length-1;i(),n(x);};let m=document.createElement("button");m.className="attachment-lightbox-nav-area attachment-lightbox-nav-next",m.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M9 18L15 12L9 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',m.style.cssText=`
73
73
  position: absolute !important;
74
74
  right: 0 !important;
75
75
  top: 0 !important;
@@ -82,7 +82,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
82
82
  border: none !important;
83
83
  cursor: pointer !important;
84
84
  opacity: 0.5 !important;
85
- `,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=f=>{f.stopPropagation();let v=r<a.length-1?r+1:0;i(),n(v);},o.appendChild(m),o.appendChild(p),o.appendChild(g);}o.appendChild(l),o.appendChild(d),document.body.appendChild(o),setTimeout(()=>{d.style.transition="opacity 0.5s ease",d.style.opacity="0";},2e3);}function py(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 my(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 bd(e){return e.startsWith("image/")}function xo({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:n,maxFiles:s=10}){let[o,l]=useState(false),[d,i]=useState(false),[u,m]=useState(null),p=useRef(null),g=useRef(e);g.current=e;let f=useCallback((T,E)=>{E.preventDefault(),E.stopPropagation();let P=g.current.filter(H=>bd(H.type)),k=P.findIndex(H=>H.id===T.id),K=H=>{let ee=g.current.filter(Y=>bd(Y.type)),I=ee[H];I&&Vp(I.url,I.name,ee,H,K);};Vp(T.url,T.name,P,k,K);},[]),v=useCallback(T=>{let E=[],P=[];return e.length+T.length>s?(P.push(`Maximum ${s} files allowed`),{valid:E,errors:P}):(T.forEach(k=>{if(k.size/1048576>r){P.push(`${k.name} is too large (max ${r}MB)`);return}if(n&&!n.some(H=>k.type.match(H))){P.push(`${k.name} has invalid file type`);return}E.push(k);}),{valid:E,errors:P})},[e.length,s,r,n]),y=useCallback(async T=>{let{valid:E,errors:P}=v(T);if(P.length>0){m(P.join(", ")),setTimeout(()=>m(null),5e3);return}if(E.length!==0){i(true),m(null);try{await t?.(E);}catch(k){m(k instanceof Error?k.message:"Upload failed"),setTimeout(()=>m(null),5e3);}finally{i(false);}}},[v,t]),b=useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(true);},[]),h=useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(false);},[]),x=useCallback(T=>{T.preventDefault(),T.stopPropagation();},[]),w=useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(false);let E=Array.from(T.dataTransfer.files);y(E);},[y]),N=useCallback(T=>{let E=T.target.files?Array.from(T.target.files):[];y(E),p.current&&(p.current.value="");},[y]),D=useCallback(()=>{p.current?.click();},[]),A=useCallback(T=>{confirm("Are you sure you want to delete this attachment?")&&a?.(T);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${o?"dragging":""} ${d?"uploading":""}`,onDragEnter:b,onDragLeave:h,onDragOver:x,onDrop:w,onClick:D,children:[jsx("input",{ref:p,type:"file",multiple:true,onChange:N,style:{display:"none"},accept:n?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:d?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:o?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),u&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(T=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:bd(T.type)&&T.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:E=>f(T,E),title:"Click to view full size",children:[jsx("img",{src:T.thumbnailUrl||T.url,alt:T.name,className:"attachment-thumbnail"}),jsx("div",{className:"attachment-thumbnail-overlay",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsx("div",{className:"attachment-icon",children:my(T.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:T.name,children:T.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:py(T.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(T.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>A(T.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},T.id))})]})}function hd({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:n,availableUsers:s=[],comments:o=[],activities:l=[],aiInsights:d=[],attachments:i=[],onAddComment:u,onDeleteComment:m,onUploadAttachments:p,onDeleteAttachment:g,onSuggestAssignee:f,onGenerateSubtasks:v,onEstimateEffort:y,currentUserId:b="user-1"}){let[h,x]=useState("details"),[w,N]=useState(false),[D,A]=useState({}),[T,E]=useState(""),[P,k]=useState(false),[K,H]=useState({});if(!t||!e)return null;let ee=useCallback(()=>{N(false),A({}),x("details"),E(""),H({}),a();},[a]),I=useCallback(()=>{r&&Object.keys(D).length>0&&(r(e.id,D),A({}),N(false));},[e.id,D,r]),Y=useCallback(()=>{n&&window.confirm("Are you sure you want to delete this card?")&&(n(e.id),ee());},[e.id,n,ee]),q=useCallback(()=>{u&&T.trim()&&(u(e.id,T.trim()),E(""));},[e.id,T,u]),V=useCallback(async()=>{if(f){k(true);try{let z=await f(e);H(te=>({...te,assignees:z}));}catch(z){console.error("Failed to suggest assignee:",z);}finally{k(false);}}},[e,f]),B=useCallback(async()=>{if(v){k(true);try{let z=await v(e);H(te=>({...te,subtasks:z}));}catch(z){console.error("Failed to generate subtasks:",z);}finally{k(false);}}},[e,v]),X=useCallback(async()=>{if(y){k(true);try{let z=await y(e);H(te=>({...te,effort:z}));}catch(z){console.error("Failed to estimate effort:",z);}finally{k(false);}}},[e,y]),Te={...e,...D},He=s.filter(z=>Te.assignedUserIds?.includes(z.id));return jsx(ra,{children:jsx("div",{className:"card-detail-overlay",onClick:ee,children:jsxs("div",{className:"card-detail-modal",onClick:z=>z.stopPropagation(),children:[jsxs("div",{className:"card-detail-header",children:[jsxs("div",{className:"card-detail-header-left",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:Te.priority==="URGENT"?"#EF4444":Te.priority==="HIGH"?"#F59E0B":Te.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),w?jsx("input",{type:"text",value:D.title??Te.title,onChange:z=>A({...D,title:z.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:Te.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[w?jsxs(Fragment,{children:[jsx("button",{onClick:I,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{N(false),A({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>N(true),className:"card-detail-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxs("button",{onClick:Y,className:"card-detail-btn card-detail-btn-danger",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsx("button",{onClick:ee,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:()=>x("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:()=>x("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",o.length>0&&jsx("span",{className:"card-detail-tab-badge",children:o.length})]}),jsxs("button",{onClick:()=>x("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:()=>x("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:()=>x("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"}),w?jsx("textarea",{value:D.description??Te.description??"",onChange:z=>A({...D,description:z.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:Te.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),w?jsx("select",{multiple:true,value:D.assignedUserIds??Te.assignedUserIds??[],onChange:z=>{let te=Array.from(z.target.selectedOptions,xe=>xe.value);A({...D,assignedUserIds:te});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(z=>jsx("option",{value:z.id,children:z.name},z.id))}):jsx("div",{className:"card-detail-users",children:He.length>0?He.map(z=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:z.color},children:z.initials}),jsx("span",{children:z.name})]},z.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),w?jsxs("select",{value:D.priority??Te.priority??"",onChange:z=>A({...D,priority:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsx("option",{value:"",children:"None"}),jsx("option",{value:"LOW",children:"LOW"}),jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsx("option",{value:"HIGH",children:"HIGH"}),jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxs("div",{className:"card-detail-priority",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:Te.priority==="URGENT"?"#EF4444":Te.priority==="HIGH"?"#F59E0B":Te.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsx("span",{children:Te.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:Te.labels&&Te.labels.length>0?Te.labels.map(z=>jsx("span",{className:"card-detail-label-tag",children:z},z)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),w?jsx("input",{type:"date",value:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:Te.startDate?new Date(Te.startDate).toISOString().split("T")[0]:"",onChange:z=>A({...D,startDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:Te.startDate?new Date(Te.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),w?jsx("input",{type:"date",value:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:Te.endDate?new Date(Te.endDate).toISOString().split("T")[0]:"",onChange:z=>A({...D,endDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:Te.endDate?new Date(Te.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),w?jsx("input",{type:"number",min:"0",step:"0.5",value:D.estimatedTime??Te.estimatedTime??"",onChange:z=>A({...D,estimatedTime:z.target.value?parseFloat(z.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:Te.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:Te.dependencies&&Te.dependencies.length>0?Te.dependencies.map(z=>{let te=typeof z=="string"?z:z.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",te.slice(-4)]},te)}):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:Te.createdAt?new Date(Te.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:T,onChange:z=>E(z.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:q,disabled:!T.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:o.length>0?o.map(z=>{let te=s.find(xe=>xe.id===z.authorId);return jsxs("div",{className:"card-detail-comment",children:[jsxs("div",{className:"card-detail-comment-header",children:[jsxs("div",{className:"card-detail-comment-author",children:[te&&jsx("div",{className:"card-detail-user-avatar",style:{background:te.color},children:te.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:te?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(z.createdAt).toLocaleString()})]})]}),m&&jsx("button",{onClick:()=>m(z.id),className:"card-detail-comment-delete",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsx("p",{className:"card-detail-comment-content",children:z.content})]},z.id)}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("p",{children:"No comments yet"}),jsx("span",{children:"Be the first to comment"})]})})]}),h==="activity"&&jsx("div",{className:"card-detail-activity",children:l.length>0?jsx("div",{className:"card-detail-activity-list",children:l.map(z=>{let te=s.find(xe=>xe.id===z.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[z.type.includes("CREATED")&&"\u2795",z.type.includes("UPDATED")&&"\u270F\uFE0F",z.type.includes("MOVED")&&"\u27A1\uFE0F",z.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",z.type.includes("COMMENT")&&"\u{1F4AC}",z.type.includes("ASSIGNED")&&"\u{1F464}",z.type.includes("PRIORITY")&&"\u{1F3AF}",z.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",z.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:te?.name||"Unknown"})," ",z.type.replace(/_/g," ").toLowerCase(),z.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:z.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(z.timestamp).toLocaleString()})]})]},z.id)})}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})}),h==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(xo,{cardId:e.id,attachments:i,onUpload:p?z=>p(e.id,z):void 0,onDelete:g,currentUserId:b,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:V,disabled:P||!f,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:B,disabled:P||!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("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:X,disabled:P||!y,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),K.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),K.assignees.map((z,te)=>{let xe=s.find(je=>je.id===z.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[xe&&jsx("div",{className:"card-detail-user-avatar",style:{background:xe.color},children:xe.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:xe?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:z.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(z.confidence*100).toFixed(0),"%"]})]})]},te)})]}),K.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),K.subtasks.map((z,te)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:z.title}),z.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:z.description}),z.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",z.estimatedTime,"h"]})]},te))]}),K.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:[K.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(K.effort.confidence*100).toFixed(0),"%"]})]})]}),d.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),d.map(z=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${z.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:z.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:z.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:z.description}),z.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",z.suggestedAction]})]},z.id))]}),!K.assignees&&!K.subtasks&&!K.effort&&d.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 As({triggerRef:e,isOpen:t,onClose:a,children:r,width:n=200,estimatedHeight:s=300,className:o=""}){let[l,d]=useState({top:0,left:0}),i=useRef(null),u=useCallback(()=>{if(!e.current)return {top:0,left:0};let m=e.current.getBoundingClientRect(),p=window.innerHeight,g=window.innerWidth,f=4,v=m.left;v+n>g-10&&(v=g-n-10),v<10&&(v=10);let y=p-m.bottom,b=m.top,h;return y>=s+f?h=m.bottom+f:b>=s+f?h=m.top-s-f:y>=b?h=m.bottom+f:h=Math.max(10,m.top-s-f),{top:h,left:v}},[e,n,s]);return useEffect(()=>{t&&d(u());},[t,u]),useEffect(()=>{if(!t)return;let m=g=>{let f=g.target;i.current&&!i.current.contains(f)&&e.current&&!e.current.contains(f)&&a();},p=setTimeout(()=>{document.addEventListener("mousedown",m);},0);return ()=>{clearTimeout(p),document.removeEventListener("mousedown",m);}},[t,a,e]),useEffect(()=>{if(!t)return;let m=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),a());};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[t,a]),t?jsx(ra,{children:jsx("div",{ref:i,className:`smart-popover ${o}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,width:`${n}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 xt={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#00E5CC",accentHover:"#5AADFF",accentLight:"rgba(0, 229, 204, 0.12)",taskBarPrimary:"#00E5CC",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#00E5CC",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(0, 229, 204, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(0, 196, 174, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#00E5CC",accentHover:"#1D4ED8",accentLight:"rgba(0, 196, 174, 0.08)",taskBarPrimary:"#00E5CC",taskBarProgress:"#00A893",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#00E5CC",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#00E5CC",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(0, 196, 174, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};var wy=["LOW","MEDIUM","HIGH","URGENT"],ky=["todo","in-progress","review","done"];function vd({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:n,availableUsers:s=[],comments:o=[],activities:l=[],onAddComment:d,onDeleteComment:i,currentUser:u,onAIGenerateDescription:m,onAICreateSubtasks:p,onAIFindSimilar:g,availableColumns:f=[],availableLabels:v=[],availableTags:y=[],onCreateTag:b,onUploadCoverImage:h,unsplashAccessKey:x,theme:w,onSubtasksChange:N,attachments:D=[],onUploadAttachments:A,onDeleteAttachment:T}){let E=Rn(),P=w||E?.themeName||"dark",[k,K]=useState(e),[H,ee]=useState(false),[I,Y]=useState(()=>[...e?.subtasks||[]].sort((ne,ft)=>(ne.position??0)-(ft.position??0))),[q,V]=useState(false),[B,X]=useState(""),[Te,He]=useState(""),[z,te]=useState("all"),[xe,je]=useState(false),[Ne,ze]=useState(false),[Me,at]=useState(false),[be,pt]=useState(false),[Ke,Ue]=useState(false),[kt,Ht]=useState(false),qe=useRef(null),We=useRef(null),ot=useRef(null),zt=useRef(null),Ee=useRef(null),nt=useRef(null),F=useRef(null),le=useRef(null),R=useRef(null),J=useRef(null),O=useRef(null),Z=useRef(null);useEffect(()=>{if(e&&!k){K({...e});let W=[...e.subtasks||[]].sort((ne,ft)=>(ne.position??0)-(ft.position??0));Y(W);}else if(e&&k&&e.id!==k.id){K({...e});let W=[...e.subtasks||[]].sort((ne,ft)=>(ne.position??0)-(ft.position??0));Y(W);}},[e,k]),useEffect(()=>{let W=ne=>{let ft=ne.target;zt.current&&!zt.current.contains(ft)&&je(false),Ee.current&&!Ee.current.contains(ft)&&ze(false),nt.current&&!nt.current.contains(ft)&&at(false),F.current&&!F.current.contains(ft)&&pt(false);};if(xe||Ne||Me||be)return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[xe,Ne,Me,be]),useEffect(()=>{if(!t)return;let W=ne=>{let ft=ne.target,Tt=ft.tagName==="INPUT"||ft.tagName==="TEXTAREA"||ft.isContentEditable;if(ne.key==="Escape"){ne.preventDefault(),xe||Ne||Me||be||Ke||kt?(je(false),ze(false),at(false),pt(false),Ue(false),Ht(false)):Tt||a();return}if(Tt&&ne.key!=="Escape")return;let pa=ne.metaKey||ne.ctrlKey;switch(ne.key.toLowerCase()){case "s":ne.preventDefault(),je(true);break;case "a":ne.preventDefault(),at(true);break;case "p":ne.preventDefault(),ze(true);break;case "l":ne.preventDefault(),pt(true);break;case "d":pa||(ne.preventDefault(),Ue(true),setTimeout(()=>le.current?.focus(),0));break;case "e":pa||(ne.preventDefault(),Ht(true));break;case "i":ne.preventDefault(),ee(true),setTimeout(()=>We.current?.focus(),0);break;case "t":ne.preventDefault(),V(true);break;case "c":ne.preventDefault(),ot.current?.focus();break}};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[t,a,xe,Ne,Me,be,Ke,kt]);let Ve=useCallback(W=>{let ne=W.currentTarget.textContent?.trim()||"";if(k&&ne!==k.title){let ft={...k,title:ne};K(ft),r?.(k.id,{title:ne});}},[k,r]),ke=useCallback(W=>{W.key==="Enter"&&(W.preventDefault(),W.currentTarget.blur()),W.key==="Escape"&&(W.preventDefault(),W.currentTarget.textContent=k?.title||"",W.currentTarget.blur());},[k]),Re=useCallback(()=>{k&&e&&k.description!==e.description&&r?.(k.id,{description:k.description}),ee(false);},[k,e,r]),Ae=useCallback(W=>{if(k){let ne={...k,columnId:W};K(ne),r?.(k.id,{columnId:W}),je(false);}},[k,r]),Pe=useCallback(W=>{if(k){let ne={...k,priority:W};K(ne),r?.(k.id,{priority:W}),ze(false);}},[k,r]),ct=useCallback(W=>{if(k){let ne=k.assignedUserIds||[],ft=ne.includes(W)?ne.filter(pa=>pa!==W):[...ne,W],Tt={...k,assignedUserIds:ft};K(Tt),r?.(k.id,{assignedUserIds:ft});}},[k,r]),Qe=useCallback(W=>{if(k){let ne=k.labels||[],ft=ne.includes(W)?ne.filter(pa=>pa!==W):[...ne,W],Tt={...k,labels:ft};K(Tt),r?.(k.id,{labels:ft});}},[k,r]),st=useCallback(W=>{if(k){let ne={...k,tags:W};K(ne),r?.(k.id,{tags:W});}},[k,r]),mt=useCallback(W=>{if(k){let ne=W.target.value,ft={...k,endDate:ne};K(ft),r?.(k.id,{endDate:ne}),Ue(false);}},[k,r]),jt=useCallback(W=>{if(k){let ne={...k,estimatedTime:parseFloat(W)||0};K(ne),r?.(k.id,{estimatedTime:parseFloat(W)||0});}},[k,r]),St=useCallback(()=>{if(B.trim()&&k){let W={id:`subtask-${Date.now()}`,title:B.trim(),completed:false,position:I.length,createdAt:new Date},ne=[...I,W];Y(ne),X(""),V(false),N?.(k.id,ne);}},[B,I,k,N]),Ut=useCallback(W=>{let ne=I.map(ft=>ft.id===W?{...ft,completed:!ft.completed,updatedAt:new Date}:ft);Y(ne),k&&N?.(k.id,ne);},[I,k,N]),gt=useCallback(W=>{let ne=I.filter(ft=>ft.id!==W);Y(ne),k&&N?.(k.id,ne);},[I,k,N]),Mt=useCallback(()=>{Te.trim()&&k&&d&&(d(k.id,Te.trim()),He(""));},[Te,k,d]),Bt=useCallback(W=>{(W.metaKey||W.ctrlKey)&&W.key==="Enter"&&(W.preventDefault(),Mt());},[Mt]),_t=W=>jsx(yy,{remarkPlugins:[xy],rehypePlugins:[vy],components:{a:({node:ne,...ft})=>jsx("a",{...ft,target:"_blank",rel:"noopener noreferrer"})},children:W}),Wt=l.filter(W=>z==="comments"?W.type.includes("COMMENT"):z==="history"?!W.type.includes("COMMENT"):true);if(!t||!e)return null;let rt=k||e,da=s.filter(W=>rt.assignedUserIds?.includes(W.id)),ha=I.filter(W=>W.completed).length;return jsx(ra,{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:W=>W.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":P,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:qe,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Ve,onKeyDown:ke,children:rt.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:zt,children:[jsxs("button",{ref:R,className:"modal-v2-field",onClick:()=>je(!xe),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:rt.columnId||"No status"})]}),jsx(As,{triggerRef:R,isOpen:xe,onClose:()=>je(false),width:250,estimatedHeight:200,children:(f.length>0?f:ky.map(W=>({id:W,title:W}))).map(W=>jsx("button",{className:`modal-v2-popover-item ${rt.columnId===W.id?"active":""}`,onClick:()=>Ae(W.id),children:W.title},W.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:nt,children:[jsxs("button",{ref:J,className:"modal-v2-field",onClick:()=>at(!Me),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:da.length>0?jsx("div",{className:"modal-v2-avatars",children:da.map(W=>jsx("div",{className:"modal-v2-avatar",style:{background:W.color},title:W.name,children:W.initials},W.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(As,{triggerRef:J,isOpen:Me,onClose:()=>at(false),width:280,estimatedHeight:300,children:s.map(W=>jsxs("button",{className:`modal-v2-popover-item ${rt.assignedUserIds?.includes(W.id)?"active":""}`,onClick:()=>ct(W.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:W.color},children:W.initials}),W.name,rt.assignedUserIds?.includes(W.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"})})]},W.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:Ee,children:[jsxs("button",{ref:O,className:"modal-v2-field",onClick:()=>ze(!Ne),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:rt.priority||"None"})]}),jsxs(As,{triggerRef:O,isOpen:Ne,onClose:()=>ze(false),width:180,estimatedHeight:220,children:[wy.map(W=>jsx("button",{className:`modal-v2-popover-item priority-${W.toLowerCase()} ${rt.priority===W?"active":""}`,onClick:()=>Pe(W),children:W},W)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>Pe(""),children:"None"})]})]}),y.length>0||b?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(Wo,{selectedTags:rt.tags||[],availableTags:y,onChange:st,onCreateTag:b,theme:xt[P]||xt.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:F,children:[jsxs("button",{ref:Z,className:"modal-v2-field",onClick:()=>pt(!be),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.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:rt.labels&&rt.labels.length>0?jsx("span",{children:rt.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(As,{triggerRef:Z,isOpen:be,onClose:()=>pt(false),width:220,estimatedHeight:200,children:(v.length>0?v:["Bug","Feature","Enhancement","Documentation"]).map(W=>jsxs("button",{className:`modal-v2-popover-item ${rt.labels?.includes(W)?"active":""}`,onClick:()=>Qe(W),children:[W,rt.labels?.includes(W)&&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"})})]},W))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{Ue(!Ke),setTimeout(()=>le.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:rt.endDate?new Date(rt.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:le,type:"date",value:typeof rt.endDate=="string"?rt.endDate.split("T")[0]:rt.endDate?(()=>{let W=new Date(rt.endDate),ne=W.getUTCFullYear(),ft=String(W.getUTCMonth()+1).padStart(2,"0"),Tt=String(W.getUTCDate()).padStart(2,"0");return `${ne}-${ft}-${Tt}`})():"",onChange:mt,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>Ht(!kt),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:rt.estimatedTime?`${rt.estimatedTime}h`:"Not set"})]}),kt&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:rt.estimatedTime||"",onChange:W=>jt(W.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Ht(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"})]}),H?jsx("textarea",{className:"modal-v2-textarea",value:rt.description||"",onChange:W=>{if(k){let ne={...k,description:W.target.value};K(ne);}},onBlur:Re,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>ee(true),children:rt.description?jsx("div",{className:"modal-v2-markdown",children:_t(rt.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"}),I.length>0&&jsxs("span",{className:"modal-v2-count",children:[ha,"/",I.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>V(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:[I.map(W=>jsxs("div",{className:`modal-v2-subtask ${W.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Ut(W.id),children:W.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:W.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>gt(W.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"})]})})]},W.id)),q&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:B,onChange:W=>X(W.target.value),onKeyDown:W=>{W.key==="Enter"&&St(),W.key==="Escape"&&(V(false),X(""));},onBlur:St,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(A||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(xo,{cardId:rt.id,attachments:D,onUpload:A?W=>A(rt.id,W):void 0,onDelete:T,maxSizeMB:10,maxFiles:20})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("h2",{children:"Activity"}),jsxs("div",{className:"modal-v2-filters",children:[jsx("button",{className:`modal-v2-filter ${z==="all"?"active":""}`,onClick:()=>te("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${z==="comments"?"active":""}`,onClick:()=>te("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${z==="history"?"active":""}`,onClick:()=>te("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[u&&jsx("div",{className:"modal-v2-avatar",style:{background:u.color},children:u.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:ot,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:Te,onChange:W=>He(W.target.value),onKeyDown:Bt,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:Mt,disabled:!Te.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[Wt.map(W=>{let ne=s.find(Tt=>Tt.id===W.userId);if(W.type.includes("COMMENT")){let Tt=o.find(pa=>pa.id===W.metadata?.commentId);return Tt?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ne&&jsx("div",{className:"modal-v2-avatar",style:{background:ne.color},children:ne.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:ne?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:Tt.content})]})]},W.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[W.type.includes("CREATED")&&"\u2795",W.type.includes("UPDATED")&&"\u270F\uFE0F",W.type.includes("MOVED")&&"\u27A1\uFE0F",W.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",W.type.includes("ASSIGNED")&&"\u{1F464}",W.type.includes("PRIORITY")&&"\u{1F3AF}",W.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:ne?.name||"Unknown"})," ",W.type.replace(/_/g," ").toLowerCase(),W.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:W.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]})]},W.id)}),Wt.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function Fy({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 kd({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:n=true}){let s=e.map(o=>({...o,average:o.average??e.reduce((l,d)=>l+d.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(Fy,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),n&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#00E5CC",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#00E5CC",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((o,l)=>o+l.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((o,l)=>o+l.completed,0)/e.length).toFixed(1)})]}),n&&e.some(o=>o.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:e.reduce((o,l)=>o+(l.planned||0),0)})]})]})]})}function zy({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 Cd({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:n=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),o=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,d=s>0?(s-o)/s*100:0,i=o<=l;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(n?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(zy,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:d>=50?"#10B981":"#F59E0B"},children:[d.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:o})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Yy={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},Qp=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Xy({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:n,percent:s}){let o=r+(n-r)*.5,l=e+o*Math.cos(-a*(Math.PI/180)),d=t+o*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:l,y:d,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Zp({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,n=r>0?(a.value/r*100).toFixed(1):"0";return jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsx("strong",{children:a.value})]}),jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxs("strong",{children:[n,"%"]})]})]})}function Td({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:n=true}){let s=e.reduce((d,i)=>d+i.value,0),o=e.map(d=>({...d,totalValue:s,color:d.color||Yy[d.name]||Qp[e.indexOf(d)%Qp.length]})),l=o.map(d=>d.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:o,cx:"50%",cy:"50%",labelLine:false,label:n?Xy:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:o.map((d,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(Zp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(d,i)=>{let u=i.payload,m=s>0?(u.value/s*100).toFixed(0):"0";return `${d} (${u.value} - ${m}%)`}})]}):jsxs(BarChart$1,{data:o,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Zp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:o.map((d,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((d,i)=>i.value>d.value?i:d).name})]})]})]})}var Ri=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:n=[],availableLabels:s=[]})=>{let[o,l]=useState(false),[d,i]=useState(false),[u,m]=useState(false),[p,g]=useState(false);if(e.length===0)return null;let f=e.map(w=>w.id),v=w=>{r.onBulkUpdate?.(f,{priority:w}),l(false);},y=w=>{r.onBulkMove?.(f,w),i(false),a();},b=w=>{r.onBulkUpdate?.(f,{assignedUserIds:w}),m(false);},h=w=>{let N=new Set;e.forEach(A=>{A.labels?.forEach(T=>N.add(T));});let D=Array.from(new Set([...N,...w]));r.onBulkUpdate?.(f,{labels:D}),g(false);},x=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(f),a());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!o),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),o&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(w),children:[jsx("span",{className:c("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),n.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!d),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),d&&jsx("div",{className:"asakaa-bulk-menu",children:n.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(w.id),children:w.title},w.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!u),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([w.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!p),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([w]),children:w},w))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:x,title:"Delete selected cards",children:jsx("span",{className:"text-sm",children:"Delete"})}),jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});Ri.displayName="BulkOperationsToolbar";function tx(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(n=>{let s,o,l,d,i;switch(t){case "assignee":let u=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);u.length>0?u.forEach(g=>{let f=a?.find(v=>v.id===g);o=`assignee-${g}`,l=f?.name||`User ${g}`,d=f?.color,i=f?.avatar,r.has(o)||r.set(o,{id:o,title:l,groupValue:g,cardIds:[],color:d,icon:i}),r.get(o).cardIds.push(n.id);}):(o="assignee-unassigned",l="Unassigned",d="#6b7280",i="\u{1F464}",r.has(o)||r.set(o,{id:o,title:l,groupValue:null,cardIds:[],color:d,icon:i}),r.get(o).cardIds.push(n.id));break;case "priority":s=n.priority||"NONE",o=`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,d=p.color,r.has(o)||r.set(o,{id:o,title:l,groupValue:s,cardIds:[],color:d}),r.get(o).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(g=>{o=`label-${g}`,l=g,d="#6b7280",r.has(o)||r.set(o,{id:o,title:l,groupValue:g,cardIds:[],color:d}),r.get(o).cardIds.push(n.id);}):(o="label-none",l="No Labels",d="#6b7280",r.has(o)||r.set(o,{id:o,title:l,groupValue:null,cardIds:[],color:d}),r.get(o).cardIds.push(n.id));break}}),Array.from(r.values()).sort((n,s)=>n.title.localeCompare(s.title))}function Nd({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:n,swimlanes:s,renderSwimlaneHeader:o,renderProps:l,config:d,onCardClick:i,suppressDetailModal:u,availableTags:m,attachmentsByCard:p,renderColumnMetrics:g}){let[f,v]=useState(()=>{let x=new Set;if(s)for(let w of s)w.isCollapsed&&x.add(w.id);return x}),y=useMemo(()=>s||tx(e.cards,t.groupBy,a),[s,e.cards,t.groupBy,a]),b={callbacks:r,availableUsers:a,renderProps:l,config:d,onCardClick:i,suppressDetailModal:u,availableTags:m,attachmentsByCard:p,renderColumnMetrics:g},h=useCallback(x=>{v(w=>{let N=new Set(w);return N.has(x)?N.delete(x):N.add(x),N});},[]);return !s&&(t.groupBy==="none"||y.length===0)?jsx(jo,{board:e,className:n,...b}):jsxs("div",{className:c("asakaa-swimlane-view",n),children:[y.map(x=>{let w=f.has(x.id),N=e.cards.filter(A=>x.cardIds.includes(A.id)),D={...e,cards:N};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[o?o({lane:x,isCollapsed:w,cardCount:x.cardIds.length,onToggleCollapse:()=>h(x.id)}):jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&h(x.id),style:{borderLeft:x.color?`4px solid ${x.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[x.icon&&jsx("span",{className:"text-2xl leading-none",children:x.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:x.color},children:x.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",x.cardIds.length," ",x.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":w?"Expand lane":"Collapse lane",children:w?"\u25B6":"\u25BC"})]}),!w&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(jo,{board:D,...b})})]},x.id)}),y.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 Dd=[{value:"none",label:"No Grouping",icon:"\u{1F4CB}",description:"Standard Kanban board view"},{value:"assignee",label:"By Assignee",icon:"\u{1F465}",description:"Group cards by assigned user"},{value:"priority",label:"By Priority",icon:"\u{1F3AF}",description:"Group cards by priority level"},{value:"label",label:"By Label",icon:"\u{1F3F7}\uFE0F",description:"Group cards by label/tag"}];function Sd({value:e,onChange:t,className:a}){let[r,n]=useState(false),s=useRef(null),o=useRef(null),l=Dd.find(i=>i.value===e)||Dd[0];useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),n(false);};return jsxs("div",{className:c("relative inline-block",a),children:[jsxs("button",{ref:o,onClick:()=>n(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:l.icon}),jsx("span",{children:l.label}),jsx("svg",{className:c("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:Dd.map(i=>jsxs("button",{onClick:()=>d(i.value),className:c("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsx("span",{className:"text-[#00E5CC] text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Ls=[{keys:"ArrowUp",action:"navigate_up",description:"Navigate to card above"},{keys:"ArrowDown",action:"navigate_down",description:"Navigate to card below"},{keys:"ArrowLeft",action:"navigate_left",description:"Navigate to previous column"},{keys:"ArrowRight",action:"navigate_right",description:"Navigate to next column"},{keys:"Enter",action:"open_card",description:"Open selected card"},{keys:"Escape",action:"close_modal",description:"Close modal or dialog"},{keys:"Delete",action:"delete_card",description:"Delete selected card",modifiers:{shift:true}},{keys:"n",action:"new_card",description:"Create new card",modifiers:{ctrl:true}},{keys:"k",action:"search",description:"Open search/command palette",modifiers:{ctrl:true}},{keys:"s",action:"save",description:"Save changes",modifiers:{ctrl:true}},{keys:"z",action:"undo",description:"Undo last action",modifiers:{ctrl:true}},{keys:"y",action:"redo",description:"Redo last undone action",modifiers:{ctrl:true}},{keys:"a",action:"select_all",description:"Select all cards",modifiers:{ctrl:true}},{keys:"Escape",action:"deselect_all",description:"Deselect all cards"},{keys:"?",action:"show_shortcuts",description:"Show keyboard shortcuts help",modifiers:{shift:true}}];function ox(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let n=t.modifiers||{},s=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,o=n.shift?e.shiftKey:!e.shiftKey,l=n.alt?e.altKey:!e.altKey,d=n.meta?e.metaKey:true;return s&&o&&l&&d}function om(e={}){let{shortcuts:t=Ls,enabled:a=true,preventDefault:r=true}=e,n=useRef(t),s=useRef(a);useEffect(()=>{n.current=t,s.current=a;},[t,a]);let o=useCallback(d=>{n.current=[...n.current,d];},[]),l=useCallback(d=>{n.current=n.current.filter(i=>i.action!==d);},[]);return useEffect(()=>{function d(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let m of n.current)if(ox(i,m)){r&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:m.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[r]),{registerShortcut:o,unregisterShortcut:l,isEnabled:a}}function sx(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function ix(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 lx(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=ix(e),r=t?sx(t):"";return a?`${a} + ${r}`:r}function dx(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 Ed({shortcuts:e=Ls,isOpen:t,onClose:a,className:r}){let[n,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function l(d){d.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!n||!t)return null;let o=dx(e);return jsxs("div",{className:c("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(o).map(([l,d])=>d.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-[#00E5CC] rounded-full"}),l]}),jsx("div",{className:"space-y-3",children:d.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:lx(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 Md=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
85
+ `,m.onmouseenter=()=>{m.style.opacity="1";},m.onmouseleave=()=>{m.style.opacity="0.5";},m.onclick=f=>{f.stopPropagation();let x=a<r.length-1?a+1:0;i(),n(x);},o.appendChild(u),o.appendChild(p),o.appendChild(m);}o.appendChild(c),o.appendChild(l),document.body.appendChild(o),setTimeout(()=>{l.style.transition="opacity 0.5s ease",l.style.opacity="0";},2e3);}function Iy(e){if(e===0)return "0 Bytes";let t=1024,r=["Bytes","KB","MB","GB"],a=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,a)*100)/100+" "+r[a]}function Ry(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 Dc(e){return e.startsWith("image/")}function Yo({attachments:e=[],onUpload:t,onDelete:r,maxSizeMB:a=10,allowedTypes:n,maxFiles:s=10}){let[o,c]=useState(false),[l,i]=useState(false),[d,u]=useState(null),p=useRef(null),m=useRef(e);m.current=e;let f=useCallback((k,D)=>{D.preventDefault(),D.stopPropagation();let P=m.current.filter(H=>Dc(H.type)),N=P.findIndex(H=>H.id===k.id),K=H=>{let te=m.current.filter(_=>Dc(_.type)),I=te[H];I&&_p(I.url,I.name,te,H,K);};_p(k.url,k.name,P,N,K);},[]),x=useCallback(k=>{let D=[],P=[];return e.length+k.length>s?(P.push(`Maximum ${s} files allowed`),{valid:D,errors:P}):(k.forEach(N=>{if(N.size/1048576>a){P.push(`${N.name} is too large (max ${a}MB)`);return}if(n&&!n.some(H=>N.type.match(H))){P.push(`${N.name} has invalid file type`);return}D.push(N);}),{valid:D,errors:P})},[e.length,s,a,n]),y=useCallback(async k=>{let{valid:D,errors:P}=x(k);if(P.length>0){u(P.join(", ")),setTimeout(()=>u(null),5e3);return}if(D.length!==0){i(true),u(null);try{await t?.(D);}catch(N){u(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>u(null),5e3);}finally{i(false);}}},[x,t]),b=useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(true);},[]),h=useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(false);},[]),v=useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),w=useCallback(k=>{k.preventDefault(),k.stopPropagation(),c(false);let D=Array.from(k.dataTransfer.files);y(D);},[y]),T=useCallback(k=>{let D=k.target.files?Array.from(k.target.files):[];y(D),p.current&&(p.current.value="");},[y]),E=useCallback(()=>{p.current?.click();},[]),F=useCallback(k=>{confirm("Are you sure you want to delete this attachment?")&&r?.(k);},[r]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${o?"dragging":""} ${l?"uploading":""}`,onDragEnter:b,onDragLeave:h,onDragOver:v,onDrop:w,onClick:E,children:[jsx("input",{ref:p,type:"file",multiple:true,onChange:T,style:{display:"none"},accept:n?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:l?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:o?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",a,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),d&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:d})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(k=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Dc(k.type)&&k.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:D=>f(k,D),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:Ry(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:Iy(k.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(k.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>F(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 Gy({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((r,a)=>jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsx("strong",{children:r.value})," cards"]},a))]})}function Ec({data:e,title:t="Team Velocity",height:r=300,showAverage:a=true,showPlanned:n=true}){let s=e.map(o=>({...o,average:o.average??e.reduce((c,l)=>c+l.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Gy,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),n&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#00E5CC",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#00E5CC",r:4}}),a&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((o,c)=>o+c.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((o,c)=>o+c.completed,0)/e.length).toFixed(1)})]}),n&&e.some(o=>o.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:e.reduce((o,c)=>o+(c.planned||0),0)})]})]})]})}function Qy({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((r,a)=>jsxs("p",{className:"chart-tooltip-value",style:{color:r.color},children:[r.name,": ",jsx("strong",{children:r.value})," tasks"]},a))]})}function Mc({data:e,title:t="Sprint Burndown",height:r=300,totalTasks:a,useArea:n=false}){let s=a??(e[0]?.ideal||e[0]?.remaining||0),o=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,l=s>0?(s-o)/s*100:0,i=o<=c;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:jsxs(n?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Qy,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",fill:i?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:l>=50?"#10B981":"#F59E0B"},children:[l.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:o})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var ix={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},em=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function lx({cx:e,cy:t,midAngle:r,innerRadius:a,outerRadius:n,percent:s}){let o=a+(n-a)*.5,c=e+o*Math.cos(-r*(Math.PI/180)),l=t+o*Math.sin(-r*(Math.PI/180));return s<.05?null:jsx("text",{x:c,y:l,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function tm({active:e,payload:t}){if(!e||!t||!t.length)return null;let r=t[0].payload,a=t[0].payload.totalValue||0,n=a>0?(r.value/a*100).toFixed(1):"0";return jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:r.name}),jsxs("p",{className:"chart-tooltip-value",style:{color:r.color||t[0].color},children:["Count: ",jsx("strong",{children:r.value})]}),jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxs("strong",{children:[n,"%"]})]})]})}function Pc({data:e,title:t="Distribution",type:r="pie",height:a=300,showPercentages:n=true}){let s=e.reduce((l,i)=>l+i.value,0),o=e.map(l=>({...l,totalValue:s,color:l.color||ix[l.name]||em[e.indexOf(l)%em.length]})),c=o.map(l=>l.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:r==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:o,cx:"50%",cy:"50%",labelLine:false,label:n?lx:false,outerRadius:a*.35,fill:"#8884d8",dataKey:"value",children:o.map((l,i)=>jsx(Cell,{fill:c[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(tm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(l,i)=>{let d=i.payload,u=s>0?(d.value/s*100).toFixed(0):"0";return `${l} (${d.value} - ${u}%)`}})]}):jsxs(BarChart$1,{data:o,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(tm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:o.map((l,i)=>jsx(Cell,{fill:c[i]},`cell-${i}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((l,i)=>i.value>l.value?i:l).name})]})]})]})}var zi=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:r,callbacks:a,columns:n=[],availableLabels:s=[]})=>{let[o,c]=useState(false),[l,i]=useState(false),[d,u]=useState(false),[p,m]=useState(false);if(e.length===0)return null;let f=e.map(w=>w.id),x=w=>{a.onBulkUpdate?.(f,{priority:w}),c(false);},y=w=>{a.onBulkMove?.(f,w),i(false),r();},b=w=>{a.onBulkUpdate?.(f,{assignedUserIds:w}),u(false);},h=w=>{let T=new Set;e.forEach(F=>{F.labels?.forEach(k=>T.add(k));});let E=Array.from(new Set([...T,...w]));a.onBulkUpdate?.(f,{labels:E}),m(false);},v=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(a.onBulkDelete?.(f),r());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!o),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),o&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(w),children:[jsx("span",{className:g("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),n.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!l),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),l&&jsx("div",{className:"asakaa-bulk-menu",children:n.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(w.id),children:w.title},w.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!d),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),d&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([w.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!p),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([w]),children:w},w))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:v,title:"Delete selected cards",children:jsx("span",{className:"text-sm",children:"Delete"})}),jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:r,title:"Clear selection",children:jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});zi.displayName="BulkOperationsToolbar";function mx(e,t,r){if(t==="none")return [];let a=new Map;return e.forEach(n=>{let s,o,c,l,i;switch(t){case "assignee":let d=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);d.length>0?d.forEach(m=>{let f=r?.find(x=>x.id===m);o=`assignee-${m}`,c=f?.name||`User ${m}`,l=f?.color,i=f?.avatar,a.has(o)||a.set(o,{id:o,title:c,groupValue:m,cardIds:[],color:l,icon:i}),a.get(o).cardIds.push(n.id);}):(o="assignee-unassigned",c="Unassigned",l="#6b7280",i="\u{1F464}",a.has(o)||a.set(o,{id:o,title:c,groupValue:null,cardIds:[],color:l,icon:i}),a.get(o).cardIds.push(n.id));break;case "priority":s=n.priority||"NONE",o=`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];c=p.title,l=p.color,a.has(o)||a.set(o,{id:o,title:c,groupValue:s,cardIds:[],color:l}),a.get(o).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(m=>{o=`label-${m}`,c=m,l="#6b7280",a.has(o)||a.set(o,{id:o,title:c,groupValue:m,cardIds:[],color:l}),a.get(o).cardIds.push(n.id);}):(o="label-none",c="No Labels",l="#6b7280",a.has(o)||a.set(o,{id:o,title:c,groupValue:null,cardIds:[],color:l}),a.get(o).cardIds.push(n.id));break}}),Array.from(a.values()).sort((n,s)=>n.title.localeCompare(s.title))}function Fc({board:e,swimlaneConfig:t,availableUsers:r,callbacks:a,className:n,swimlanes:s,renderSwimlaneHeader:o,renderProps:c,config:l,onCardClick:i,suppressDetailModal:d,availableTags:u,attachmentsByCard:p,renderColumnMetrics:m}){let[f,x]=useState(()=>{let v=new Set;if(s)for(let w of s)w.isCollapsed&&v.add(w.id);return v}),y=useMemo(()=>s||mx(e.cards,t.groupBy,r),[s,e.cards,t.groupBy,r]),b={callbacks:a,availableUsers:r,renderProps:c,config:l,onCardClick:i,suppressDetailModal:d,availableTags:u,attachmentsByCard:p,renderColumnMetrics:m},h=useCallback(v=>{x(w=>{let T=new Set(w);return T.has(v)?T.delete(v):T.add(v),T});},[]);return !s&&(t.groupBy==="none"||y.length===0)?jsx(Jn,{board:e,className:n,...b}):jsxs("div",{className:g("asakaa-swimlane-view",n),children:[y.map(v=>{let w=f.has(v.id),T=e.cards.filter(F=>v.cardIds.includes(F.id)),E={...e,cards:T};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[o?o({lane:v,isCollapsed:w,cardCount:v.cardIds.length,onToggleCollapse:()=>h(v.id)}):jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&h(v.id),style:{borderLeft:v.color?`4px solid ${v.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[v.icon&&jsx("span",{className:"text-2xl leading-none",children:v.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:v.color},children:v.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",v.cardIds.length," ",v.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":w?"Expand lane":"Collapse lane",children:w?"\u25B6":"\u25BC"})]}),!w&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(Jn,{board:E,...b})})]},v.id)}),y.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 Lc=[{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 Ac({value:e,onChange:t,className:r}){let[a,n]=useState(false),s=useRef(null),o=useRef(null),c=Lc.find(i=>i.value===e)||Lc[0];useEffect(()=>{function i(d){s.current&&!s.current.contains(d.target)&&o.current&&!o.current.contains(d.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let l=i=>{t(i),n(false);};return jsxs("div",{className:g("relative inline-block",r),children:[jsxs("button",{ref:o,onClick:()=>n(!a),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:c.icon}),jsx("span",{children:c.label}),jsx("svg",{className:g("w-4 h-4 transition-transform",a&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsx("div",{className:"py-1",children:Lc.map(i=>jsxs("button",{onClick:()=>l(i.value),className:g("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:i.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:i.label}),e===i.value&&jsx("span",{className:"text-[#00E5CC] text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Us=[{keys:"ArrowUp",action:"navigate_up",description:"Navigate to card above"},{keys:"ArrowDown",action:"navigate_down",description:"Navigate to card below"},{keys:"ArrowLeft",action:"navigate_left",description:"Navigate to previous column"},{keys:"ArrowRight",action:"navigate_right",description:"Navigate to next column"},{keys:"Enter",action:"open_card",description:"Open selected card"},{keys:"Escape",action:"close_modal",description:"Close modal or dialog"},{keys:"Delete",action:"delete_card",description:"Delete selected card",modifiers:{shift:true}},{keys:"n",action:"new_card",description:"Create new card",modifiers:{ctrl:true}},{keys:"k",action:"search",description:"Open search/command palette",modifiers:{ctrl:true}},{keys:"s",action:"save",description:"Save changes",modifiers:{ctrl:true}},{keys:"z",action:"undo",description:"Undo last action",modifiers:{ctrl:true}},{keys:"y",action:"redo",description:"Redo last undone action",modifiers:{ctrl:true}},{keys:"a",action:"select_all",description:"Select all cards",modifiers:{ctrl:true}},{keys:"Escape",action:"deselect_all",description:"Deselect all cards"},{keys:"?",action:"show_shortcuts",description:"Show keyboard shortcuts help",modifiers:{shift:true}}];function bx(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let n=t.modifiers||{},s=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,o=n.shift?e.shiftKey:!e.shiftKey,c=n.alt?e.altKey:!e.altKey,l=n.meta?e.metaKey:true;return s&&o&&c&&l}function sm(e={}){let{shortcuts:t=Us,enabled:r=true,preventDefault:a=true}=e,n=useRef(t),s=useRef(r);useEffect(()=>{n.current=t,s.current=r;},[t,r]);let o=useCallback(l=>{n.current=[...n.current,l];},[]),c=useCallback(l=>{n.current=n.current.filter(i=>i.action!==l);},[]);return useEffect(()=>{function l(i){if(!s.current)return;let d=i.target;if(!((d.tagName==="INPUT"||d.tagName==="TEXTAREA"||d.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let u of n.current)if(bx(i,u)){a&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:u.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[a]),{registerShortcut:o,unregisterShortcut:c,isEnabled:r}}function yx(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function xx(e){let t=[],r=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(r?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(r?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function vx(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,r=xx(e),a=t?yx(t):"";return r?`${r} + ${a}`:a}function wx(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(r=>{r.action.includes("navigate")?t.Navigation?.push(r):r.action.includes("select")?t.Selection?.push(r):["undo","redo","save"].includes(r.action)?t.Editing?.push(r):t.Actions?.push(r);}),t}function Ic({shortcuts:e=Us,isOpen:t,onClose:r,className:a}){let[n,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function c(l){l.key==="Escape"&&t&&r();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,r]),!n||!t)return null;let o=wx(e);return jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:r}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:r,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(o).map(([c,l])=>l.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-[#00E5CC] rounded-full"}),c]}),jsx("div",{className:"space-y-3",children:l.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:vx(i)})]},i.action))})]},c))})}),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 Rc=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
86
86
  1.
87
87
 
88
88
  **Expected behavior:**
@@ -122,13 +122,13 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
122
122
  1.
123
123
 
124
124
  **Action items:**
125
- - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Pd({templates:e,onSelectTemplate:t,className:a}){let[r,n]=useState(false),s=useRef(null),o=useRef(null);useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),n(false);},d=e.reduce((i,u)=>{let m=u.category||"Other";return i[m]||(i[m]=[]),i[m].push(u),i},{});return jsxs("div",{className:c("relative inline-block",a),children:[jsxs("button",{ref:o,onClick:()=>n(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:c("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(d).map(([i,u])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:u.map(m=>jsxs("button",{onClick:()=>l(m),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:m.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:m.name}),m.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:m.description})]})]},m.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 Ad({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:n,className:s}){let[o,l]=useState("export"),[d,i]=useState("json"),[u,m]=useState(null),p=useRef(null);if(!t)return null;let g=async()=>{let v=n?.current||void 0,y=await Mu(e,d,v);Pu(y,d);},f=async v=>{let y=v.target.files?.[0];if(y){try{let b=await Lu(y),h=y.name.endsWith(".json")?"json":"csv",x=Au(b,h);m(x),x.success&&r&&r(x,b);}catch(b){m({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxs("div",{className:c("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:c("flex-1 px-6 py-4 font-semibold transition-colors",o==="export"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>l("import"),className:c("flex-1 px-6 py-4 font-semibold transition-colors",o==="import"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[o==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(v=>jsxs("button",{onClick:()=>i(v),className:c("p-4 rounded-lg border-2 transition-all text-center",d===v?"border-[#00E5CC] bg-[#00E5CC]/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[v==="json"&&"\u{1F4C4}",v==="csv"&&"\u{1F4CA}",v==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:v})]},v))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:g,className:"w-full py-3 px-4 bg-gradient-to-r from-[#00C4AE] to-[#00C4AE] hover:from-[#00E5CC] hover:to-[#00C4AE] text-white font-semibold rounded-lg transition-all shadow-lg shadow-[#00E5CC]/20",children:"Export Board"})]}),o==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:p,type:"file",accept:".json,.csv",onChange:f,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"})]})]}),u&&jsxs("div",{className:c("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:c("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:u.errors.map((v,y)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",v]},y))})]})]})]})]})]})}var gx=["URGENT","HIGH","MEDIUM","LOW"],fx=[{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"}],bx=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ld({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:l,availableUsers:d=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:m=true,compact:p=false,groupBy:g="none",onGroupByChange:f}){let[v,y]=useState(true),b=useCallback(D=>{a({search:D.target.value});},[a]),h=useCallback(D=>{a({dateFilter:D.target.value});},[a]),x=useCallback(D=>{r({by:D.target.value});},[r]),w=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":""} ${v?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>y(!v),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:v?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter: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:v?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),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)"]})]}),!v&&jsxs("div",{className:"filter-bar__content",children:[m&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),o&&jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange: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 A=D.target.value;a({priorities:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),gx.map(D=>jsx("option",{value:D,children:D},D))]})}),d.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:D=>{let A=D.target.value;a({assignees:A==="all"?[]:[A]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),d.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 A=D.target.value;a({labels:A==="all"?[]:[A]});},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:x,className:"filter-bar__select filter-bar__select--sm",children:fx.map(D=>jsx("option",{value:D.value,children:D.label},D.value))}),t.by!=="none"&&jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),f&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:g,onChange:D=>f(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:bx.map(D=>jsx("option",{value:D.value,children:D.label},D.value))})}),N&&jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Id({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:l,onExportGanttCSV:d}){let[i,u]=useState(false),m=useRef(null);useEffect(()=>{let g=f=>{m.current&&!m.current.contains(f.target)&&u(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let p=g=>{g(),u(false);};return jsxs("div",{className:c("relative",r),ref:m,children:[jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxs("button",{onClick:()=>p(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>p(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>p(async()=>await o?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>p(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>p(()=>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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>p(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxs("button",{onClick:()=>p(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Bd={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#00E5CC",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Rd={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#00E5CC",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Od={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"}},xn={dark:Bd,light:Rd,neutral:Od},$i="dark";var Hi=createContext(void 0),Dx="asakaa-theme";function im({children:e,defaultTheme:t=$i,storageKey:a=Dx}){let[r,n]=useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=useCallback(l=>{n(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,d=xn[r];Object.entries(d.colors).forEach(([u,m])=>{m&&l.style.setProperty(`--theme-${Sx(u)}`,m);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,m])=>{let p=d.colors[u];p&&l.style.setProperty(m,p);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let o={theme:r,setTheme:s,themes:xn};return jsx(Hi.Provider,{value:o,children:e})}function _n(){let e=useContext(Hi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Sx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function $d({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:n}=_n();return e?jsxs("div",{className:c("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(xn).map(([s,o])=>jsxs("button",{onClick:()=>{n(s),t();},className:c("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-[#00E5CC] bg-[#00E5CC]/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:o.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:o.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function lm(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return xt[e]||xt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,o)=>a.getPropertyValue(s).trim()||o;return {bgPrimary:r("--theme-bg-primary",xt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",xt[e].bgSecondary),bgGrid:r("--theme-bg-card",xt[e].bgGrid),bgWeekend:r("--theme-bg-hover",xt[e].bgWeekend),border:r("--theme-border-primary",xt[e].border),borderLight:r("--theme-border-subtle",xt[e].borderLight),textPrimary:r("--theme-text-primary",xt[e].textPrimary),textSecondary:r("--theme-text-secondary",xt[e].textSecondary),textTertiary:r("--theme-text-tertiary",xt[e].textTertiary),accent:r("--theme-accent-primary",xt[e].accent),accentHover:r("--theme-accent-hover",xt[e].accentHover),accentLight:r("--theme-accent-primary",xt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",xt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",xt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",xt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",xt[e].dependency),dependencyHover:r("--theme-border-secondary",xt[e].dependencyHover),criticalPath:r("--theme-error",xt[e].criticalPath),criticalPathLight:r("--theme-error",xt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",xt[e].today):e==="neutral"?r("--theme-text-primary",xt[e].today):r("--theme-error",xt[e].today),todayLight:e==="light"?r("--theme-accent-primary",xt[e].todayLight):e==="neutral"?r("--theme-text-primary",xt[e].todayLight):r("--theme-error",xt[e].todayLight),milestone:r("--theme-warning",xt[e].milestone),milestoneLight:r("--theme-warning",xt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",xt[e].statusTodo),statusInProgress:r("--theme-accent-primary",xt[e].statusInProgress),statusCompleted:r("--theme-success",xt[e].statusCompleted),hoverBg:r("--theme-bg-hover",xt[e].hoverBg),focusRing:r("--theme-accent-primary",xt[e].focusRing),...xt[e].dotGrid&&{dotGrid:xt[e].dotGrid},...xt[e].glassHeader&&{glassHeader:xt[e].glassHeader},...xt[e].glassToolbar&&{glassToolbar:xt[e].glassToolbar},...xt[e].forecastHud&&{forecastHud:xt[e].forecastHud},...xt[e].neonRedGlow&&{neonRedGlow:xt[e].neonRedGlow},...xt[e].executionBarBg&&{executionBarBg:xt[e].executionBarBg}}}var zi={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},dm={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Hd={en:zi,es:dm};function cm(e){return Hd[e]||Hd.en}function zd(e,t){let a=cm(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 qn=createContext(zi);function Yr(){return useContext(qn)}function Rs(e,t,a="left",r=208){let[n,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),l=o.bottom+4,d;a==="right"?d=o.right-r:d=o.left;let i=8;d+r>window.innerWidth-i&&(d=window.innerWidth-i-r),d<i&&(d=i),s({top:l,left:d});},[t,a,e,r]),n}function xm({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[l,d]=useState(false),[i,u]=useState(null),m=useRef(null),p=useRef(null),g=Yr(),f=Rs(m,l,"right",176);if(useEffect(()=>{if(!l)return;let h=x=>{let w=x.target;m.current&&!m.current.contains(w)&&p.current&&!p.current.contains(w)&&d(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[l]),!(t||a||r||n||s||o))return null;let y=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:n},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:o}].filter(h=>h.handler),b=async(h,x)=>{if(x){u(h);try{await x();}catch(w){console.error(`Export ${h} failed:`,w);}finally{u(null),d(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:m,onClick:()=>d(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:g.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:l&&jsx(motion.div,{ref:p,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-44 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:y.map((h,x)=>jsxs(motion.button,{onClick:()=>b(h.id,h.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<y.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===h.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):h.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:h.label}),jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})}),document.body)]})}function pm({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:n,onCopySnapshotLink:s}){let[o,l]=useState(false),[d,i]=useState(null),[u,m]=useState(false),p=useRef(null),g=useRef(null),f=Yr(),v=Rs(p,o,"right",224),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=f.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!o)return;let N=D=>{let A=D.target;p.current&&!p.current.contains(A)&&g.current&&!g.current.contains(A)&&l(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[o]);let h=[{id:"png",label:f.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:f.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:f.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:f.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:n}].filter(N=>N.handler),x=async(N,D)=>{if(D){i(N);try{await D();}catch(A){console.error(`Export ${N} failed:`,A);}finally{i(null),l(false);}}},w=()=>{s?.(),m(true),setTimeout(()=>m(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:p,onClick:()=>l(!o),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:o?e.accent:e.textTertiary,backgroundColor:o?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:f.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:o&&jsxs(motion.div,{ref:g,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:v.top,left:v.left,zIndex:99999,backgroundColor:y?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${y?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:y?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[h.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:h.map((N,D)=>jsxs(motion.button,{onClick:()=>x(N.id,N.handler),disabled:d!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:D*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:d===N.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):N.icon}),jsx("span",{className:"flex-1 text-left",children:N.label})]},N.id))})]}),h.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:w,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:u?"rgba(34,197,94,0.15)":e.accentLight,color:u?"#22C55E":e.accent},children:u?jsx(Check,{className:"w-3.5 h-3.5"}):jsx(Link2,{className:"w-3.5 h-3.5"})}),jsx("span",{className:"flex-1 text-left",children:u?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Yx({options:e,value:t,onChange:a,theme:r,layoutId:n="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let o=t===s.value;return jsxs(motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:o?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsx(motion.div,{layoutId:n,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Xx({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(n=>{let s=t===n.value;return jsxs(motion.button,{onClick:()=>a(n.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:n.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},n.value)})})}function mm({theme:e,value:t,onChange:a,maxDepth:r}){let[n,s]=useState(false),o=useRef(null),l=useRef(null),d=Yr(),i=Rs(o,n,"left");useEffect(()=>{if(!n)return;let p=g=>{let f=g.target;o.current&&!o.current.contains(f)&&l.current&&!l.current.contains(f)&&s(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[n]);let u=[{value:"all",label:d.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(p,g)=>({value:g+1,label:`L${g+1}`}))],m=t==="all"?d.toolbar.wbsAllLevels||"All":`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:o,onClick:()=>s(!n),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:n?e.accentLight:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${d.toolbar.wbsLevel||"Level"}: ${m}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:m})]}),createPortal(jsx(AnimatePresence,{children:n&&jsx(motion.div,{ref:l,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:u.map((p,g)=>{let f=t===p.value;return jsxs(motion.button,{onClick:()=>{a(p.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:f?e.accentLight:"transparent",borderBottom:g<u.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:f?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsx("span",{className:"text-[11px]",style:{color:f?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:f?600:500},children:p.label}),f&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(p.value))})})})}),document.body)]})}function gm({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:n}){let[s,o]=useState(false),l=useRef(null),d=useRef(null),i=Yr(),u=Rs(l,s,"left");useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let v=b=>{let h=b.target;l.current&&!l.current.contains(h)&&d.current&&!d.current.contains(h)&&o(false);},y=b=>{b.key==="Escape"&&o(false);};document.addEventListener("mousedown",v),document.addEventListener("keydown",y),d._cleanup=()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(f),d._cleanup&&d._cleanup();}},[s]);let m=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],p=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:l,onClick:f=>{f.stopPropagation(),o(v=>!v);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:p?g?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${p?g?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:p?"#00E5CC":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children:i.toolbar.filter||"Filters"}),p&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#00E5CC"}})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref:d,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:u.top,left:u.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:m.map(f=>{let v=t===f.value&&!r,y=()=>f.value==="all"?v?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):f.icon;return jsxs(motion.button,{onClick:()=>{a(f.value),n&&n(false),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:v?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${v?f.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:f.label}),v&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},f.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),n&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{n(!r),r||a("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#00E5CC":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function Jx({value:e,onChange:t,theme:a}){let r=Yr(),n=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":a.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":a.border}`},children:s.map(o=>{let l=e===o.value;return jsx(motion.button,{onClick:()=>t(o.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:l?n?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:l?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function Qx({theme:e,forecast:t}){let a=Yr(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",n=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,o=s!=null,l=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,d=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,u=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,m=t?.costAtCompletion,p=t?.currency||"$",g=m!=null?m>=1e6?`${p}${(m/1e6).toFixed(2)}M`:m>=1e3?`${p}${(m/1e3).toFixed(1)}K`:`${p}${m.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,v=f!=null&&f!==0,y=f!=null?f>0?`+${f.toFixed(0)}% ${a.toolbar.budgetOver}`:`${f.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,b=f!=null&&f>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:f!=null&&f<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-6",children:[jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:a.toolbar.projectForecast}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.expectedFinish,": ",n]}),o&&l&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:d.bg,color:d.text,fontFamily:"'JetBrains Mono', monospace"},children:l})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:u,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),v&&y&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:b.bg,color:b.text,fontFamily:"'JetBrains Mono', monospace"},children:y})]})]})]})}function Zx({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:l,onShowDependenciesChange:d,rowDensity:i,onRowDensityChange:u,hasDependencies:m=true}){let[p,g]=useState(false),f=useRef(null),v=useRef(null),y=Yr(),b=Rs(f,p,"right",208),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!p)return;let D=A=>{let T=A.target;f.current&&!f.current.contains(T)&&v.current&&!v.current.contains(T)&&g(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[p]);let x=y.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:x?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a,disabled:!m,tooltip:m?void 0:x?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:x?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:n},{key:"weekends",label:x?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:o},{key:"dependencies",label:x?"Dependencias":"Dependencies",icon:GitBranch,active:l,onChange:d}],N=[{value:"compact",label:y.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:y.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:f,onClick:()=>g(!p),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:p?e.accent:e.textTertiary,backgroundColor:p?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:y.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:p&&jsxs(motion.div,{ref:v,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:b.top,left:b.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:y.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:w.map((D,A)=>{let T=D.icon,E=D.disabled,P=D.tooltip;return jsxs(motion.button,{onClick:()=>!E&&D.onChange?.(!D.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:E?h?"rgba(255,255,255,0.3)":"#9CA3AF":h?"rgba(255,255,255,0.85)":"#111827",cursor:E?"not-allowed":"pointer"},whileHover:E?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:A*.03},title:P,children:[jsx(T,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:E?h?"rgba(255,255,255,0.2)":"#D1D5DB":D.active?e.accent||"#00E5CC":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:D.label}),D.active&&!E&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},D.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),jsxs("div",{className:"py-0.5",children:[jsx("div",{className:"px-3 pt-2 pb-1",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:y.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),N.map((D,A)=>{let T=i===D.value;return jsxs(motion.button,{onClick:()=>u(D.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(w.length+A)*.03},children:[jsx("span",{style:{color:T?e.accent||"#00E5CC":h?"rgba(255,255,255,0.85)":e.textPrimary},children:D.label}),T&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},D.value)})]})]})}),document.body)]})}function Ui({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:n,currentTheme:s,onThemeChange:o,rowDensity:l,onRowDensityChange:d,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:m,onCreateTask:p,taskFilter:g="all",onTaskFilterChange:f,hideCompleted:v=false,onHideCompletedChange:y,toolbarRightContent:b,wbsLevel:h,onWbsLevelChange:x,maxWbsDepth:w=4,viewMode:N="execution",onViewModeChange:D,projectForecast:A,onExportPNG:T,onExportPDF:E,onExportExcel:P,onExportCSV:k,onExportJSON:K,onExportMSProject:H,showCriticalPath:ee=true,onShowCriticalPathChange:I,showDependencies:Y=true,onShowDependenciesChange:q,highlightWeekends:V=true,onHighlightWeekendsChange:B,showBaseline:X=false,onShowBaselineChange:Te,onCopySnapshotLink:He,hasDependencies:z=true}){let te=Yr(),xe=T||E||P||k||K||H,je=!!e.glassToolbar,Ne=[{value:"day",label:te.toolbar.day},{value:"week",label:te.toolbar.week},{value:"month",label:te.toolbar.month}],ze=[{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"})}],Me=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(je){let at=Me?"rgba(255,255,255,0.08)":e.borderLight;return jsxs("div",{className:"flex flex-col",children:[jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsx("div",{className:"flex items-center gap-3",children:D&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:Me?"#000000":e.bgSecondary,border:`1px solid ${Me?"rgba(255,255,255,0.08)":e.border}`},children:[jsx(motion.button,{onClick:()=>D("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="execution"?Me?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:N==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="execution"?{color:e.textSecondary}:{},children:te.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>D("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="oracle"?Me?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:N==="oracle"?"#00E5CC":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="oracle"?{color:e.textSecondary}:{},children:te.toolbar.viewOracle})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Jx,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:at}}),x&&jsx(mm,{theme:e,value:h??"all",onChange:x,maxDepth:w}),f&&jsx(gm,{theme:e,value:g,onChange:f,hideCompleted:v,onHideCompletedChange:y}),b&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:at}}),b]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:at}}),jsx(Zx,{theme:e,showCriticalPath:ee,onShowCriticalPathChange:I,showBaseline:X,onShowBaselineChange:Te,highlightWeekends:V,onHighlightWeekendsChange:B,showDependencies:Y,onShowDependenciesChange:q,rowDensity:l,onRowDensityChange:d,hasDependencies:z}),jsx(pm,{theme:e,onExportPNG:T,onExportPDF:E,onExportExcel:P,onExportMSProject:H,onCopySnapshotLink:He}),u&&p&&jsxs(motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${Me?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Me?"rgba(0, 229, 204,0.4)":"rgba(0, 196, 174,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:m||te.toolbar.createTask})]})]})]}),A&&jsx(Qx,{theme:e,forecast:A})]})}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(Xx,{options:Ne,value:t,onChange:at=>a(at),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:()=>n(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsx(motion.button,{onClick:()=>n(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}}),x&&jsx(mm,{theme:e,value:h??"all",onChange:x,maxDepth:w}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(gm,{theme:e,value:g,onChange:f,hideCompleted:v,onHideCompletedChange:y})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[b&&jsxs(Fragment,{children:[b,jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),u&&p&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:m||te.toolbar.createTask})]}),(xe||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(pm,{theme:e,onExportPNG:T,onExportPDF:E,onExportExcel:P,onExportMSProject:H,onCopySnapshotLink:He}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsx(Yx,{options:ze,value:s,onChange:at=>o(at),theme:e})]})]})}function Wi({columns:e,onToggleColumn:t,theme:a}){let[r,n]=useState(false),[s,o]=useState({x:0,y:0}),l=useRef(null),d=useRef(null);useEffect(()=>{if(!r)return;let u=m=>{l.current&&!l.current.contains(m.target)&&n(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:d,onClick:()=>{if(!r&&d.current){let u=d.current.getBoundingClientRect();o({x:u.left,y:u.bottom+4});}n(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(ra,{children:jsx(motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:u.label}),u.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function Jn({isOpen:e,x:t,y:a,items:r,onClose:n,theme:s}){let o=useRef(null),[l,d]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let u=200,m=r.length*36+8,p=8,g=window.innerWidth,f=window.innerHeight,v=t,y=a;t+u+p>g&&(v=t-u,v<p&&(v=p)),a+m+p>f&&(y=f-m-p,y<p&&(y=p)),d({x:v,y});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let u=p=>{o.current&&!o.current.contains(p.target)&&n();},m=p=>{p.key==="Escape"&&n();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",m);}},[e,n]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:o,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(u=>jsxs("div",{children:[u.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),n());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:m=>{u.disabled||(m.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var va={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 Dm({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:l,onTaskOutdent:d,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:m,enableKeyboard:p=true}){let g=useRef(false),f=useCallback(x=>{g.current=x;},[]),v=useCallback(x=>{let w=[],N=D=>{for(let A of D)w.push(A),A.subtasks&&A.subtasks.length>0&&A.isExpanded&&N(A.subtasks);};return N(x),w},[]),y=useCallback(()=>{let x=v(e);for(let w of x)if(t.has(w.id))return w;return null},[e,t,v]),b=useCallback((x,w)=>{let N=v(e);if(N.length===0)return;let D=y();if(!D){a(N[0].id,false);return}let A=N.findIndex(P=>P.id===D.id);if(A===-1)return;let T=x==="up"?A-1:A+1;if(T<0||T>=N.length)return;let E=N[T];a(E.id,w);},[e,y,v,a]),h=useCallback(x=>{if(!p)return;let w=x.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||g.current){x.key==="Escape"&&(w.blur(),g.current=false);return}let A=navigator.platform.toUpperCase().indexOf("MAC")>=0?x.metaKey:x.ctrlKey,T=Array.from(t),E=y();if(x.key==="ArrowUp"){x.preventDefault(),b("up",x.shiftKey);return}if(x.key==="ArrowDown"){x.preventDefault(),b("down",x.shiftKey);return}if(E&&(x.key==="ArrowRight"||x.key==="ArrowLeft")){E.subtasks&&E.subtasks.length>0&&(x.preventDefault(),(x.key==="ArrowRight"&&!E.isExpanded||x.key==="ArrowLeft"&&E.isExpanded)&&u(E.id));return}if(x.altKey&&(x.key==="ArrowUp"||x.key==="ArrowDown")){T.length>0&&(x.preventDefault(),o(T,x.key==="ArrowUp"?"up":"down"));return}if(x.key==="Tab"&&!x.shiftKey){T.length>0&&(x.preventDefault(),l(T));return}if(x.key==="Tab"&&x.shiftKey){T.length>0&&(x.preventDefault(),d(T));return}if(x.key==="Enter"&&!x.shiftKey&&!A){E&&(x.preventDefault(),r(E.id,"below"));return}if(x.key==="Enter"&&x.shiftKey&&!A){E&&(x.preventDefault(),r(E.id,"above"));return}if(x.key==="Enter"&&A){E&&(x.preventDefault(),m(E.id));return}if(x.key==="F2"){E&&(x.preventDefault(),i(E.id));return}if(x.key==="Delete"||x.key==="Backspace"&&A){T.length>0&&(x.preventDefault(),n(T));return}if(x.key==="d"&&A&&!x.shiftKey){T.length>0&&(x.preventDefault(),s(T));return}},[p,t,y,b,r,n,s,o,l,d,i,u,m]);return useEffect(()=>{if(p)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[p,h]),{setIsEditing:f}}function Em(){let[e,t]=useState(new Set),[a,r]=useState(null),n=useCallback(m=>{t(new Set([m])),r(m);},[]),s=useCallback(m=>{t(p=>{let g=new Set(p);return g.has(m)?g.delete(m):g.add(m),g}),r(m);},[]),o=useCallback((m,p)=>{if(!a){n(m);return}let g=p.indexOf(a),f=p.indexOf(m);if(g===-1||f===-1){n(m);return}let v=Math.min(g,f),y=Math.max(g,f),b=p.slice(v,y+1);t(new Set(b)),r(m);},[a,n]),l=useCallback((m,p,g,f)=>{f?o(m,p):g?s(m):n(m);},[n,s,o]),d=useCallback((m,p)=>{p?t(g=>{let f=new Set(g);return f.add(m),f}):n(m);},[n]),i=useCallback(()=>{t(new Set),r(null);},[]),u=useCallback(m=>e.has(m),[e]);return {selectedTaskIds:e,selectTask:n,toggleTaskSelection:s,selectTaskRange:o,handleTaskClick:l,handleKeyboardSelection:d,clearSelection:i,isTaskSelected:u}}function jd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?jd(t.subtasks):t.subtasks}))}function wn(e){let t=[],a=(r,n,s=0)=>{let o=[...r].sort((l,d)=>(l.position??0)-(d.position??0));for(let l=0;l<o.length;l++){let d={...o[l],parentId:n,level:s,position:o[l].position??l};t.push(d),d.subtasks&&d.subtasks.length>0&&d.isExpanded&&a(d.subtasks,d.id,s+1);}};return a(e),t}function Qn(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Qn(a.subtasks,t);if(r)return r}}return null}function Gd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(n=>n.id===t))return a;let r=Gd(a.subtasks,t);if(r)return r}return null}function _d(e,t){if(t.length===0)return e;let a=wn(e),r=t[0],n=a.findIndex(p=>p.id===r);if(n<=0)return e;let s=a[n-1],o=(p,g)=>{let f=[];return {tasks:p.filter(y=>{if(g.has(y.id))return f.push(y),false;if(y.subtasks){let b=o(y.subtasks,g);y.subtasks=b.tasks,f.push(...b.removed);}return true}),removed:f}},l=(p,g,f)=>p.map(v=>v.id===g?{...v,subtasks:[...v.subtasks||[],...f],isExpanded:true}:v.subtasks?{...v,subtasks:l(v.subtasks,g,f)}:v),d=new Set(t),{tasks:i,removed:u}=o(e,d),m=l(i,s.id,u);return jd(m)}function Kd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let n=Gd(a,r);if(!n)continue;let s=Gd(a,n.id),o=(i,u,m)=>{for(let p=0;p<i.length;p++){let g=i[p];if(g.id===u&&g.subtasks){let f=g.subtasks.findIndex(v=>v.id===m);if(f!==-1){let[v]=g.subtasks.splice(f,1);return v}}if(g.subtasks){let f=o(g.subtasks,u,m);if(f)return f}}return null},l=(i,u,m)=>{let p=i.findIndex(g=>g.id===u);if(p!==-1)return i.splice(p+1,0,m),i;for(let g of i)g.subtasks&&l(g.subtasks,u,m);return i},d=o(a,n.id,r);d&&(s&&s.subtasks?l(s.subtasks,n.id,d):l(a,n.id,d));}return jd(a)}function qd(e,t,a){if(t.length===0)return e;let r=[...e],n=t[0],s=(o,l,d)=>{let i=o.findIndex(m=>m.id===l);if(i===-1){for(let m of o)if(m.subtasks&&s(m.subtasks,l,d))return true;return false}let u=d==="up"?i-1:i+1;return u<0||u>=o.length?false:([o[i],o[u]]=[o[u],o[i]],o[i]={...o[i],position:i},o[u]={...o[u],position:u},true)};return s(r,n,a),r}function Yd(e,t){let a=new Set(t),r=n=>n.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function $s(e,t){let a=[...e],r=[];for(let n of t){let s=(d,i)=>d.map((u,m)=>({...u,id:`${u.id}-copy-${Date.now()}-${m}`,parentId:i,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${m}`):void 0})),o=d=>{let i=d.findIndex(g=>g.id===n);if(i===-1){for(let g of d)if(g.subtasks){let f=o(g.subtasks);if(f)return f}return null}let u=d[i],m=`${u.id}-copy-${Date.now()}`,p={...u,id:m,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks,m):void 0};return d.splice(i+1,0,p),p},l=o(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function Mm(e,t,a){let r=[...e],n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:s,color:"#00E5CC"},l=d=>{let i=d.findIndex(m=>m.id===t);if(i===-1){for(let m of d)if(m.subtasks&&l(m.subtasks))return true;return false}let u=a==="above"?i:i+1;return d.splice(u,0,o),true};return l(r),{tasks:r,newTask:o}}function Xd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Xd(r.subtasks,t,a)}:r)}function Jd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Jd(a.subtasks,t)}:a)}function Qd(e,t){let a=p=>{for(let g of p){if(g.id===t)return g;if(g.subtasks){let f=a(g.subtasks);if(f)return f}}return null},r=a(e),n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o=r?.startDate||n,l=r?.endDate||s,d=p=>{for(let g of p){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let f=d(g.subtasks);if(f>=0)return f}}return 0},i=d(e),u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(l),color:r?.color||"#00E5CC",position:i,parentId:t},m=p=>p.map(g=>{if(g.id===t){let f=g.subtasks||[];return {...g,subtasks:[...f,u],isExpanded:true}}return g.subtasks?{...g,subtasks:m(g.subtasks)}:g});return {tasks:m(e),newTask:u}}function Pm(e,t,a,r){if(t===a)return e;let n=Qn(e,t);if(!n)return e;if(a){let l=(d,i)=>{if(!d.subtasks)return false;for(let u of d.subtasks)if(u.id===i||l(u,i))return true;return false};if(l(n,a))return e}let s=l=>{let d=l.filter(u=>u.id!==t),i=d.length<l.length;return d.map((u,m)=>{let p=i?{...u,position:m}:u;return p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p})},o=s(e);if(a===null){let l=r!==void 0?r:o.length;o.splice(l,0,{...n,parentId:void 0}),o=o.map((d,i)=>({...d,position:i}));}else {let l=d=>d.map(i=>{if(i.id===a){let u=i.subtasks||[],m=r!==void 0?r:u.length,p=[...u];p.splice(m,0,{...n,parentId:a});let g=p.map((f,v)=>({...f,position:v}));return {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});o=l(o);}return o}function Xr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=Xr(t.subtasks),r=a.reduce((l,d)=>(d.startDate&&l.starts.push(new Date(d.startDate).getTime()),d.endDate&&l.ends.push(new Date(d.endDate).getTime()),l.progresses.push(d.progress??0),l),{starts:[],ends:[],progresses:[]}),n=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,o=r.progresses.length>0?Math.round(r.progresses.reduce((l,d)=>l+d,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:n,endDate:s,progress:o}})}function Gi({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:n,onTaskClick:s,onTaskDblClick:o,onTaskContextMenu:l,onTaskToggle:d,scrollTop:i,columns:u,onToggleColumn:m,onColumnResize:p,onTaskUpdate:g,onBulkFill:f,onTaskIndent:v,onTaskOutdent:y,onTaskMove:b,onMultiTaskDelete:h,onTaskDuplicate:x,onTaskCreate:w,onTaskRename:N,onCreateSubtask:D,onOpenTaskModal:A,onDeleteRequest:T,onTaskReparent:E,allTasks:P,scrollContainerRef:k,showCriticalPath:K=false}){let H=useContext(qn),[ee,I]=useState(null),[Y,q]=useState(null),[V,B]=useState(""),X=useRef(null),[Te,He]=useState(null),[z,te]=useState(0),[xe,je]=useState(0),[Ne,ze]=useState({isOpen:false,x:0,y:0,type:"header"}),[Me,at]=useState(null),[be,pt]=useState(null),[Ke,Ue]=useState(null),kt=useRef(0),Ht=5,qe=useRef(false),[We,ot]=useState(null),[zt,Ee]=useState(false),nt=useRef(null),[F,le]=useState(null),[R,J]=useState(null),[O,Z]=useState(false),Ve=useRef(null);useEffect(()=>{function ce(ve){Ve.current&&!Ve.current.contains(ve.target)&&Z(false);}if(O)return document.addEventListener("mousedown",ce),()=>document.removeEventListener("mousedown",ce)},[O]),useEffect(()=>{Y&&X.current&&(X.current.focus(),X.current.select());},[Y]),useEffect(()=>{if(!Te)return;let ce=Et=>{let it=Et.clientX-z,wt=xe+it;p?.(Te,wt);},ve=()=>{He(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ce),document.addEventListener("mouseup",ve),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",ve),document.body.style.cursor="",document.body.style.userSelect="";}},[Te,z,xe,p]);let{selectedTaskIds:ke,handleTaskClick:Re,isTaskSelected:Ae}=Em(),{setIsEditing:Pe}=Dm({tasks:e,selectedTaskIds:ke,onTaskSelect:(ce,ve)=>{let it=wn(e).map(wt=>wt.id);Re(ce,it,ve||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:h||(()=>{}),onTaskDuplicate:x||(()=>{}),onTaskMove:b||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:ce=>{let ve=wn(e).find(Et=>Et.id===ce);ve&&Mt(ve);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:ce=>{let ve=wn(e).find(Et=>Et.id===ce);ve&&A&&A(ve);},enableKeyboard:true}),ct=(ce,ve=0,Et="")=>{let it=[],wt=[...ce].sort((_,ge)=>(_.position??0)-(ge.position??0));for(let _=0;_<wt.length;_++){let ge=wt[_],ae=_+1,U=Et?`${Et}.${ae}`:`${ae}.0`,oe=ge.wbsCode||U;if(ge.wbsCode=oe,it.push({task:ge,level:ve}),ge.subtasks&&ge.subtasks.length>0&&ge.isExpanded){let C=ge.wbsCode?.replace(/\.0$/,"")||(Et?`${Et}.${ae}`:`${ae}`);it.push(...ct(ge.subtasks,ve+1,C));}}return it},Qe=ct(e),st=48,mt=Math.max(Qe.length*a,600-st),jt=(ce,ve)=>ve==="assignees"?ce.assignees:ve==="startDate"?ce.startDate:ce.endDate,St=(ce,ve,Et,it)=>{ce.preventDefault(),ce.stopPropagation(),le({sourceTaskId:ve,column:Et,sourceIndex:it,targetIndex:it}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let wt=ce.currentTarget.closest("[data-grid-body]"),_=fe=>{let De=wt?.getBoundingClientRect().top??0,se=Math.floor((fe-De)/a);return se=Math.max(0,Math.min(Qe.length-1,se)),se<it&&(se=it),se},ge=ce.clientY,ae=k?.current??null,U=()=>{nt.current&&(cancelAnimationFrame(nt.current),nt.current=null);},oe=()=>{let fe=_(ge);le(De=>De&&{...De,targetIndex:fe});},Le=()=>{if(U(),!ae)return;let fe=ae.getBoundingClientRect(),De=60,se=12,ut=ge-fe.top,lt=fe.bottom-ge;if(lt<De&&ae.scrollTop<ae.scrollHeight-ae.clientHeight){let Zt=Math.max(1,Math.round(se*(1-Math.max(0,lt)/De))),Yt=()=>{ae.scrollTop+=Zt,oe(),ae.scrollTop<ae.scrollHeight-ae.clientHeight&&(nt.current=requestAnimationFrame(Yt));};nt.current=requestAnimationFrame(Yt);}else if(ut<De&&ae.scrollTop>0){let Zt=Math.max(1,Math.round(se*(1-Math.max(0,ut)/De))),Yt=()=>{ae.scrollTop-=Zt,oe(),ae.scrollTop>0&&(nt.current=requestAnimationFrame(Yt));};nt.current=requestAnimationFrame(Yt);}},C=fe=>{ge=fe.clientY,oe(),Le();},$=fe=>{window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",$),U(),document.body.style.cursor="",document.body.style.userSelect="",le(null);let De=_(fe.clientY),se=Qe.find(Kt=>Kt.task.id===ve)?.task;if(!se)return;let ut=jt(se,Et),lt=Math.min(it,De),Zt=Math.max(it,De),Yt=[];for(let Kt=lt;Kt<=Zt;Kt++){if(Kt===it)continue;let La=Qe[Kt]?.task;!La||La.subtasks&&La.subtasks.length>0||Yt.push(La.id);}Yt.length!==0&&f?.(Yt,Et,ut);};window.addEventListener("mousemove",C),window.addEventListener("mouseup",$);},Ut=ce=>{if(!F)return false;let ve=Math.min(F.sourceIndex,F.targetIndex),Et=Math.max(F.sourceIndex,F.targetIndex);return ce>=ve&&ce<=Et},gt=ce=>!ce.startDate||!ce.endDate?"-":`${Math.ceil((ce.endDate.getTime()-ce.startDate.getTime())/(1e3*60*60*24))}d`,Mt=ce=>{q(ce.id),B(ce.name),Pe(true);},Bt=ce=>{V.trim()&&V!==e.find(ve=>ve.id===ce)?.name&&N?.(ce,V.trim()),q(null),B(""),Pe(false);},_t=()=>{q(null),B(""),Pe(false);},Wt=(ce,ve)=>{ve.stopPropagation(),D?.(ce.id);},rt=(ce,ve)=>{ve.preventDefault(),kt.current=ve.clientY,at(ce),qe.current=false,Ee(false),ot({x:ve.clientX,y:ve.clientY});},da=ce=>{if(!Me||(Math.abs(ce.clientY-kt.current)>Ht&&!qe.current&&(qe.current=true,Ee(true)),ot({x:ce.clientX,y:ce.clientY}),!qe.current))return;if(k?.current){let _=k.current,ge=_.getBoundingClientRect(),ae=60,U=12;nt.current&&(cancelAnimationFrame(nt.current),nt.current=null);let oe=ce.clientY-ge.top,Le=ge.bottom-ce.clientY;if(oe<ae&&_.scrollTop>0){let C=Math.round(U*(1-oe/ae)),$=()=>{_.scrollTop-=C,qe.current&&_.scrollTop>0&&(nt.current=requestAnimationFrame($));};nt.current=requestAnimationFrame($);}else if(Le<ae&&_.scrollTop<_.scrollHeight-_.clientHeight){let C=Math.round(U*(1-Le/ae)),$=()=>{_.scrollTop+=C,qe.current&&_.scrollTop<_.scrollHeight-_.clientHeight&&(nt.current=requestAnimationFrame($));};nt.current=requestAnimationFrame($);}}let Et=document.querySelectorAll("[data-task-row]"),it=null,wt=null;Et.forEach(_=>{let ge=_.getBoundingClientRect(),ae=_.getAttribute("data-task-row");if(ae&&ae!==Me&&ce.clientY>=ge.top&&ce.clientY<=ge.bottom){it=ae;let U=ce.clientY-ge.top,oe=ge.height;U<oe*.25?wt="above":U>oe*.75?wt="below":wt="child";}}),pt(it),Ue(wt);},ha=()=>{if(qe.current&&Me&&be&&Ke){if(Ke==="child")E?.(Me,be);else if(Ke==="above"||Ke==="below"){let ce=(_,ge,ae=null)=>{for(let U of _){if(U.id===ge)return ae;if(U.subtasks){let oe=ce(U.subtasks,ge,U.id);if(oe!==void 0)return oe}}},ve=P&&P.length>0?P:e,Et=ce(ve,Me,null),it=ce(ve,be,null),wt=(_,ge,ae,U)=>{let oe=_.findIndex($=>$.id===ge),Le=U?_.findIndex($=>$.id===ae):-1,C=Ke==="below"?oe+1:oe;return U&&Le!==-1&&Le<oe&&(C-=1),Math.max(0,C)};if(it===null){let ge=wt(ve,be,Me,Et===null);E?.(Me,null,ge);}else {let _=Qn(ve,it);if(_?.subtasks){let ge=Et===it,ae=wt(_.subtasks,be,Me,ge);E?.(Me,it,ae);}}}}nt.current&&(cancelAnimationFrame(nt.current),nt.current=null),at(null),pt(null),Ue(null),ot(null),qe.current=false,Ee(false);};useEffect(()=>{if(Me)return document.addEventListener("mousemove",da),document.addEventListener("mouseup",ha),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",da),document.removeEventListener("mouseup",ha),document.body.style.cursor="",document.body.style.userSelect="";}},[Me,be,Ke]);let W=(ce,ve,Et)=>{let it=ve.subtasks&&ve.subtasks.length>0;switch(ce.id){case "name":let wt=Y===ve.id,_=ee===ve.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Et*20}px`},children:[E&&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:_?1:.3},onMouseDown:se=>rt(ve.id,se),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),ve.subtasks&&ve.subtasks.length>0?jsx("button",{onClick:se=>{se.stopPropagation(),d?.(ve.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ve.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"}),wt?jsx("input",{ref:X,type:"text",value:V,onChange:se=>B(se.target.value),onKeyDown:se=>{se.key==="Enter"?Bt(ve.id):se.key==="Escape"&&_t();},onBlur:()=>Bt(ve.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:se=>se.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:ve.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ve.parentId?"13px":"14px",fontWeight:ve.isMilestone?600:ve.parentId?400:600,letterSpacing:ve.parentId?"0":"-0.01em"},title:ve.name,children:[ve.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:ve.wbsCode}),ve.isHighlighted&&ve.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ve.name}),ve.subtasks&&ve.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(ve.progress||0),"%"]}),K&&ve.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),K&&ve.cpmData&&jsxs("span",{style:{color:ve.cpmData.totalFloat<=0?"#EF4444":ve.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(ve.cpmData.totalFloat),"d"]})]}),_&&!wt&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:se=>se.stopPropagation(),children:[jsx("button",{onClick:se=>Wt(ve,se),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:se=>{se.stopPropagation(),Mt(ve);},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 ae=ce.id==="startDate"?"startDate":"endDate",U=ve[ae],oe=R?.taskId===ve.id&&R?.field===ae,Le=se=>se?(typeof se=="string"?new Date(se):se).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:se=>se.stopPropagation(),children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:it?.5:1,cursor:it?"default":"pointer"},title:it?"Auto-calculated from subtasks":void 0,onClick:se=>{if(!it)if(oe)J(null);else {let ut=se.currentTarget.getBoundingClientRect();J({taskId:ve.id,field:ae,month:U?typeof U=="string"?new Date(U):U:new Date,position:{top:ut.bottom+4,left:ut.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:Le(U)}),it&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),oe&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>J(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:R?.position.top,left:R?.position.left},onClick:se=>se.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let se=new Date,ut=new Date(se);ut.setDate(se.getDate()+1);let lt=new Date(se);lt.setDate(se.getDate()+7);let Zt=new Date(se);return Zt.setDate(se.getDate()+14),[{label:"Hoy",date:se},{label:"Ma\xF1ana",date:ut},{label:"Pr\xF3xima semana",date:lt},{label:"2 semanas",date:Zt}].map((Kt,La)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Rr=>Rr.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Rr=>Rr.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(ve.id,{[ae]:Kt.date}),J(null);},children:Kt.label},La))})(),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:se=>se.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(ve.id,{[ae]:void 0}),J(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:()=>J(se=>se?{...se,month:new Date(se.month.getFullYear(),se.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:R?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>J(se=>se?{...se,month:new Date(se.month.getFullYear(),se.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((se,ut)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:se},ut))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let se=R?.month||new Date,ut=se.getFullYear(),lt=se.getMonth(),Zt=new Date(ut,lt,1).getDay(),Yt=new Date(ut,lt+1,0).getDate(),Kt=new Date,La=[];for(let na=Zt-1;na>=0;na--)La.push({day:new Date(ut,lt,-na).getDate(),date:new Date(ut,lt-1,new Date(ut,lt,-na).getDate()),isCurrentMonth:false});for(let na=1;na<=Yt;na++)La.push({day:na,date:new Date(ut,lt,na),isCurrentMonth:true});let Rr=42-La.length;for(let na=1;na<=Rr;na++)La.push({day:na,date:new Date(ut,lt+1,na),isCurrentMonth:false});return La.map((na,Fn)=>{let po=na.date.toDateString()===Kt.toDateString(),mo=(U?typeof U=="string"?new Date(U):U:null)?.toDateString()===na.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:na.isCurrentMonth?mo?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:mo?"#00E5CC":"transparent",boxShadow:po&&!mo?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{g?.(ve.id,{[ae]:na.date}),J(null);},children:na.day},Fn)})})()})]})]})]}),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:gt(ve)})});case "assignees":if(it)return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let C=r.filter(se=>ve.assignees?.some(ut=>ut.id?ut.id===se.id:ut.name===se.name||ut.initials===se.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsx(mn,{assignedUsers:C,availableUsers:r,onChange:se=>{let ut=se.map(lt=>({id:lt.id,name:lt.name,initials:lt.initials,color:lt.color}));g?.(ve.id,{assignees:ut});}})});case "status":if(it){let se=ve.progress===100?"\u2713":ve.progress>0?"\u25D0":"\u25CB";return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:se})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsx(Qu,{status:ve.status||"todo",onChange:se=>{g?.(ve.id,{status:se,progress:se==="completed"?100:ve.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:it?.6:1},children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ve.progress}%`,backgroundColor:ve.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:[ve.progress,"%"]})]});case "priority":let $={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},fe={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},De=$[ve.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsx(un,{priority:De,onChange:se=>{se&&g?.(ve.id,{priority:fe[se]||"medium"});}})});default:return null}},ne=ce=>[{id:"hide",label:"Hide Column",icon:va.Hide,onClick:()=>m(ce),disabled:ce==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:va.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:va.SortDesc,onClick:()=>{}}],ft=ce=>{let ve=ce.subtasks&&ce.subtasks.length>0,Et=wn(e),it=ke.size>1&&ke.has(ce.id),wt=it?Et.filter(oe=>ke.has(oe.id)):[ce],_=wt.map(oe=>oe.id),ge=wt.filter(oe=>!(oe.subtasks&&oe.subtasks.length>0)),ae=it?` (${_.length})`:"",U=()=>{T?T(_,ce.name):h?.(_);};return ve?[{id:"addSubtask",label:H?.contextMenu?.addSubtask||"Add Subtask",icon:va.Add,onClick:()=>{D?.(ce.id);}},{id:"duplicate",label:(H?.contextMenu?.duplicateTask||"Duplicate Task")+ae,icon:va.Duplicate,onClick:()=>{x?.(_);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(H?.contextMenu?.deleteTask||"Delete Task")+ae,icon:va.Delete,onClick:U}]:[{id:"edit",label:H?.contextMenu?.editTask||"Edit Task",icon:va.Pencil,onClick:()=>{o?.(ce);}},{id:"addSubtask",label:H?.contextMenu?.addSubtask||"Add Subtask",icon:va.Add,onClick:()=>{D?.(ce.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(H?.contextMenu?.markIncomplete||"Mark Incomplete")+ae,icon:va.MarkIncomplete,onClick:()=>{ge.forEach(oe=>g?.(oe.id,{status:"todo",progress:0}));},disabled:ge.length===0||ge.every(oe=>oe.status==="todo")},{id:"setInProgress",label:(H?.contextMenu?.setInProgress||"Set In Progress")+ae,icon:va.SetInProgress,onClick:()=>{ge.forEach(oe=>g?.(oe.id,{status:"in-progress"}));},disabled:ge.length===0||ge.every(oe=>oe.status==="in-progress")},{id:"markComplete",label:(H?.contextMenu?.markComplete||"Mark Complete")+ae,icon:va.MarkComplete,onClick:()=>{ge.forEach(oe=>g?.(oe.id,{status:"completed",progress:100}));},disabled:ge.length===0||ge.every(oe=>oe.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(H?.contextMenu?.duplicateTask||"Duplicate Task")+ae,icon:va.Duplicate,onClick:()=>{x?.(_);}},{id:"split",label:H?.contextMenu?.splitTask||"Split Task",icon:va.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(H?.contextMenu?.deleteTask||"Delete Task")+ae,icon:va.Delete,onClick:U}]},Tt=u.filter(ce=>ce.visible),pa=Tt.reduce((ce,ve)=>ce+ve.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:pa},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${st}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:Tt.map((ce,ve)=>{let Et=ve===Tt.length-1,it=ce.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${it?"":"justify-center"}`,style:{width:`${ce.width}px`,minWidth:`${ce.minWidth??(it?200:60)}px`,maxWidth:`${ce.maxWidth??2e3}px`,flexShrink:it&&Tt.length===1?1:0,flexGrow:it&&Tt.length===1?1:0,borderRight:Et?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:wt=>{wt.preventDefault(),ze({isOpen:true,x:wt.clientX,y:wt.clientY,type:"header",columnId:ce.id});},onMouseEnter:wt=>{wt.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:wt=>{wt.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:ce.label,children:ce.label}),ce.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:Te===ce.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:wt=>{wt.preventDefault(),wt.stopPropagation(),He(ce.id),te(wt.clientX),je(ce.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:Te===ce.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},ce.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsx(Wi,{columns:u,onToggleColumn:m,theme:t}),jsx("button",{onClick:()=>Z(!O),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"})}),O&&jsxs("div",{ref:Ve,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:ce=>ce.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:()=>Z(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content","data-grid-body":true,style:{minHeight:mt},children:Qe.map(({task:ce,level:ve},Et)=>{let it=Ae(ce.id),wt=Ut(Et),_=be===ce.id,ge=_&&Ke==="above",ae=_&&Ke==="below",U=_&&Ke==="child",oe={};return U&&(oe.backgroundColor=`${t.accent}15`,oe.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":ce.id,className:`flex items-center cursor-pointer group ${Me===ce.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:it?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:it?t.accentLight:U?`${t.accent}15`:Et%2===0?t.bgPrimary:t.bgGrid,opacity:K?ce.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...oe},onMouseEnter:()=>I(ce.id),onMouseLeave:()=>I(null),onClick:Le=>{let $=wn(e).map(se=>se.id),De=navigator.platform.toUpperCase().indexOf("MAC")>=0?Le.metaKey:Le.ctrlKey;Re(ce.id,$,De,Le.shiftKey),!De&&!Le.shiftKey&&s?.(ce);},onDoubleClick:Le=>{Le.stopPropagation(),o?.(ce);},onContextMenu:Le=>{Le.preventDefault(),ze({isOpen:true,x:Le.clientX,y:Le.clientY,type:"task",task:ce}),l?.(ce,Le);},whileHover:{backgroundColor:it?t.accentLight:t.hoverBg},children:[ge&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ae&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Tt.map((Le,C)=>{let $=C===Tt.length-1,fe=Le.id==="name",De=!!(ce.subtasks&&ce.subtasks.length>0),se=Le.id==="assignees"||Le.id==="startDate"||Le.id==="endDate"?Le.id:null,lt=!!se&&!De&&ee===ce.id&&!F,Zt=wt&&!!F&&F.column===Le.id;return jsxs("div",{className:`px-4 flex items-center ${fe?"justify-start":"justify-center"}`,style:{position:"relative",width:`${Le.width}px`,minWidth:`${Le.minWidth??(fe?200:60)}px`,maxWidth:`${Le.maxWidth??2e3}px`,flexShrink:fe&&Tt.length===1?1:0,flexGrow:fe&&Tt.length===1?1:0,borderRight:$?"none":`1px solid ${ee===ce.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:Zt?`${t.accent}22`:void 0,boxShadow:Zt?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[W(Le,ce,fe?ve:0),lt&&se&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Yt=>St(Yt,ce.id,se,Et),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:t.accent,border:`1px solid ${t.bgPrimary}`,cursor:"crosshair",zIndex:5}})]},`${ce.id}-${Le.id}`)})]},ce.id)})}),jsx(Jn,{isOpen:Ne.isOpen,x:Ne.x,y:Ne.y,items:Ne.type==="header"&&Ne.columnId?ne(Ne.columnId):Ne.type==="task"&&Ne.task?ft(Ne.task):[],onClose:()=>ze({...Ne,isOpen:false}),theme:t}),zt&&We&&Me&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:We.x+12,top:We.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ce=Qe.find(ve=>ve.task.id===Me)?.task;return ce?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:ce.name})}):null})()}),document.body)]})}function Bm(e,t){let[a,r]=useState("none"),[n,s]=useState(0),[o,l]=useState(e),[d,i]=useState(t),[u,m]=useState(null),[p,g]=useState(null),[f,v]=useState(null),[y,b]=useState(null),[h,x]=useState(0),[w,N]=useState(0),[D,A]=useState(null),[T,E]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:l,ghostWidth:d,setGhostWidth:i,connectionLine:u,setConnectionLine:m,hoveredTaskId:p,setHoveredTaskId:g,activeZone:f,setActiveZone:v,draggedSegmentIndex:y,setDraggedSegmentIndex:b,draggedSegmentStartX:h,setDraggedSegmentStartX:x,segmentDragOffsetX:w,setSegmentDragOffsetX:N,hoveredSegmentIndex:D,setHoveredSegmentIndex:A,isHovered:T,setIsHovered:E,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(ee,I)=>{r("none"),m(null),g(null),l(ee),i(I),N(0),b(null),x(0);}}}function ji({task:e,x:t,y:a,width:r,theme:n,dayWidth:s,startDate:o,templates:l,onClick:d,onDoubleClick:i,onContextMenu:u,onDateChange:m,onDependencyCreate:p,allTaskPositions:g=[],onDragMove:f,onHoverChange:v,showBaseline:y,showTaskBarLabels:b=true,showCriticalPath:h=true,readOnly:x=false,onProgressChange:w}){let N=Bm(t,r),D=useRef(null),A=useRef(false),T=useRef(null),E=useRef(null),{dragMode:P,setDragMode:k,dragOffset:K,setDragOffset:H,ghostX:ee,setGhostX:I,ghostWidth:Y,setGhostWidth:q,connectionLine:V,setConnectionLine:B,hoveredTaskId:X,setHoveredTaskId:Te,activeZone:He,setActiveZone:z,draggedSegmentIndex:te,setDraggedSegmentIndex:xe,draggedSegmentStartX:je,setDraggedSegmentStartX:Ne,segmentDragOffsetX:ze,setSegmentDragOffsetX:Me,hoveredSegmentIndex:at,setHoveredSegmentIndex:be,isHovered:pt,setIsHovered:Ke,isDragging:Ue,isResizing:kt,isConnecting:Ht,resetDragState:qe}=N,We=18,ot=!!n.executionBarBg,zt=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",Ee=ot?3:6,nt=e.subtasks&&e.subtasks.length>0,F=useRef(null),[le,R]=(()=>{let _=useRef(null),[,ge]=useState(0);return [_.current,ae=>{_.current=ae,ge(U=>U+1);}]})(),J=!!w&&!x&&!nt&&!e.segments&&!!e.startDate&&!!e.endDate,O=e.endDate&&(()=>{let _=new Date;_.setHours(0,0,0,0);let ge=new Date(e.endDate);return ge.setHours(0,0,0,0),ge<_})()&&e.progress<100,Z=h&&e.isCriticalPath,Ve=n.name==="neutral"||n.today==="#1C1917",ke=e.status==="completed"||e.progress===100,Re={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Pe=h&&e.isCriticalPath||O?"#EF4444":e.color?e.color:e.priority&&Re[e.priority]?Re[e.priority]:n.taskBarPrimary,ct=x?"default":Ue?Ht?"crosshair":kt?"ew-resize":"grabbing":"grab",Qe=x?"default":"ew-resize",mt=(_=>_>=80?20:_>=60?15:_>=50?12:10)(r),jt=r<50,St=r<40;useEffect(()=>{v&&(!pt||Ue||e.segments)&&v(null);},[pt,Ue,e.segments,v]);let Ut=_=>_.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),gt=()=>{let _=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${_} day${_!==1?"s":""}`},Mt=_=>Math.round(_/s)*s,Bt=_=>{let ge=Math.round(_/s),ae=new Date(o);return ae.setDate(ae.getDate()+ge),ae},_t=(_,ge)=>{for(let ae of g){if(ae.id===e.id)continue;let U=5;if(_>=ae.x-U&&_<=ae.x+ae.width+U&&ge>=ae.y-U&&ge<=ae.y+ae.height+U)return ae.id}return null},Wt=useCallback((_,ge,ae)=>{if(x)return;_.preventDefault(),_.stopPropagation();let U=D.current?.ownerSVGElement;if(!U)return;let oe=U.createSVGPoint();oe.x=_.clientX,oe.y=_.clientY;let Le=oe.matrixTransform(U.getScreenCTM()?.inverse()),C=ae!==void 0?ae:t,$=ge;if(!$){let fe=Le.x-C;_.shiftKey?($="connect",B({x:t+r,y:a+We/2})):_.ctrlKey||_.metaKey?$="move":_.altKey?$=fe<r/2?"resize-start":"resize-end":St?fe<r/2?$="move":$="resize-end":jt?fe<=mt/2?$="resize-start":fe>=r-mt/2?$="resize-end":$="move":fe<=mt?$="resize-start":fe>=r-mt?$="resize-end":$="move";}A.current=false,k($),Ke(false),z(null),$==="move"?H(Le.x-C):$==="connect"?B({x:t+r,y:a+We/2}):H(0),I(C),q(r);},[t,r,a,We,x]),rt=useCallback(_=>{let ge=D.current?.ownerSVGElement;if(!ge)return;let ae=ge.closest(".gantt-timeline-scroll");if(!ae)return;let U=ae.getBoundingClientRect(),oe=60,Le=15,C=0;if(_.clientX<U.left+oe){let $=U.left+oe-_.clientX;C=-Math.min(Le,$/2);}else if(_.clientX>U.right-oe){let $=_.clientX-(U.right-oe);C=Math.min(Le,$/2);}return C!==0&&(ae.scrollLeft+=C),C!==0},[]),da=useCallback(_=>{if(P==="none")return;A.current=true,E.current=_;let ge=D.current?.ownerSVGElement;if(!ge)return;if(P==="move"||P==="resize-start"||P==="resize-end"){let oe=rt(_);oe&&!T.current?T.current=window.setInterval(()=>{E.current&&(rt(E.current),da(E.current));},16):!oe&&T.current&&(window.clearInterval(T.current),T.current=null);}let ae=ge.createSVGPoint();ae.x=_.clientX,ae.y=_.clientY;let U=ae.matrixTransform(ge.getScreenCTM()?.inverse());if(P==="connect"){B({x:U.x,y:U.y});let oe=_t(U.x,U.y);Te(oe);}else if(P==="move"){let oe=U.x-K,Le=Mt(oe);I(Le),q(r);let C=Math.round((Le-t)/s);if(f?.(e.id,C,true),e.segments&&e.segments.length>0&&te!==null){let $=Le-je;Me($);}}else if(P==="resize-start"){let oe=U.x,Le=Mt(oe),C=t+r-Le;C>=s&&(I(Le),q(C));}else if(P==="resize-end"){let oe=U.x,C=Mt(oe)-t;C>=s&&q(C);}},[P,t,r,s,K,e,Mt,te,je,_t,Te,B,I,q,Me,f,rt]),ha=useCallback(()=>{if(T.current&&(window.clearInterval(T.current),T.current=null),E.current=null,P!=="none"){if(P==="connect")X&&p&&p(e,X),B(null),Te(null);else {let _=e.endDate.getTime()-e.startDate.getTime(),ge,ae,U=true;if(P==="move"){if(ge=Bt(ee),ae=new Date(ge.getTime()+_),e.segments&&e.segments.length>0&&te!==null){let oe=Math.round(ze/s),Le=e.segments.map((De,se)=>{if(se===te){let ut=new Date(De.startDate),lt=new Date(De.endDate);return ut.setDate(ut.getDate()+oe),lt.setDate(lt.getDate()+oe),{startDate:ut,endDate:lt}}return De}),C=Le.flatMap(De=>[De.startDate,De.endDate]),$=new Date(Math.min(...C.map(De=>De.getTime()))),fe=new Date(Math.max(...C.map(De=>De.getTime())));m?.({...e,segments:Le},$,fe),qe(t,r);return}}else P==="resize-start"?(ge=Bt(ee),ae=e.endDate,ge>ae&&(console.warn("Invalid date range: start date must be before or equal to end date"),U=false)):P==="resize-end"?(ge=e.startDate,ae=Bt(ee+Y),ae.setDate(ae.getDate()-1),ae<ge&&(console.warn("Invalid date range: end date must be after or equal to start date"),U=false)):U=false;U&&ge&&ae&&(ae.getTime()<ge.getTime()?console.warn("Invalid date range: end date cannot be before start date"):m?.(e,ge,ae));}f?.(e.id,0,false),qe(t,r);}},[P,ee,Y,e,m,X,p,t,r,s,Bt,ze,te,qe,f]);useEffect(()=>{if(P==="none")return;let _=ae=>{da(ae);},ge=()=>{ha();};return window.addEventListener("mousemove",_),window.addEventListener("mouseup",ge),()=>{window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",ge),T.current&&(window.clearInterval(T.current),T.current=null);}},[P,da,ha]);let W=Ue&&!Ht?ee:t,ne=Ue&&!Ht?Y:r,ft=l.taskClass(e),Tt=24,pa=h?e.isCriticalPath?1:.25:1,ce=useCallback(_=>{if(!J)return;_.stopPropagation(),_.preventDefault();let ae=D.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;F.current={barRect:ae,initialPct:e.progress||0},_.currentTarget.setPointerCapture(_.pointerId),R(e.progress||0);},[J,e.progress,R]),ve=useCallback(_=>{let ge=F.current;if(!ge)return;let U=D.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??ge.barRect;if(!U||U.width<=0)return;let oe=(_.clientX-U.left)/U.width,Le=Math.round(Math.max(0,Math.min(1,oe))*100);_.shiftKey&&(Le=Math.round(Le/25)*25),R(Le);},[R]),Et=useCallback(_=>{let ge=F.current;if(!ge)return;_.stopPropagation(),_.preventDefault();try{_.currentTarget.releasePointerCapture(_.pointerId);}catch{}let ae=le;F.current=null,R(null),ae!=null&&ae!==ge.initialPct&&w&&w(e,ae);},[le,w,e,R]),it=useCallback(_=>{_.stopPropagation(),_.preventDefault();},[]),wt=le??(e.progress||0);return jsxs("g",{ref:D,"data-task-bar":"true",style:{opacity:pa,transition:"opacity 300ms ease"},onClick:()=>{!Ue&&!A.current&&d?.(e),A.current=false;},onDoubleClick:_=>{!Ue&&!A.current&&(_.stopPropagation(),i?.(e));},onContextMenu:_=>{_.preventDefault(),u?.(e,_);},onMouseEnter:()=>!Ue&&Ke(true),onMouseMove:_=>{v&&pt&&!Ue&&!e.segments&&v({task:e,x:t,y:a,width:r,height:We,showBelow:false,mouseX:_.clientX,mouseY:_.clientY});},onMouseLeave:()=>{Ue||(Ke(false),z(null));},children:[jsx("rect",{x:t,y:a,width:r+Tt,height:We,fill:"transparent",style:{pointerEvents:"all"}}),pt&&!Ue&&!jt&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:mt,height:We,fill:He==="resize-start"?n.accent:"transparent",opacity:He==="resize-start"?.15:0,style:{cursor:Qe,pointerEvents:"all"},onMouseEnter:()=>z("resize-start"),onMouseDown:_=>Wt(_,"resize-start")}),jsx("rect",{x:t+mt,y:a,width:r-mt*2,height:We,fill:He==="move"?n.accent:"transparent",opacity:He==="move"?.1:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>z("move"),onMouseDown:_=>Wt(_,"move")}),jsx("rect",{x:t+r-mt,y:a,width:mt,height:We,fill:He==="resize-end"?n.accent:"transparent",opacity:He==="resize-end"?.15:0,style:{cursor:Qe,pointerEvents:"all"},onMouseEnter:()=>z("resize-end"),onMouseDown:_=>Wt(_,"resize-end")})]}),pt&&!Ue&&St&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:We,fill:He==="move"?n.accent:"transparent",opacity:He==="move"?.2:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>z("move"),onMouseDown:_=>Wt(_,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:We,fill:He==="resize-end"?n.accent:"transparent",opacity:He==="resize-end"?.2:0,style:{cursor:Qe,pointerEvents:"all"},onMouseEnter:()=>z("resize-end"),onMouseDown:_=>Wt(_,"resize-end")}),pt&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+We-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Ue&&!Ht&&!e.segments&&jsx(motion.rect,{x:ee,y:a,width:Y,height:We,rx:Ee,fill:n.accent,opacity:.15,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),y&&e.baselineStartDate&&e.baselineEndDate&&!Ue&&(()=>{let _=e.baselineStartDate.getTime(),ge=e.baselineEndDate.getTime(),ae=o.getTime(),U=864e5,oe=(_-ae)/U,Le=(ge-_)/U,C=oe*s,$=Math.max(Le*s,s),fe=W+ne,De=C+$,se=e.endDate?.getTime()??0,ut=Math.ceil((se-ge)/U),lt=ut>0,Zt=ut<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:C,y:a,width:$,height:We,rx:Ee,fill:"none",stroke:zt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),lt&&fe>De&&jsx("rect",{x:De,y:a,width:fe-De,height:We,rx:0,fill:"#EF4444",opacity:.2}),lt&&jsxs("text",{x:Math.max(fe,De)+6,y:a+We/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",ut,"d"]}),Zt&&jsxs("text",{x:fe+6,y:a+We/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[ut,"d"]})]})})(),!e.segments&&ot&&nt&&(()=>{let ge=a+(We-8)/2,ae=4,U=e.progress||0,oe=new Date;oe.setHours(0,0,0,0);let Le=e.startDate&&oe>=e.startDate,C=e.endDate&&(()=>{let lt=new Date(e.endDate);return lt.setHours(0,0,0,0),oe>lt})(),$=e.startDate&&oe<e.startDate,fe=1;if(Le&&e.startDate&&e.endDate&&!$){let lt=new Date(e.startDate);lt.setHours(0,0,0,0);let Zt=new Date(e.endDate);Zt.setHours(0,0,0,0);let Yt=Math.max(1,(Zt.getTime()-lt.getTime())/(1e3*60*60*24)),La=Math.min((oe.getTime()-lt.getTime())/(1e3*60*60*24),Yt)/Yt*100;fe=La>0?U/La:1;}let De;U>=100?De="#00E5CC":$?De="#4B5563":C&&U<100?De="#EF4444":fe>=.95?De="#22C55E":fe>=.8?De="#F59E0B":De="#EF4444";let se=Math.max(U/100*ne,U>0?ae*2:0),ut=ne>100&&U>0;return jsxs("g",{"data-task-class":ft,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:W,y:ge,width:ne,height:8,rx:ae,fill:"rgba(255,255,255,0.10)"}),U>0&&jsx("rect",{x:W,y:ge,width:se,height:8,rx:ae,fill:De}),ut&&jsxs("text",{x:W+se+6,y:ge+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(U),"%"]})]})})(),!e.segments&&ot&&!nt&&jsx(motion.rect,{x:W,y:a,width:ne,height:We,rx:Ee,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":ft,"data-bar-background":"true",initial:{opacity:0,scale:.95},animate:{opacity:Ue&&!Ht?.15:e.parentId?.6:1,scale:pt&&!Ue?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:_=>Wt(_),style:{cursor:ct,pointerEvents:"all"}}),!e.segments&&!ot&&jsx(motion.rect,{x:W,y:a,width:ne,height:We,rx:Ee,fill:Pe,"data-task-class":ft,initial:{opacity:0,scale:.95},animate:{opacity:Ue&&!Ht?.15:e.parentId?.6:pt?.9:.8,scale:pt&&!Ue?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:nt?void 0:_=>Wt(_),style:{cursor:nt?"default":ct,pointerEvents:"all"}}),ot&&(O||Z)&&!e.segments&&jsx("rect",{x:W,y:a,width:ne,height:We,rx:Ee,fill:"none",stroke:n.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${n.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&wt>0&&!nt&&jsx("rect",{x:W,y:a,width:Math.max(ne*(wt/100),Ee*2),height:We,rx:Ee,fill:Pe,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!nt&&e.progress<100&&(()=>{let _=e.progress>0?ne*(e.progress/100):0,ge=W+_,ae=ne-_,U=e.progress===0?Ee:0,oe=e.progress===0?W:ge,Le=e.progress===0?ne:ae;return jsxs(Fragment,{children:[jsx("rect",{x:oe,y:a,width:Le,height:We,rx:U,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:oe,y:a,width:Le,height:We,rx:U,fill:"none",stroke:"#00E5CC",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),ot&&!e.segments&&e.progress>0&&e.progress<100&&!nt&&!Ue&&le===null&&(()=>{let _=W+ne*(e.progress/100),ge=8,ae=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:_,cy:a+We/2,r:ge,fill:ae?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:_,y:a+We/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:ae?.initials||ae?.name?.charAt(0)?.toUpperCase()||""})]})})(),J&&!Ue&&ne>=40&&(le!==null||wt<88)&&(()=>{let _=W+ne*(wt/100),ge=a+We/2,ae=le!==null,U=ae?7:pt?6:5,oe=ae||pt?1:.35,Le=W+ne-_,C=Math.max(4,Math.min(12,Le-10)),$=12;return jsxs("g",{children:[jsx("rect",{x:_-$,y:ge-12,width:$+C,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:ce,onPointerMove:ve,onPointerUp:Et,onPointerCancel:Et,onClick:it,onDoubleClick:it,onMouseDown:fe=>fe.stopPropagation()}),jsx("circle",{cx:_,cy:ge,r:U,fill:"#FFFFFF",stroke:Pe,strokeWidth:2,opacity:oe,style:{pointerEvents:"none",filter:ae?`drop-shadow(0 0 4px ${Pe})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),ae&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:_-20,y:ge-28,width:40,height:18,rx:4,fill:zt?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:Pe,strokeWidth:1}),jsxs("text",{x:_,y:ge-16,textAnchor:"middle",dominantBaseline:"central",fill:zt?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[le,"%"]})]})]})})(),e.segments&&e.segments.map((_,ge)=>{let ae=(_.startDate.getTime()-o.getTime())/864e5*s,oe=(_.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-ae+s,Le=Ue&&P==="move"&&te===ge,C=at===ge,$=Le?ae+ze:ae;return jsxs("g",{onMouseEnter:()=>!Ue&&be(ge),onMouseLeave:()=>!Ue&&be(null),children:[jsx(motion.rect,{x:$,y:a,width:oe,height:We,rx:Ee,fill:Pe,initial:{opacity:0,scale:.95},animate:{opacity:Le||e.parentId?.6:C?.9:.8,scale:C&&!Ue?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:fe=>{fe.stopPropagation(),xe(ge),Ne(ae),Wt(fe,void 0,ae);},style:{cursor:ct,pointerEvents:"all"}}),jsx("rect",{x:$,y:a,width:oe*(e.progress/100),height:We,rx:Ee,fill:Pe,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ge}`)}),Ve&&(O||Z)&&!e.segments&&jsxs(Fragment,{children:[Z&&!O&&jsx("rect",{x:W,y:a,width:ne,height:We,rx:Ee,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),O&&jsx("rect",{x:W,y:a,width:ne,height:We,rx:Ee,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&ne>60&&!e.segments&&!(ot&&nt)&&(()=>{let _=l.taskLabel(e),ge=typeof _=="string"?_:e.name,ae=ge.length>Math.floor(ne/8)?`${ge.substring(0,Math.floor(ne/8))}...`:ge;return jsx("text",{x:W+8,y:a+We/2,dominantBaseline:"middle",fill:ke?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ke?"line-through":"none"},children:ae})})(),!Ue&&!e.segments&&!nt&&e.progress>0&&e.progress<100&&(ot?jsxs("text",{x:W+ne+6,y:a+We/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):ne>100?jsxs("text",{x:W+ne-12,y:a+We/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&ne>80&&!Ue&&!e.segments&&!(ot&&nt)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:W+ne-8,cy:a+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:W+ne-8,cy:a+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(pt||kt)&&!Ht&&!e.segments&&!nt&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:W-2,y:a,width:16,height:We,fill:"transparent",style:{cursor:Qe},onMouseEnter:()=>z("resize-start"),onMouseLeave:()=>z(null),onMouseDown:_=>{_.stopPropagation(),Wt(_,"resize-start");}}),jsx(motion.rect,{x:W+4,y:a+8,width:3,height:We-16,rx:1.5,fill:He==="resize-start"||P==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:W+ne-14,y:a,width:16,height:We,fill:"transparent",style:{cursor:Qe},onMouseEnter:()=>z("resize-end"),onMouseLeave:()=>z(null),onMouseDown:_=>{_.stopPropagation(),Wt(_,"resize-end");}}),jsx(motion.rect,{x:W+ne-7,y:a+8,width:3,height:We-16,rx:1.5,fill:He==="resize-end"||P==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:pt&&!Ue&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+r+10,cy:a+We/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>z("connect"),onMouseLeave:()=>z(null),onMouseDown:_=>{_.stopPropagation(),Wt(_,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+We/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:He==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Ht&&V&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+We/2,x2:V.x,y2:V.y,stroke:X?n.statusCompleted:n.accent,strokeWidth:X?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:X?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:V.x,cy:V.y,r:X?8:6,fill:X?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),X&&jsx(motion.text,{x:V.x+15,y:V.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:V.x+10},animate:{opacity:1,x:V.x+15},transition:{duration:.2},children:"Connect"})]}),(pt||Ue)&&!Ht&&!e.segments&&jsx(motion.rect,{x:W-1,y:a-1,width:ne+2,height:We+2,rx:Ee+1,fill:"none",stroke:Ue?n.accent:ot?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:ot?1:2,opacity:Ue||ot?.6:.4,initial:{opacity:0},animate:{opacity:Ue||ot?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),kt&&jsxs(Fragment,{children:[jsx("line",{x1:ee,y1:0,x2:ee,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:ee+Y,y1:0,x2:ee+Y,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:pt&&!Ue&&!e.segments&&!v&&(()=>{let ae=a<100,U=ae?a+We+13:a-82-13,oe=ae?`M ${W+ne/2-6} ${a+We+3} L ${W+ne/2} ${a+We+13} L ${W+ne/2+6} ${a+We+3}`:`M ${W+ne/2-6} ${a-13} L ${W+ne/2} ${a-3} L ${W+ne/2+6} ${a-13}`,Le=U+22,C=U+40,$=U+55,fe=U+70,De=ae?U+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:oe,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsx("rect",{x:W+ne/2-120,y:U,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:W+ne/2,y:Le,textAnchor:"middle",fill:n.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:W+ne/2-110,y:C,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:W+ne/2-70,y:C,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ut(e.startDate)}),jsx("text",{x:W+ne/2-110,y:$,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:W+ne/2-70,y:$,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ut(e.endDate)}),jsx("text",{x:W+ne/2+10,y:C,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:W+ne/2+65,y:C,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:gt()}),jsx("text",{x:W+ne/2+10,y:$,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:W+ne/2+65,y:$,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:W+ne/2-110,y:fe,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:W+ne/2-50,y:fe,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(se=>se.name).join(", ").substring(0,30),e.assignees.map(se=>se.name).join(", ").length>30?"...":""]})]}),!ae&&jsx("text",{x:W+ne/2,y:De,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:St?"Left: move \u2022 Right: resize":jt?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var Zd=260,es=8,$m=16,Uv=-12;function Hm({tooltipData:e,theme:t,locale:a="en",workingDaysConfig:r}){let[n,s]=useState(null);if(useLayoutEffect(()=>{if(!e){s(null);return}let{task:x,mouseX:w,mouseY:N}=e,D=x.effortMinutes!=null||x.timeLoggedMinutes!=null||x.soldEffortMinutes!=null,A=x.lastActivity!=null,T=(D?155:105)+(A?28:0),E=w+$m,P=N+Uv-T;E+Zd>window.innerWidth-es&&(E=w-Zd-$m),E<es&&(E=es);let k=P<es;k&&(P=N+20),P+T>window.innerHeight-es&&(P=window.innerHeight-es-T),s({left:E,top:P,showBelow:k});},[e]),!e||!n)return null;let{task:o}=e,l=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,d={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"},i=x=>x.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),u=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!r?.enabledWeekdays){let P=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return a==="es"?`${P} d\xEDa${P!==1?"s":""}`:`${P} day${P!==1?"s":""}`}let x=r.enabledWeekdays,w=r.holidayDates instanceof Set?r.holidayDates:new Set(r.holidayDates??[]),N=P=>`${P.getFullYear()}-${String(P.getMonth()+1).padStart(2,"0")}-${String(P.getDate()).padStart(2,"0")}`,D=0,A=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),T=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;A.getTime()<=T.getTime();){let P=A.getDay();x[P]&&!w.has(N(A))&&D++,A.setDate(A.getDate()+1);}let E=Math.max(0,D);return a==="es"?`${E} d\xEDa${E!==1?"s":""}`:`${E} day${E!==1?"s":""}`},m=x=>{if(x==null||x===0)return "N/A";let w=Math.floor(x/60),N=x%60;return w===0?`${N}m`:N===0?`${w}h`:`${w}h ${N}m`},p=t.textTertiary||"#9CA3AF",g=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",v=t.accent||"#00E5CC",y=t.bgSecondary||"#1F2937",b=t.border||"#374151",h=jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:Zd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:y,border:`1px solid ${b}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:f,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(_i,{label:d.start,value:o.startDate?i(o.startDate):"N/A",labelColor:p,valueColor:g}),jsx(_i,{label:d.duration,value:u(),labelColor:p,valueColor:g}),jsx(_i,{label:d.end,value:o.endDate?i(o.endDate):"N/A",labelColor:p,valueColor:g}),jsx(_i,{label:d.progress,value:`${o.progress}%`,labelColor:p,valueColor:g})]}),o.assignees&&o.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:p},children:[d.assignees,": "]}),jsx("span",{style:{color:g,fontWeight:500},children:o.assignees.map(x=>x.name).join(", ")})]}),l&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[o.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:p},children:[d.estimated,":"]})," ",jsx("span",{style:{color:g,fontWeight:600},children:m(o.effortMinutes)})]}),o.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:p},children:[d.logged,":"]})," ",jsx("span",{style:{color:v,fontWeight:600},children:m(o.timeLoggedMinutes)})]}),o.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:p},children:[d.quoted,":"]})," ",jsx("span",{style:{color:g,fontWeight:600},children:m(o.soldEffortMinutes)})]})]}),o.lastActivity&&jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:p,lineHeight:1.4},children:[jsx("span",{style:{opacity:.7},children:a==="es"?"\xDAltimo: ":"Last: "}),jsx("span",{style:{color:g},children:o.lastActivity.userName})," ",jsx("span",{children:o.lastActivity.summary})," ",jsx("span",{style:{opacity:.6},children:o.lastActivity.relativeTime})]})]}),jsx("style",{children:`
125
+ - [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Bc({templates:e,onSelectTemplate:t,className:r}){let[a,n]=useState(false),s=useRef(null),o=useRef(null);useEffect(()=>{function i(d){s.current&&!s.current.contains(d.target)&&o.current&&!o.current.contains(d.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let c=i=>{t(i),n(false);},l=e.reduce((i,d)=>{let u=d.category||"Other";return i[u]||(i[u]=[]),i[u].push(d),i},{});return jsxs("div",{className:g("relative inline-block",r),children:[jsxs("button",{ref:o,onClick:()=>n(!a),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:g("w-4 h-4 transition-transform",a&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(l).map(([i,d])=>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:d.map(u=>jsxs("button",{onClick:()=>c(u),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter: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:u.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:u.name}),u.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:u.description})]})]},u.id))})]},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 Oc({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:s}){let[o,c]=useState("export"),[l,i]=useState("json"),[d,u]=useState(null),p=useRef(null);if(!t)return null;let m=async()=>{let x=n?.current||void 0,y=await Lu(e,l,x);Au(y,l);},f=async x=>{let y=x.target.files?.[0];if(y){try{let b=await Bu(y),h=y.name.endsWith(".json")?"json":"csv",v=Ru(b,h);u(v),v.success&&a&&a(v,b);}catch(b){u({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:r,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>c("export"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="export"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>c("import"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="import"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[o==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxs("button",{onClick:()=>i(x),className:g("p-4 rounded-lg border-2 transition-all text-center",l===x?"border-[#00E5CC] bg-[#00E5CC]/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:m,className:"w-full py-3 px-4 bg-gradient-to-r from-[#00C4AE] to-[#00C4AE] hover:from-[#00E5CC] hover:to-[#00C4AE] text-white font-semibold rounded-lg transition-all shadow-lg shadow-[#00E5CC]/20",children:"Export Board"})]}),o==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:p,type:"file",accept:".json,.csv",onChange:f,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"})]})]}),d&&jsxs("div",{className:g("p-4 rounded-lg",d.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:g("font-semibold mb-2",d.success?"text-green-400":"text-red-400"),children:d.success?"\u2713 Import Successful":"\u2717 Import Failed"}),d.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",d.cardsImported]}),jsxs("div",{children:["Columns imported: ",d.columnsImported]})]}),d.errors&&d.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:d.errors.map((x,y)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},y))})]})]})]})]})]})}var Dx=["URGENT","HIGH","MEDIUM","LOW"],Sx=[{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"}],Ex=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Hc({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:c,availableUsers:l=[],availableLabels:i=[],availableColumns:d=[],showQuickFilters:u=true,compact:p=false,groupBy:m="none",onGroupByChange:f}){let[x,y]=useState(true),b=useCallback(E=>{r({search:E.target.value});},[r]),h=useCallback(E=>{r({dateFilter:E.target.value});},[r]),v=useCallback(E=>{a({by:E.target.value});},[a]),w=useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),T=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${p?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>y(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),T&&jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!x&&jsxs("div",{className:"filter-bar__content",children:[u&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),o&&jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:b,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange: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:E=>{let F=E.target.value;r({priorities:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Dx.map(E=>jsx("option",{value:E,children:E},E))]})}),l.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:E=>{let F=E.target.value;r({assignees:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),l.map(E=>jsx("option",{value:E.id,children:E.name},E.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:E=>{let F=E.target.value;r({labels:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(E=>jsx("option",{value:E,children:E},E))]})}),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:v,className:"filter-bar__select filter-bar__select--sm",children:Sx.map(E=>jsx("option",{value:E.value,children:E.label},E.value))}),t.by!=="none"&&jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),f&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:m,onChange:E=>f(E.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Ex.map(E=>jsx("option",{value:E.value,children:E.label},E.value))})}),T&&jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Uc({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:c,onExportGanttCSV:l}){let[i,d]=useState(false),u=useRef(null);useEffect(()=>{let m=f=>{u.current&&!u.current.contains(f.target)&&d(false);};return i&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[i]);let p=m=>{m(),d(false);};return jsxs("div",{className:g("relative",a),ref:u,children:[jsxs("button",{onClick:()=>d(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",m.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",m.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxs("button",{onClick:()=>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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>p(async()=>await o?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>p(async()=>await c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("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(()=>l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("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:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxs("button",{onClick:()=>p(r),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Wc={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#00E5CC",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},zc={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#00E5CC",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Gc={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"}},To={dark:Wc,light:zc,neutral:Gc},Vi="dark";var ji=createContext(void 0),Ox="asakaa-theme";function cm({children:e,defaultTheme:t=Vi,storageKey:r=Ox}){let[a,n]=useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(r);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=useCallback(c=>{n(c),typeof window<"u"&&localStorage.setItem(r,c);},[r]);useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,l=To[a];Object.entries(l.colors).forEach(([d,u])=>{u&&c.style.setProperty(`--theme-${Hx(d)}`,u);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([d,u])=>{let p=l.colors[d];p&&c.style.setProperty(u,p);}),c.setAttribute("data-theme",a),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${a}`);},[a]);let o={theme:a,setTheme:s,themes:To};return jsx(ji.Provider,{value:o,children:e})}function Qo(){let e=useContext(ji);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Hx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Vc({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=Qo();return e?jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries(To).map(([s,o])=>jsxs("button",{onClick:()=>{n(s),t();},className:g("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",a===s?"border-[#00E5CC] bg-[#00E5CC]/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:a===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:o.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:o.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),a===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}var lt={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#00E5CC",accentHover:"#5AADFF",accentLight:"rgba(0, 229, 204, 0.12)",taskBarPrimary:"#00E5CC",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#00E5CC",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(0, 229, 204, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(0, 196, 174, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#00E5CC",accentHover:"#1D4ED8",accentLight:"rgba(0, 196, 174, 0.08)",taskBarPrimary:"#00E5CC",taskBarProgress:"#00A893",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#00E5CC",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#00E5CC",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(0, 196, 174, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};function dm(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return lt[e]||lt.dark;let t=document.documentElement,r=getComputedStyle(t),a=(s,o)=>r.getPropertyValue(s).trim()||o;return {bgPrimary:a("--theme-bg-primary",lt[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",lt[e].bgSecondary),bgGrid:a("--theme-bg-card",lt[e].bgGrid),bgWeekend:a("--theme-bg-hover",lt[e].bgWeekend),border:a("--theme-border-primary",lt[e].border),borderLight:a("--theme-border-subtle",lt[e].borderLight),textPrimary:a("--theme-text-primary",lt[e].textPrimary),textSecondary:a("--theme-text-secondary",lt[e].textSecondary),textTertiary:a("--theme-text-tertiary",lt[e].textTertiary),accent:a("--theme-accent-primary",lt[e].accent),accentHover:a("--theme-accent-hover",lt[e].accentHover),accentLight:a("--theme-accent-primary",lt[e].accentLight),taskBarPrimary:a("--theme-accent-primary",lt[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",lt[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",lt[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",lt[e].dependency),dependencyHover:a("--theme-border-secondary",lt[e].dependencyHover),criticalPath:a("--theme-error",lt[e].criticalPath),criticalPathLight:a("--theme-error",lt[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",lt[e].today):e==="neutral"?a("--theme-text-primary",lt[e].today):a("--theme-error",lt[e].today),todayLight:e==="light"?a("--theme-accent-primary",lt[e].todayLight):e==="neutral"?a("--theme-text-primary",lt[e].todayLight):a("--theme-error",lt[e].todayLight),milestone:a("--theme-warning",lt[e].milestone),milestoneLight:a("--theme-warning",lt[e].milestoneLight),statusTodo:a("--theme-text-tertiary",lt[e].statusTodo),statusInProgress:a("--theme-accent-primary",lt[e].statusInProgress),statusCompleted:a("--theme-success",lt[e].statusCompleted),hoverBg:a("--theme-bg-hover",lt[e].hoverBg),focusRing:a("--theme-accent-primary",lt[e].focusRing),...lt[e].dotGrid&&{dotGrid:lt[e].dotGrid},...lt[e].glassHeader&&{glassHeader:lt[e].glassHeader},...lt[e].glassToolbar&&{glassToolbar:lt[e].glassToolbar},...lt[e].forecastHud&&{forecastHud:lt[e].forecastHud},...lt[e].neonRedGlow&&{neonRedGlow:lt[e].neonRedGlow},...lt[e].executionBarBg&&{executionBarBg:lt[e].executionBarBg}}}var _i={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},um={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},jc={en:_i,es:um};function pm(e){return jc[e]||jc.en}function _c(e,t){let r=pm(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},contextMenu:{...r.contextMenu,...t.contextMenu},actions:{...r.actions,...t.actions},status:{...r.status,...t.status},labels:{...r.labels,...t.labels},ai:{...r.ai,...t.ai,suggestions:{...r.ai.suggestions,...t.ai?.suggestions},errors:{...r.ai.errors,...t.ai?.errors}},export:{...r.export,...t.export},dateFormat:{...r.dateFormat,...t.dateFormat}}:r}var es=createContext(_i);function _a(){return useContext(es)}function Gs(e,t,r="left",a=208){let[n,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),c=o.bottom+4,l;r==="right"?l=o.right-a:l=o.left;let i=8;l+a>window.innerWidth-i&&(l=window.innerWidth-i-a),l<i&&(l=i),s({top:c,left:l});},[t,r,e,a]),n}function wm({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[c,l]=useState(false),[i,d]=useState(null),u=useRef(null),p=useRef(null),m=_a(),f=Gs(u,c,"right",176);if(useEffect(()=>{if(!c)return;let h=v=>{let w=v.target;u.current&&!u.current.contains(w)&&p.current&&!p.current.contains(w)&&l(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]),!(t||r||a||n||s||o))return null;let y=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:r},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:a},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:n},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:o}].filter(h=>h.handler),b=async(h,v)=>{if(v){d(h);try{await v();}catch(w){console.error(`Export ${h} failed:`,w);}finally{d(null),l(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:u,onClick:()=>l(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:m.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:p,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-44 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:y.map((h,v)=>jsxs(motion.button,{onClick:()=>b(h.id,h.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<y.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===h.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):h.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:h.label}),jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})}),document.body)]})}function gm({theme:e,onExportPNG:t,onExportPDF:r,onExportExcel:a,onExportMSProject:n,onCopySnapshotLink:s}){let[o,c]=useState(false),[l,i]=useState(null),[d,u]=useState(false),p=useRef(null),m=useRef(null),f=_a(),x=Gs(p,o,"right",224),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=f.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!o)return;let T=E=>{let F=E.target;p.current&&!p.current.contains(F)&&m.current&&!m.current.contains(F)&&c(false);};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[o]);let h=[{id:"png",label:f.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:f.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:r},{id:"excel",label:f.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:a},{id:"msproject",label:f.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:n}].filter(T=>T.handler),v=async(T,E)=>{if(E){i(T);try{await E();}catch(F){console.error(`Export ${T} failed:`,F);}finally{i(null),c(false);}}},w=()=>{s?.(),u(true),setTimeout(()=>u(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:p,onClick:()=>c(!o),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:o?e.accent:e.textTertiary,backgroundColor:o?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:f.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:o&&jsxs(motion.div,{ref:m,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:x.top,left:x.left,zIndex:99999,backgroundColor:y?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${y?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:y?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[h.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:h.map((T,E)=>jsxs(motion.button,{onClick:()=>v(T.id,T.handler),disabled:l!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:E*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:l===T.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):T.icon}),jsx("span",{className:"flex-1 text-left",children:T.label})]},T.id))})]}),h.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:w,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:d?"rgba(34,197,94,0.15)":e.accentLight,color:d?"#22C55E":e.accent},children:d?jsx(Check,{className:"w-3.5 h-3.5"}):jsx(Link2,{className:"w-3.5 h-3.5"})}),jsx("span",{className:"flex-1 text-left",children:d?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function iv({options:e,value:t,onChange:r,theme:a,layoutId:n="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`},children:e.map(s=>{let o=t===s.value;return jsxs(motion.button,{onClick:()=>r(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:o?a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsx(motion.div,{layoutId:n,className:"absolute inset-0 rounded-md",style:{backgroundColor:a.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:s.label})]},s.value)})})}function lv({options:e,value:t,onChange:r,theme:a}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(n=>{let s=t===n.value;return jsxs(motion.button,{onClick:()=>r(n.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?a.accent:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?a.accent:a.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:n.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:a.accent},transition:{type:"spring",stiffness:400,damping:30}})]},n.value)})})}function fm({theme:e,value:t,onChange:r,maxDepth:a}){let[n,s]=useState(false),o=useRef(null),c=useRef(null),l=_a(),i=Gs(o,n,"left");useEffect(()=>{if(!n)return;let p=m=>{let f=m.target;o.current&&!o.current.contains(f)&&c.current&&!c.current.contains(f)&&s(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[n]);let d=[{value:"all",label:l.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(a,5)},(p,m)=>({value:m+1,label:`L${m+1}`}))],u=t==="all"?l.toolbar.wbsAllLevels||"All":`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:o,onClick:()=>s(!n),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:n?e.accentLight:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${l.toolbar.wbsLevel||"Level"}: ${u}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:u})]}),createPortal(jsx(AnimatePresence,{children:n&&jsx(motion.div,{ref:c,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:d.map((p,m)=>{let f=t===p.value;return jsxs(motion.button,{onClick:()=>{r(p.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:f?e.accentLight:"transparent",borderBottom:m<d.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:f?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsx("span",{className:"text-[11px]",style:{color:f?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:f?600:500},children:p.label}),f&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(p.value))})})})}),document.body)]})}function bm({theme:e,value:t,onChange:r,hideCompleted:a=false,onHideCompletedChange:n}){let[s,o]=useState(false),c=useRef(null),l=useRef(null),i=_a(),d=Gs(c,s,"left");useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let x=b=>{let h=b.target;c.current&&!c.current.contains(h)&&l.current&&!l.current.contains(h)&&o(false);},y=b=>{b.key==="Escape"&&o(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",y),l._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(f),l._cleanup&&l._cleanup();}},[s]);let u=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],p=t!=="all"||a,m=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:c,onClick:f=>{f.stopPropagation(),o(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:p?m?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${p?m?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:p?"#00E5CC":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children:i.toolbar.filter||"Filters"}),p&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#00E5CC"}})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref:l,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:d.top,left:d.left,zIndex:99999,backgroundColor:m?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${m?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:m?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:m?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:m?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:u.map(f=>{let x=t===f.value&&!a,y=()=>f.value==="all"?x?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):f.icon;return jsxs(motion.button,{onClick:()=>{r(f.value),n&&n(false),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:x?m?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:m?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${x?f.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:m?"rgba(255,255,255,0.85)":"#111827"},children:f.label}),x&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},f.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:m?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),n&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{n(!a),a||r("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:a?m?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:m?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:a?"#00E5CC":m?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:m?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),a&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function cv({value:e,onChange:t,theme:r}){let a=_a(),n=r.bgPrimary==="#050505"||r.textPrimary==="#FFFFFF",s=[{value:"day",label:a.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:a.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:a.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":r.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":r.border}`},children:s.map(o=>{let c=e===o.value;return jsx(motion.button,{onClick:()=>t(o.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:c?n?"#FFFFFF":r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:c?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":r.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function dv({theme:e,forecast:t}){let r=_a(),a=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",n=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,o=s!=null,c=s!=null?s>0?`+${s}d ${r.toolbar.delayLabel}`:s<0?`${s}d ${r.toolbar.earlyLabel}`:r.toolbar.onTimeLabel:null,l=s!=null&&s>0?{bg:a?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:a?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:a?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:a?"#22C55E":"#16A34A"}:{bg:a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,d=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,u=t?.costAtCompletion,p=t?.currency||"$",m=u!=null?u>=1e6?`${p}${(u/1e6).toFixed(2)}M`:u>=1e3?`${p}${(u/1e3).toFixed(1)}K`:`${p}${u.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,x=f!=null&&f!==0,y=f!=null?f>0?`+${f.toFixed(0)}% ${r.toolbar.budgetOver}`:`${f.toFixed(0)}% ${r.toolbar.budgetUnder}`:null,b=f!=null&&f>0?{bg:a?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:a?"#EF4444":"#DC2626"}:f!=null&&f<0?{bg:a?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:a?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(a?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-6",children:[jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:r.toolbar.projectForecast}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.expectedFinish,": ",n]}),o&&c&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:l.bg,color:l.text,fontFamily:"'JetBrains Mono', monospace"},children:c})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:d,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:a?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:m}),x&&y&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:b.bg,color:b.text,fontFamily:"'JetBrains Mono', monospace"},children:y})]})]})]})}function uv({theme:e,showCriticalPath:t,onShowCriticalPathChange:r,showBaseline:a,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:c,onShowDependenciesChange:l,rowDensity:i,onRowDensityChange:d,hasDependencies:u=true}){let[p,m]=useState(false),f=useRef(null),x=useRef(null),y=_a(),b=Gs(f,p,"right",208),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!p)return;let E=F=>{let k=F.target;f.current&&!f.current.contains(k)&&x.current&&!x.current.contains(k)&&m(false);};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[p]);let v=y.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:v?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:r,disabled:!u,tooltip:u?void 0:v?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:v?"L\xEDneas Base":"Baselines",icon:Layers,active:a,onChange:n},{key:"weekends",label:v?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:o},{key:"dependencies",label:v?"Dependencias":"Dependencies",icon:GitBranch,active:c,onChange:l}],T=[{value:"compact",label:y.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:y.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:f,onClick:()=>m(!p),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:p?e.accent:e.textTertiary,backgroundColor:p?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:y.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:p&&jsxs(motion.div,{ref:x,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:b.top,left:b.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:y.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:w.map((E,F)=>{let k=E.icon,D=E.disabled,P=E.tooltip;return jsxs(motion.button,{onClick:()=>!D&&E.onChange?.(!E.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:D?h?"rgba(255,255,255,0.3)":"#9CA3AF":h?"rgba(255,255,255,0.85)":"#111827",cursor:D?"not-allowed":"pointer"},whileHover:D?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:F*.03},title:P,children:[jsx(k,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:D?h?"rgba(255,255,255,0.2)":"#D1D5DB":E.active?e.accent||"#00E5CC":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:E.label}),E.active&&!D&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},E.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),jsxs("div",{className:"py-0.5",children:[jsx("div",{className:"px-3 pt-2 pb-1",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:y.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),T.map((E,F)=>{let k=i===E.value;return jsxs(motion.button,{onClick:()=>d(E.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(w.length+F)*.03},children:[jsx("span",{style:{color:k?e.accent||"#00E5CC":h?"rgba(255,255,255,0.85)":e.textPrimary},children:E.label}),k&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},E.value)})]})]})}),document.body)]})}function Ki({theme:e,timeScale:t,onTimeScaleChange:r,zoom:a,onZoomChange:n,currentTheme:s,onThemeChange:o,rowDensity:c,onRowDensityChange:l,showThemeSelector:i=false,showCreateTaskButton:d=false,createTaskLabel:u,onCreateTask:p,taskFilter:m="all",onTaskFilterChange:f,hideCompleted:x=false,onHideCompletedChange:y,toolbarRightContent:b,wbsLevel:h,onWbsLevelChange:v,maxWbsDepth:w=4,viewMode:T="execution",onViewModeChange:E,projectForecast:F,onExportPNG:k,onExportPDF:D,onExportExcel:P,onExportCSV:N,onExportJSON:K,onExportMSProject:H,showCriticalPath:te=true,onShowCriticalPathChange:I,showDependencies:_=true,onShowDependenciesChange:j,highlightWeekends:W=true,onHighlightWeekendsChange:B,showBaseline:ve=false,onShowBaselineChange:We,onCopySnapshotLink:Le,hasDependencies:be=true}){let ge=_a(),ye=k||D||P||N||K||H,ze=!!e.glassToolbar,ke=[{value:"day",label:ge.toolbar.day},{value:"week",label:ge.toolbar.week},{value:"month",label:ge.toolbar.month}],Ie=[{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"})}],De=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(ze){let qe=De?"rgba(255,255,255,0.08)":e.borderLight;return jsxs("div",{className:"flex flex-col",children:[jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsx("div",{className:"flex items-center gap-3",children:E&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:De?"#000000":e.bgSecondary,border:`1px solid ${De?"rgba(255,255,255,0.08)":e.border}`},children:[jsx(motion.button,{onClick:()=>E("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:T==="execution"?De?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:T==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:T!=="execution"?{color:e.textSecondary}:{},children:ge.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>E("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:T==="oracle"?De?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:T==="oracle"?"#00E5CC":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:T!=="oracle"?{color:e.textSecondary}:{},children:ge.toolbar.viewOracle})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(cv,{value:t,onChange:r,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:qe}}),v&&jsx(fm,{theme:e,value:h??"all",onChange:v,maxDepth:w}),f&&jsx(bm,{theme:e,value:m,onChange:f,hideCompleted:x,onHideCompletedChange:y}),b&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:qe}}),b]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:qe}}),jsx(uv,{theme:e,showCriticalPath:te,onShowCriticalPathChange:I,showBaseline:ve,onShowBaselineChange:We,highlightWeekends:W,onHighlightWeekendsChange:B,showDependencies:_,onShowDependenciesChange:j,rowDensity:c,onRowDensityChange:l,hasDependencies:be}),jsx(gm,{theme:e,onExportPNG:k,onExportPDF:D,onExportExcel:P,onExportMSProject:H,onCopySnapshotLink:Le}),d&&p&&jsxs(motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${De?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${De?"rgba(0, 229, 204,0.4)":"rgba(0, 196, 174,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:u||ge.toolbar.createTask})]})]})]}),F&&jsx(dv,{theme:e,forecast:F})]})}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(lv,{options:ke,value:t,onChange:qe=>r(qe),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:()=>n(Math.max(.5,a-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(a*100),"%"]}),jsx(motion.button,{onClick:()=>n(Math.min(2,a+.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}}),v&&jsx(fm,{theme:e,value:h??"all",onChange:v,maxDepth:w}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(bm,{theme:e,value:m,onChange:f,hideCompleted:x,onHideCompletedChange:y})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[b&&jsxs(Fragment,{children:[b,jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),d&&p&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:u||ge.toolbar.createTask})]}),(ye||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(gm,{theme:e,onExportPNG:k,onExportPDF:D,onExportExcel:P,onExportMSProject:H,onCopySnapshotLink:Le}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsx(iv,{options:Ie,value:s,onChange:qe=>o(qe),theme:e})]})]})}function qi({columns:e,onToggleColumn:t,theme:r}){let[a,n]=useState(false),[s,o]=useState({x:0,y:0}),c=useRef(null),l=useRef(null);useEffect(()=>{if(!a)return;let d=u=>{c.current&&!c.current.contains(u.target)&&n(false);};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[a]);let i=e.filter(d=>d.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:l,onClick:()=>{if(!a&&l.current){let d=l.current.getBoundingClientRect();o({x:d.left,y:d.bottom+4});}n(!a);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`,color:r.textSecondary},whileHover:{backgroundColor:r.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:a&&jsx(lr,{children:jsx(motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(d=>jsxs("button",{onClick:()=>{t(d.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:r.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:d.label}),d.visible&&jsx(Check,{className:"w-4 h-4",style:{color:r.accent}})]},d.id))]})})})})]})}function as({isOpen:e,x:t,y:r,items:a,onClose:n,theme:s}){let o=useRef(null),[c,l]=useState({x:t,y:r});if(useEffect(()=>{if(!e)return;let d=200,u=a.length*36+8,p=8,m=window.innerWidth,f=window.innerHeight,x=t,y=r;t+d+p>m&&(x=t-d,x<p&&(x=p)),r+u+p>f&&(y=f-u-p,y<p&&(y=p)),l({x,y});},[e,t,r,a.length]),useEffect(()=>{if(!e)return;let d=p=>{o.current&&!o.current.contains(p.target)&&n();},u=p=>{p.key==="Escape"&&n();};return document.addEventListener("mousedown",d),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",u);}},[e,n]),!e)return null;let i=d=>d.startsWith("#")&&(d.length===7||d.length===4)?d:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:o,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:a.map(d=>jsxs("div",{children:[d.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{d.disabled||(d.onClick(),n());},disabled:d.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:d.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:d.disabled?"not-allowed":"pointer",opacity:d.disabled?.5:1},onMouseEnter:u=>{d.disabled||(u.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[d.icon&&jsx("span",{style:{color:s.textSecondary},children:d.icon}),jsx("span",{className:"flex-1",children:d.label}),d.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},d.id))})})})}var nr={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 Em({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:c,onTaskOutdent:l,onTaskRename:i,onTaskToggleExpand:d,onOpenTaskModal:u,enableKeyboard:p=true}){let m=useRef(false),f=useCallback(v=>{m.current=v;},[]),x=useCallback(v=>{let w=[],T=E=>{for(let F of E)w.push(F),F.subtasks&&F.subtasks.length>0&&F.isExpanded&&T(F.subtasks);};return T(v),w},[]),y=useCallback(()=>{let v=x(e);for(let w of v)if(t.has(w.id))return w;return null},[e,t,x]),b=useCallback((v,w)=>{let T=x(e);if(T.length===0)return;let E=y();if(!E){r(T[0].id,false);return}let F=T.findIndex(P=>P.id===E.id);if(F===-1)return;let k=v==="up"?F-1:F+1;if(k<0||k>=T.length)return;let D=T[k];r(D.id,w);},[e,y,x,r]),h=useCallback(v=>{if(!p)return;let w=v.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||m.current){v.key==="Escape"&&(w.blur(),m.current=false);return}let F=navigator.platform.toUpperCase().indexOf("MAC")>=0?v.metaKey:v.ctrlKey,k=Array.from(t),D=y();if(v.key==="ArrowUp"){v.preventDefault(),b("up",v.shiftKey);return}if(v.key==="ArrowDown"){v.preventDefault(),b("down",v.shiftKey);return}if(D&&(v.key==="ArrowRight"||v.key==="ArrowLeft")){D.subtasks&&D.subtasks.length>0&&(v.preventDefault(),(v.key==="ArrowRight"&&!D.isExpanded||v.key==="ArrowLeft"&&D.isExpanded)&&d(D.id));return}if(v.altKey&&(v.key==="ArrowUp"||v.key==="ArrowDown")){k.length>0&&(v.preventDefault(),o(k,v.key==="ArrowUp"?"up":"down"));return}if(v.key==="Tab"&&!v.shiftKey){k.length>0&&(v.preventDefault(),c(k));return}if(v.key==="Tab"&&v.shiftKey){k.length>0&&(v.preventDefault(),l(k));return}if(v.key==="Enter"&&!v.shiftKey&&!F){D&&(v.preventDefault(),a(D.id,"below"));return}if(v.key==="Enter"&&v.shiftKey&&!F){D&&(v.preventDefault(),a(D.id,"above"));return}if(v.key==="Enter"&&F){D&&(v.preventDefault(),u(D.id));return}if(v.key==="F2"){D&&(v.preventDefault(),i(D.id));return}if(v.key==="Delete"||v.key==="Backspace"&&F){k.length>0&&(v.preventDefault(),n(k));return}if(v.key==="d"&&F&&!v.shiftKey){k.length>0&&(v.preventDefault(),s(k));return}},[p,t,y,b,a,n,s,o,c,l,i,d,u]);return useEffect(()=>{if(p)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[p,h]),{setIsEditing:f}}function Pm(){let[e,t]=useState(new Set),[r,a]=useState(null),n=useCallback(u=>{t(new Set([u])),a(u);},[]),s=useCallback(u=>{t(p=>{let m=new Set(p);return m.has(u)?m.delete(u):m.add(u),m}),a(u);},[]),o=useCallback((u,p)=>{if(!r){n(u);return}let m=p.indexOf(r),f=p.indexOf(u);if(m===-1||f===-1){n(u);return}let x=Math.min(m,f),y=Math.max(m,f),b=p.slice(x,y+1);t(new Set(b)),a(u);},[r,n]),c=useCallback((u,p,m,f)=>{f?o(u,p):m?s(u):n(u);},[n,s,o]),l=useCallback((u,p)=>{p?t(m=>{let f=new Set(m);return f.add(u),f}):n(u);},[n]),i=useCallback(()=>{t(new Set),a(null);},[]),d=useCallback(u=>e.has(u),[e]);return {selectedTaskIds:e,selectTask:n,toggleTaskSelection:s,selectTaskRange:o,handleTaskClick:c,handleKeyboardSelection:l,clearSelection:i,isTaskSelected:d}}function Jc(e){return e.map((t,r)=>({...t,position:r,subtasks:t.subtasks?.length?Jc(t.subtasks):t.subtasks}))}function Do(e){let t=[],r=(a,n,s=0)=>{let o=[...a].sort((c,l)=>(c.position??0)-(l.position??0));for(let c=0;c<o.length;c++){let l={...o[c],parentId:n,level:s,position:o[c].position??c};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&r(l.subtasks,l.id,s+1);}};return r(e),t}function ns(e,t){for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=ns(r.subtasks,t);if(a)return a}}return null}function Xc(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=Xc(r.subtasks,t);if(a)return a}return null}function Qc(e,t){if(t.length===0)return e;let r=Do(e),a=t[0],n=r.findIndex(p=>p.id===a);if(n<=0)return e;let s=r[n-1],o=(p,m)=>{let f=[];return {tasks:p.filter(y=>{if(m.has(y.id))return f.push(y),false;if(y.subtasks){let b=o(y.subtasks,m);y.subtasks=b.tasks,f.push(...b.removed);}return true}),removed:f}},c=(p,m,f)=>p.map(x=>x.id===m?{...x,subtasks:[...x.subtasks||[],...f],isExpanded:true}:x.subtasks?{...x,subtasks:c(x.subtasks,m,f)}:x),l=new Set(t),{tasks:i,removed:d}=o(e,l),u=c(i,s.id,d);return Jc(u)}function Zc(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=Xc(r,a);if(!n)continue;let s=Xc(r,n.id),o=(i,d,u)=>{for(let p=0;p<i.length;p++){let m=i[p];if(m.id===d&&m.subtasks){let f=m.subtasks.findIndex(x=>x.id===u);if(f!==-1){let[x]=m.subtasks.splice(f,1);return x}}if(m.subtasks){let f=o(m.subtasks,d,u);if(f)return f}}return null},c=(i,d,u)=>{let p=i.findIndex(m=>m.id===d);if(p!==-1)return i.splice(p+1,0,u),i;for(let m of i)m.subtasks&&c(m.subtasks,d,u);return i},l=o(r,n.id,a);l&&(s&&s.subtasks?c(s.subtasks,n.id,l):c(r,n.id,l));}return Jc(r)}function ed(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],s=(o,c,l)=>{let i=o.findIndex(u=>u.id===c);if(i===-1){for(let u of o)if(u.subtasks&&s(u.subtasks,c,l))return true;return false}let d=l==="up"?i-1:i+1;return d<0||d>=o.length?false:([o[i],o[d]]=[o[d],o[i]],o[i]={...o[i],position:i},o[d]={...o[d],position:d},true)};return s(a,n,r),a}function td(e,t){let r=new Set(t),a=n=>n.filter(s=>!r.has(s.id)).map(s=>s.subtasks?{...s,subtasks:a(s.subtasks)}:s);return a(e)}function js(e,t){let r=[...e],a=[];for(let n of t){let s=(l,i)=>l.map((d,u)=>({...d,id:`${d.id}-copy-${Date.now()}-${u}`,parentId:i,subtasks:d.subtasks?s(d.subtasks,`${d.id}-copy-${Date.now()}-${u}`):void 0})),o=l=>{let i=l.findIndex(m=>m.id===n);if(i===-1){for(let m of l)if(m.subtasks){let f=o(m.subtasks);if(f)return f}return null}let d=l[i],u=`${d.id}-copy-${Date.now()}`,p={...d,id:u,name:`${d.name} (Copy)`,subtasks:d.subtasks?s(d.subtasks,u):void 0};return l.splice(i+1,0,p),p},c=o(r);c&&a.push(c);}return {tasks:r,duplicatedTasks:a}}function Fm(e,t,r){let a=[...e],n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:s,color:"#00E5CC"},c=l=>{let i=l.findIndex(u=>u.id===t);if(i===-1){for(let u of l)if(u.subtasks&&c(u.subtasks))return true;return false}let d=r==="above"?i:i+1;return l.splice(d,0,o),true};return c(a),{tasks:a,newTask:o}}function rd(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:rd(a.subtasks,t,r)}:a)}function ad(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:ad(r.subtasks,t)}:r)}function nd(e,t){let r=p=>{for(let m of p){if(m.id===t)return m;if(m.subtasks){let f=r(m.subtasks);if(f)return f}}return null},a=r(e),n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o=a?.startDate||n,c=a?.endDate||s,l=p=>{for(let m of p){if(m.id===t)return (m.subtasks||[]).length;if(m.subtasks){let f=l(m.subtasks);if(f>=0)return f}}return 0},i=l(e),d={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(c),color:a?.color||"#00E5CC",position:i,parentId:t},u=p=>p.map(m=>{if(m.id===t){let f=m.subtasks||[];return {...m,subtasks:[...f,d],isExpanded:true}}return m.subtasks?{...m,subtasks:u(m.subtasks)}:m});return {tasks:u(e),newTask:d}}function Lm(e,t,r,a){if(t===r)return e;let n=ns(e,t);if(!n)return e;if(r){let c=(l,i)=>{if(!l.subtasks)return false;for(let d of l.subtasks)if(d.id===i||c(d,i))return true;return false};if(c(n,r))return e}let s=c=>{let l=c.filter(d=>d.id!==t),i=l.length<c.length;return l.map((d,u)=>{let p=i?{...d,position:u}:d;return p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p})},o=s(e);if(r===null){let c=a!==void 0?a:o.length;o.splice(c,0,{...n,parentId:void 0}),o=o.map((l,i)=>({...l,position:i}));}else {let c=l=>l.map(i=>{if(i.id===r){let d=i.subtasks||[],u=a!==void 0?a:d.length,p=[...d];p.splice(u,0,{...n,parentId:r});let m=p.map((f,x)=>({...f,position:x}));return {...i,subtasks:m,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:c(i.subtasks)}:i});o=c(o);}return o}function Ka(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let r=Ka(t.subtasks),a=r.reduce((c,l)=>(l.startDate&&c.starts.push(new Date(l.startDate).getTime()),l.endDate&&c.ends.push(new Date(l.endDate).getTime()),c.progresses.push(l.progress??0),c),{starts:[],ends:[],progresses:[]}),n=a.starts.length>0?new Date(Math.min(...a.starts)):t.startDate,s=a.ends.length>0?new Date(Math.max(...a.ends)):t.endDate,o=a.progresses.length>0?Math.round(a.progresses.reduce((c,l)=>c+l,0)/a.progresses.length):t.progress;return {...t,subtasks:r,startDate:n,endDate:s,progress:o}})}function Xi({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:s,onTaskDblClick:o,onTaskContextMenu:c,onTaskToggle:l,scrollTop:i,columns:d,onToggleColumn:u,onColumnResize:p,onTaskUpdate:m,onBulkFill:f,onTaskIndent:x,onTaskOutdent:y,onTaskMove:b,onMultiTaskDelete:h,onTaskDuplicate:v,onTaskCreate:w,onTaskRename:T,onCreateSubtask:E,onOpenTaskModal:F,onDeleteRequest:k,onTaskReparent:D,allTasks:P,scrollContainerRef:N,showCriticalPath:K=false}){let H=useContext(es),[te,I]=useState(null),[_,j]=useState(null),[W,B]=useState(""),ve=useRef(null),[We,Le]=useState(null),[be,ge]=useState(0),[ye,ze]=useState(0),[ke,Ie]=useState({isOpen:false,x:0,y:0,type:"header"}),[De,qe]=useState(null),[fe,tt]=useState(null),[Be,$e]=useState(null),gt=useRef(0),Ft=5,He=useRef(false),[Ae,ot]=useState(null),[Lt,Fe]=useState(false),Xe=useRef(null),[L,ae]=useState(null),[R,q]=useState(null),[U,X]=useState(false),Se=useRef(null);useEffect(()=>{function ne(pe){Se.current&&!Se.current.contains(pe.target)&&X(false);}if(U)return document.addEventListener("mousedown",ne),()=>document.removeEventListener("mousedown",ne)},[U]),useEffect(()=>{_&&ve.current&&(ve.current.focus(),ve.current.select());},[_]),useEffect(()=>{if(!We)return;let ne=pt=>{let je=pt.clientX-be,it=ye+je;p?.(We,it);},pe=()=>{Le(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",ne),document.addEventListener("mouseup",pe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ne),document.removeEventListener("mouseup",pe),document.body.style.cursor="",document.body.style.userSelect="";}},[We,be,ye,p]);let{selectedTaskIds:de,handleTaskClick:et,isTaskSelected:rt}=Pm(),{setIsEditing:Qe}=Em({tasks:e,selectedTaskIds:de,onTaskSelect:(ne,pe)=>{let je=Do(e).map(it=>it.id);et(ne,je,pe||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:h||(()=>{}),onTaskDuplicate:v||(()=>{}),onTaskMove:b||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:ne=>{let pe=Do(e).find(pt=>pt.id===ne);pe&&gr(pe);},onTaskToggleExpand:l||(()=>{}),onOpenTaskModal:ne=>{let pe=Do(e).find(pt=>pt.id===ne);pe&&F&&F(pe);},enableKeyboard:true}),At=(ne,pe=0,pt="")=>{let je=[],it=[...ne].sort((V,le)=>(V.position??0)-(le.position??0));for(let V=0;V<it.length;V++){let le=it[V],J=V+1,O=pt?`${pt}.${J}`:`${J}.0`,Z=le.wbsCode||O;if(le.wbsCode=Z,je.push({task:le,level:pe}),le.subtasks&&le.subtasks.length>0&&le.isExpanded){let C=le.wbsCode?.replace(/\.0$/,"")||(pt?`${pt}.${J}`:`${J}`);je.push(...At(le.subtasks,pe+1,C));}}return je},kt=At(e),jt=48,Gt=Math.max(kt.length*r,600-jt),or=(ne,pe)=>pe==="assignees"?ne.assignees:pe==="startDate"?ne.startDate:ne.endDate,br=(ne,pe,pt,je)=>{ne.preventDefault(),ne.stopPropagation(),ae({sourceTaskId:pe,column:pt,sourceIndex:je,targetIndex:je}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let it=ne.currentTarget.closest("[data-grid-body]"),V=ce=>{let xe=it?.getBoundingClientRect().top??0,ee=Math.floor((ce-xe)/r);return ee=Math.max(0,Math.min(kt.length-1,ee)),ee<je&&(ee=je),ee},le=ne.clientY,J=N?.current??null,O=()=>{Xe.current&&(cancelAnimationFrame(Xe.current),Xe.current=null);},Z=()=>{let ce=V(le);ae(xe=>xe&&{...xe,targetIndex:ce});},Te=()=>{if(O(),!J)return;let ce=J.getBoundingClientRect(),xe=60,ee=12,Je=le-ce.top,_e=ce.bottom-le;if(_e<xe&&J.scrollTop<J.scrollHeight-J.clientHeight){let Rt=Math.max(1,Math.round(ee*(1-Math.max(0,_e)/xe))),Et=()=>{J.scrollTop+=Rt,Z(),J.scrollTop<J.scrollHeight-J.clientHeight&&(Xe.current=requestAnimationFrame(Et));};Xe.current=requestAnimationFrame(Et);}else if(Je<xe&&J.scrollTop>0){let Rt=Math.max(1,Math.round(ee*(1-Math.max(0,Je)/xe))),Et=()=>{J.scrollTop-=Rt,Z(),J.scrollTop>0&&(Xe.current=requestAnimationFrame(Et));};Xe.current=requestAnimationFrame(Et);}},C=ce=>{le=ce.clientY,Z(),Te();},$=ce=>{window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",$),O(),document.body.style.cursor="",document.body.style.userSelect="",ae(null);let xe=V(ce.clientY),ee=kt.find(Nt=>Nt.task.id===pe)?.task;if(!ee)return;let Je=or(ee,pt),_e=Math.min(je,xe),Rt=Math.max(je,xe),Et=[];for(let Nt=_e;Nt<=Rt;Nt++){if(Nt===je)continue;let Cr=kt[Nt]?.task;!Cr||Cr.subtasks&&Cr.subtasks.length>0||Et.push(Cr.id);}Et.length!==0&&f?.(Et,pt,Je);};window.addEventListener("mousemove",C),window.addEventListener("mouseup",$);},da=ne=>{if(!L)return false;let pe=Math.min(L.sourceIndex,L.targetIndex),pt=Math.max(L.sourceIndex,L.targetIndex);return ne>=pe&&ne<=pt},qt=ne=>!ne.startDate||!ne.endDate?"-":`${Math.ceil((ne.endDate.getTime()-ne.startDate.getTime())/(1e3*60*60*24))}d`,gr=ne=>{j(ne.id),B(ne.name),Qe(true);},St=ne=>{W.trim()&&W!==e.find(pe=>pe.id===ne)?.name&&T?.(ne,W.trim()),j(null),B(""),Qe(false);},Lr=()=>{j(null),B(""),Qe(false);},Yt=(ne,pe)=>{pe.stopPropagation(),E?.(ne.id);},tr=(ne,pe)=>{pe.preventDefault(),gt.current=pe.clientY,qe(ne),He.current=false,Fe(false),ot({x:pe.clientX,y:pe.clientY});},kr=ne=>{if(!De||(Math.abs(ne.clientY-gt.current)>Ft&&!He.current&&(He.current=true,Fe(true)),ot({x:ne.clientX,y:ne.clientY}),!He.current))return;if(N?.current){let V=N.current,le=V.getBoundingClientRect(),J=60,O=12;Xe.current&&(cancelAnimationFrame(Xe.current),Xe.current=null);let Z=ne.clientY-le.top,Te=le.bottom-ne.clientY;if(Z<J&&V.scrollTop>0){let C=Math.round(O*(1-Z/J)),$=()=>{V.scrollTop-=C,He.current&&V.scrollTop>0&&(Xe.current=requestAnimationFrame($));};Xe.current=requestAnimationFrame($);}else if(Te<J&&V.scrollTop<V.scrollHeight-V.clientHeight){let C=Math.round(O*(1-Te/J)),$=()=>{V.scrollTop+=C,He.current&&V.scrollTop<V.scrollHeight-V.clientHeight&&(Xe.current=requestAnimationFrame($));};Xe.current=requestAnimationFrame($);}}let pt=document.querySelectorAll("[data-task-row]"),je=null,it=null;pt.forEach(V=>{let le=V.getBoundingClientRect(),J=V.getAttribute("data-task-row");if(J&&J!==De&&ne.clientY>=le.top&&ne.clientY<=le.bottom){je=J;let O=ne.clientY-le.top,Z=le.height;O<Z*.25?it="above":O>Z*.75?it="below":it="child";}}),tt(je),$e(it);},oa=()=>{if(He.current&&De&&fe&&Be){if(Be==="child")D?.(De,fe);else if(Be==="above"||Be==="below"){let ne=(V,le,J=null)=>{for(let O of V){if(O.id===le)return J;if(O.subtasks){let Z=ne(O.subtasks,le,O.id);if(Z!==void 0)return Z}}},pe=P&&P.length>0?P:e,pt=ne(pe,De,null),je=ne(pe,fe,null),it=(V,le,J,O)=>{let Z=V.findIndex($=>$.id===le),Te=O?V.findIndex($=>$.id===J):-1,C=Be==="below"?Z+1:Z;return O&&Te!==-1&&Te<Z&&(C-=1),Math.max(0,C)};if(je===null){let le=it(pe,fe,De,pt===null);D?.(De,null,le);}else {let V=ns(pe,je);if(V?.subtasks){let le=pt===je,J=it(V.subtasks,fe,De,le);D?.(De,je,J);}}}}Xe.current&&(cancelAnimationFrame(Xe.current),Xe.current=null),qe(null),tt(null),$e(null),ot(null),He.current=false,Fe(false);};useEffect(()=>{if(De)return document.addEventListener("mousemove",kr),document.addEventListener("mouseup",oa),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",kr),document.removeEventListener("mouseup",oa),document.body.style.cursor="",document.body.style.userSelect="";}},[De,fe,Be]);let Ze=(ne,pe,pt)=>{let je=pe.subtasks&&pe.subtasks.length>0;switch(ne.id){case "name":let it=_===pe.id,V=te===pe.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${pt*20}px`},children:[D&&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:V?1:.3},onMouseDown:ee=>tr(pe.id,ee),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),pe.subtasks&&pe.subtasks.length>0?jsx("button",{onClick:ee=>{ee.stopPropagation(),l?.(pe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:pe.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"}),it?jsx("input",{ref:ve,type:"text",value:W,onChange:ee=>B(ee.target.value),onKeyDown:ee=>{ee.key==="Enter"?St(pe.id):ee.key==="Escape"&&Lr();},onBlur:()=>St(pe.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:ee=>ee.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:pe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:pe.parentId?"13px":"14px",fontWeight:pe.isMilestone?600:pe.parentId?400:600,letterSpacing:pe.parentId?"0":"-0.01em"},title:pe.name,children:[pe.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:pe.wbsCode}),pe.isHighlighted&&pe.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:pe.name}),pe.subtasks&&pe.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(pe.progress||0),"%"]}),K&&pe.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),K&&pe.cpmData&&jsxs("span",{style:{color:pe.cpmData.totalFloat<=0?"#EF4444":pe.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(pe.cpmData.totalFloat),"d"]})]}),V&&!it&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ee=>ee.stopPropagation(),children:[jsx("button",{onClick:ee=>Yt(pe,ee),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:ee=>{ee.stopPropagation(),gr(pe);},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 J=ne.id==="startDate"?"startDate":"endDate",O=pe[J],Z=R?.taskId===pe.id&&R?.field===J,Te=ee=>ee?(typeof ee=="string"?new Date(ee):ee).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:ee=>ee.stopPropagation(),children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:je?.5:1,cursor:je?"default":"pointer"},title:je?"Auto-calculated from subtasks":void 0,onClick:ee=>{if(!je)if(Z)q(null);else {let Je=ee.currentTarget.getBoundingClientRect();q({taskId:pe.id,field:J,month:O?typeof O=="string"?new Date(O):O:new Date,position:{top:Je.bottom+4,left:Je.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:Te(O)}),je&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),Z&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>q(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:R?.position.top,left:R?.position.left},onClick:ee=>ee.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ee=new Date,Je=new Date(ee);Je.setDate(ee.getDate()+1);let _e=new Date(ee);_e.setDate(ee.getDate()+7);let Rt=new Date(ee);return Rt.setDate(ee.getDate()+14),[{label:"Hoy",date:ee},{label:"Ma\xF1ana",date:Je},{label:"Pr\xF3xima semana",date:_e},{label:"2 semanas",date:Rt}].map((Nt,Cr)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Aa=>Aa.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Aa=>Aa.currentTarget.style.backgroundColor="transparent",onClick:()=>{m?.(pe.id,{[J]:Nt.date}),q(null);},children:Nt.label},Cr))})(),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:ee=>ee.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ee=>ee.currentTarget.style.backgroundColor="transparent",onClick:()=>{m?.(pe.id,{[J]:void 0}),q(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:()=>q(ee=>ee?{...ee,month:new Date(ee.month.getFullYear(),ee.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:R?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>q(ee=>ee?{...ee,month:new Date(ee.month.getFullYear(),ee.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((ee,Je)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ee},Je))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ee=R?.month||new Date,Je=ee.getFullYear(),_e=ee.getMonth(),Rt=new Date(Je,_e,1).getDay(),Et=new Date(Je,_e+1,0).getDate(),Nt=new Date,Cr=[];for(let Ut=Rt-1;Ut>=0;Ut--)Cr.push({day:new Date(Je,_e,-Ut).getDate(),date:new Date(Je,_e-1,new Date(Je,_e,-Ut).getDate()),isCurrentMonth:false});for(let Ut=1;Ut<=Et;Ut++)Cr.push({day:Ut,date:new Date(Je,_e,Ut),isCurrentMonth:true});let Aa=42-Cr.length;for(let Ut=1;Ut<=Aa;Ut++)Cr.push({day:Ut,date:new Date(Je,_e+1,Ut),isCurrentMonth:false});return Cr.map((Ut,$o)=>{let bn=Ut.date.toDateString()===Nt.toDateString(),hn=(O?typeof O=="string"?new Date(O):O:null)?.toDateString()===Ut.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:Ut.isCurrentMonth?hn?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:hn?"#00E5CC":"transparent",boxShadow:bn&&!hn?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{m?.(pe.id,{[J]:Ut.date}),q(null);},children:Ut.day},$o)})})()})]})]})]}),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:qt(pe)})});case "assignees":if(je)return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let C=a.filter(ee=>pe.assignees?.some(Je=>Je.id?Je.id===ee.id:Je.name===ee.name||Je.initials===ee.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:ee=>ee.stopPropagation(),children:jsx(xo,{assignedUsers:C,availableUsers:a,onChange:ee=>{let Je=ee.map(_e=>({id:_e.id,name:_e.name,initials:_e.initials,color:_e.color}));m?.(pe.id,{assignees:Je});}})});case "status":if(je){let ee=pe.progress===100?"\u2713":pe.progress>0?"\u25D0":"\u25CB";return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:ee})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:ee=>ee.stopPropagation(),children:jsx(tp,{status:pe.status||"todo",onChange:ee=>{m?.(pe.id,{status:ee,progress:ee==="completed"?100:pe.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:je?.6:1},children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${pe.progress}%`,backgroundColor:pe.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:[pe.progress,"%"]})]});case "priority":let $={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},ce={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},xe=$[pe.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:ee=>ee.stopPropagation(),children:jsx(ho,{priority:xe,onChange:ee=>{ee&&m?.(pe.id,{priority:ce[ee]||"medium"});}})});default:return null}},Ye=ne=>[{id:"hide",label:"Hide Column",icon:nr.Hide,onClick:()=>u(ne),disabled:ne==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:nr.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:nr.SortDesc,onClick:()=>{}}],ua=ne=>{let pe=ne.subtasks&&ne.subtasks.length>0,pt=Do(e),je=de.size>1&&de.has(ne.id),it=je?pt.filter(Z=>de.has(Z.id)):[ne],V=it.map(Z=>Z.id),le=it.filter(Z=>!(Z.subtasks&&Z.subtasks.length>0)),J=je?` (${V.length})`:"",O=()=>{k?k(V,ne.name):h?.(V);};return pe?[{id:"addSubtask",label:H?.contextMenu?.addSubtask||"Add Subtask",icon:nr.Add,onClick:()=>{E?.(ne.id);}},{id:"duplicate",label:(H?.contextMenu?.duplicateTask||"Duplicate Task")+J,icon:nr.Duplicate,onClick:()=>{v?.(V);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(H?.contextMenu?.deleteTask||"Delete Task")+J,icon:nr.Delete,onClick:O}]:[{id:"edit",label:H?.contextMenu?.editTask||"Edit Task",icon:nr.Pencil,onClick:()=>{o?.(ne);}},{id:"addSubtask",label:H?.contextMenu?.addSubtask||"Add Subtask",icon:nr.Add,onClick:()=>{E?.(ne.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(H?.contextMenu?.markIncomplete||"Mark Incomplete")+J,icon:nr.MarkIncomplete,onClick:()=>{le.forEach(Z=>m?.(Z.id,{status:"todo",progress:0}));},disabled:le.length===0||le.every(Z=>Z.status==="todo")},{id:"setInProgress",label:(H?.contextMenu?.setInProgress||"Set In Progress")+J,icon:nr.SetInProgress,onClick:()=>{le.forEach(Z=>m?.(Z.id,{status:"in-progress"}));},disabled:le.length===0||le.every(Z=>Z.status==="in-progress")},{id:"markComplete",label:(H?.contextMenu?.markComplete||"Mark Complete")+J,icon:nr.MarkComplete,onClick:()=>{le.forEach(Z=>m?.(Z.id,{status:"completed",progress:100}));},disabled:le.length===0||le.every(Z=>Z.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(H?.contextMenu?.duplicateTask||"Duplicate Task")+J,icon:nr.Duplicate,onClick:()=>{v?.(V);}},{id:"split",label:H?.contextMenu?.splitTask||"Split Task",icon:nr.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(H?.contextMenu?.deleteTask||"Delete Task")+J,icon:nr.Delete,onClick:O}]},Xt=d.filter(ne=>ne.visible),Zr=Xt.reduce((ne,pe)=>ne+pe.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Zr},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${jt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:Xt.map((ne,pe)=>{let pt=pe===Xt.length-1,je=ne.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${je?"":"justify-center"}`,style:{width:`${ne.width}px`,minWidth:`${ne.minWidth??(je?200:60)}px`,maxWidth:`${ne.maxWidth??2e3}px`,flexShrink:je&&Xt.length===1?1:0,flexGrow:je&&Xt.length===1?1:0,borderRight:pt?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:it=>{it.preventDefault(),Ie({isOpen:true,x:it.clientX,y:it.clientY,type:"header",columnId:ne.id});},onMouseEnter:it=>{it.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:it=>{it.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:ne.label,children:ne.label}),ne.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:We===ne.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:it=>{it.preventDefault(),it.stopPropagation(),Le(ne.id),ge(it.clientX),ze(ne.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:We===ne.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},ne.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsx(qi,{columns:d,onToggleColumn:u,theme:t}),jsx("button",{onClick:()=>X(!U),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"})}),U&&jsxs("div",{ref:Se,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:ne=>ne.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsx("button",{onClick:()=>X(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content","data-grid-body":true,style:{minHeight:Gt},children:kt.map(({task:ne,level:pe},pt)=>{let je=rt(ne.id),it=da(pt),V=fe===ne.id,le=V&&Be==="above",J=V&&Be==="below",O=V&&Be==="child",Z={};return O&&(Z.backgroundColor=`${t.accent}15`,Z.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":ne.id,className:`flex items-center cursor-pointer group ${De===ne.id?"opacity-50":""}`,style:{position:"relative",height:`${r}px`,borderLeft:je?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:je?t.accentLight:O?`${t.accent}15`:pt%2===0?t.bgPrimary:t.bgGrid,opacity:K?ne.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...Z},onMouseEnter:()=>I(ne.id),onMouseLeave:()=>I(null),onClick:Te=>{let $=Do(e).map(ee=>ee.id),xe=navigator.platform.toUpperCase().indexOf("MAC")>=0?Te.metaKey:Te.ctrlKey;et(ne.id,$,xe,Te.shiftKey),!xe&&!Te.shiftKey&&s?.(ne);},onDoubleClick:Te=>{Te.stopPropagation(),o?.(ne);},onContextMenu:Te=>{Te.preventDefault(),Ie({isOpen:true,x:Te.clientX,y:Te.clientY,type:"task",task:ne}),c?.(ne,Te);},whileHover:{backgroundColor:je?t.accentLight:t.hoverBg},children:[le&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),J&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Xt.map((Te,C)=>{let $=C===Xt.length-1,ce=Te.id==="name",xe=!!(ne.subtasks&&ne.subtasks.length>0),ee=Te.id==="assignees"||Te.id==="startDate"||Te.id==="endDate"?Te.id:null,_e=!!ee&&!xe&&te===ne.id&&!L,Rt=it&&!!L&&L.column===Te.id;return jsxs("div",{className:`px-4 flex items-center ${ce?"justify-start":"justify-center"}`,style:{position:"relative",width:`${Te.width}px`,minWidth:`${Te.minWidth??(ce?200:60)}px`,maxWidth:`${Te.maxWidth??2e3}px`,flexShrink:ce&&Xt.length===1?1:0,flexGrow:ce&&Xt.length===1?1:0,borderRight:$?"none":`1px solid ${te===ne.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:Rt?`${t.accent}22`:void 0,boxShadow:Rt?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[Ze(Te,ne,ce?pe:0),_e&&ee&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Et=>br(Et,ne.id,ee,pt),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:t.accent,border:`1px solid ${t.bgPrimary}`,cursor:"crosshair",zIndex:5}})]},`${ne.id}-${Te.id}`)})]},ne.id)})}),jsx(as,{isOpen:ke.isOpen,x:ke.x,y:ke.y,items:ke.type==="header"&&ke.columnId?Ye(ke.columnId):ke.type==="task"&&ke.task?ua(ke.task):[],onClose:()=>Ie({...ke,isOpen:false}),theme:t}),Lt&&Ae&&De&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Ae.x+12,top:Ae.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let ne=kt.find(pe=>pe.task.id===De)?.task;return ne?jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:ne.name})}):null})()}),document.body)]})}function $m(e,t){let[r,a]=useState("none"),[n,s]=useState(0),[o,c]=useState(e),[l,i]=useState(t),[d,u]=useState(null),[p,m]=useState(null),[f,x]=useState(null),[y,b]=useState(null),[h,v]=useState(0),[w,T]=useState(0),[E,F]=useState(null),[k,D]=useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:c,ghostWidth:l,setGhostWidth:i,connectionLine:d,setConnectionLine:u,hoveredTaskId:p,setHoveredTaskId:m,activeZone:f,setActiveZone:x,draggedSegmentIndex:y,setDraggedSegmentIndex:b,draggedSegmentStartX:h,setDraggedSegmentStartX:v,segmentDragOffsetX:w,setSegmentDragOffsetX:T,hoveredSegmentIndex:E,setHoveredSegmentIndex:F,isHovered:k,setIsHovered:D,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(te,I)=>{a("none"),u(null),m(null),c(te),i(I),T(0),b(null),v(0);}}}function Ji({task:e,x:t,y:r,width:a,theme:n,dayWidth:s,startDate:o,templates:c,onClick:l,onDoubleClick:i,onContextMenu:d,onDateChange:u,onDependencyCreate:p,allTaskPositions:m=[],onDragMove:f,onHoverChange:x,showBaseline:y,showTaskBarLabels:b=true,showCriticalPath:h=true,readOnly:v=false,onProgressChange:w}){let T=$m(t,a),E=useRef(null),F=useRef(false),k=useRef(null),D=useRef(null),{dragMode:P,setDragMode:N,dragOffset:K,setDragOffset:H,ghostX:te,setGhostX:I,ghostWidth:_,setGhostWidth:j,connectionLine:W,setConnectionLine:B,hoveredTaskId:ve,setHoveredTaskId:We,activeZone:Le,setActiveZone:be,draggedSegmentIndex:ge,setDraggedSegmentIndex:ye,draggedSegmentStartX:ze,setDraggedSegmentStartX:ke,segmentDragOffsetX:Ie,setSegmentDragOffsetX:De,hoveredSegmentIndex:qe,setHoveredSegmentIndex:fe,isHovered:tt,setIsHovered:Be,isDragging:$e,isResizing:gt,isConnecting:Ft,resetDragState:He}=T,Ae=18,ot=!!n.executionBarBg,Lt=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",Fe=ot?3:6,Xe=e.subtasks&&e.subtasks.length>0,L=useRef(null),[ae,R]=(()=>{let V=useRef(null),[,le]=useState(0);return [V.current,J=>{V.current=J,le(O=>O+1);}]})(),q=!!w&&!v&&!Xe&&!e.segments&&!!e.startDate&&!!e.endDate,U=e.endDate&&(()=>{let V=new Date;V.setHours(0,0,0,0);let le=new Date(e.endDate);return le.setHours(0,0,0,0),le<V})()&&e.progress<100,X=h&&e.isCriticalPath,Se=n.name==="neutral"||n.today==="#1C1917",de=e.status==="completed"||e.progress===100,et={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Qe=h&&e.isCriticalPath||U?"#EF4444":e.color?e.color:e.priority&&et[e.priority]?et[e.priority]:n.taskBarPrimary,At=v?"default":$e?Ft?"crosshair":gt?"ew-resize":"grabbing":"grab",kt=v?"default":"ew-resize",Gt=(V=>V>=80?20:V>=60?15:V>=50?12:10)(a),or=a<50,br=a<40;useEffect(()=>{x&&(!tt||$e||e.segments)&&x(null);},[tt,$e,e.segments,x]);let da=V=>V.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),qt=()=>{let V=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${V} day${V!==1?"s":""}`},gr=V=>Math.round(V/s)*s,St=V=>{let le=Math.round(V/s),J=new Date(o);return J.setDate(J.getDate()+le),J},Lr=(V,le)=>{for(let J of m){if(J.id===e.id)continue;let O=5;if(V>=J.x-O&&V<=J.x+J.width+O&&le>=J.y-O&&le<=J.y+J.height+O)return J.id}return null},Yt=useCallback((V,le,J)=>{if(v)return;V.preventDefault(),V.stopPropagation();let O=E.current?.ownerSVGElement;if(!O)return;let Z=O.createSVGPoint();Z.x=V.clientX,Z.y=V.clientY;let Te=Z.matrixTransform(O.getScreenCTM()?.inverse()),C=J!==void 0?J:t,$=le;if(!$){let ce=Te.x-C;V.shiftKey?($="connect",B({x:t+a,y:r+Ae/2})):V.ctrlKey||V.metaKey?$="move":V.altKey?$=ce<a/2?"resize-start":"resize-end":br?ce<a/2?$="move":$="resize-end":or?ce<=Gt/2?$="resize-start":ce>=a-Gt/2?$="resize-end":$="move":ce<=Gt?$="resize-start":ce>=a-Gt?$="resize-end":$="move";}F.current=false,N($),Be(false),be(null),$==="move"?H(Te.x-C):$==="connect"?B({x:t+a,y:r+Ae/2}):H(0),I(C),j(a);},[t,a,r,Ae,v]),tr=useCallback(V=>{let le=E.current?.ownerSVGElement;if(!le)return;let J=le.closest(".gantt-timeline-scroll");if(!J)return;let O=J.getBoundingClientRect(),Z=60,Te=15,C=0;if(V.clientX<O.left+Z){let $=O.left+Z-V.clientX;C=-Math.min(Te,$/2);}else if(V.clientX>O.right-Z){let $=V.clientX-(O.right-Z);C=Math.min(Te,$/2);}return C!==0&&(J.scrollLeft+=C),C!==0},[]),kr=useCallback(V=>{if(P==="none")return;F.current=true,D.current=V;let le=E.current?.ownerSVGElement;if(!le)return;if(P==="move"||P==="resize-start"||P==="resize-end"){let Z=tr(V);Z&&!k.current?k.current=window.setInterval(()=>{D.current&&(tr(D.current),kr(D.current));},16):!Z&&k.current&&(window.clearInterval(k.current),k.current=null);}let J=le.createSVGPoint();J.x=V.clientX,J.y=V.clientY;let O=J.matrixTransform(le.getScreenCTM()?.inverse());if(P==="connect"){B({x:O.x,y:O.y});let Z=Lr(O.x,O.y);We(Z);}else if(P==="move"){let Z=O.x-K,Te=gr(Z);I(Te),j(a);let C=Math.round((Te-t)/s);if(f?.(e.id,C,true),e.segments&&e.segments.length>0&&ge!==null){let $=Te-ze;De($);}}else if(P==="resize-start"){let Z=O.x,Te=gr(Z),C=t+a-Te;C>=s&&(I(Te),j(C));}else if(P==="resize-end"){let Z=O.x,C=gr(Z)-t;C>=s&&j(C);}},[P,t,a,s,K,e,gr,ge,ze,Lr,We,B,I,j,De,f,tr]),oa=useCallback(()=>{if(k.current&&(window.clearInterval(k.current),k.current=null),D.current=null,P!=="none"){if(P==="connect")ve&&p&&p(e,ve),B(null),We(null);else {let V=e.endDate.getTime()-e.startDate.getTime(),le,J,O=true;if(P==="move"){if(le=St(te),J=new Date(le.getTime()+V),e.segments&&e.segments.length>0&&ge!==null){let Z=Math.round(Ie/s),Te=e.segments.map((xe,ee)=>{if(ee===ge){let Je=new Date(xe.startDate),_e=new Date(xe.endDate);return Je.setDate(Je.getDate()+Z),_e.setDate(_e.getDate()+Z),{startDate:Je,endDate:_e}}return xe}),C=Te.flatMap(xe=>[xe.startDate,xe.endDate]),$=new Date(Math.min(...C.map(xe=>xe.getTime()))),ce=new Date(Math.max(...C.map(xe=>xe.getTime())));u?.({...e,segments:Te},$,ce),He(t,a);return}}else P==="resize-start"?(le=St(te),J=e.endDate,le>J&&(console.warn("Invalid date range: start date must be before or equal to end date"),O=false)):P==="resize-end"?(le=e.startDate,J=St(te+_),J.setDate(J.getDate()-1),J<le&&(console.warn("Invalid date range: end date must be after or equal to start date"),O=false)):O=false;O&&le&&J&&(J.getTime()<le.getTime()?console.warn("Invalid date range: end date cannot be before start date"):u?.(e,le,J));}f?.(e.id,0,false),He(t,a);}},[P,te,_,e,u,ve,p,t,a,s,St,Ie,ge,He,f]);useEffect(()=>{if(P==="none")return;let V=J=>{kr(J);},le=()=>{oa();};return window.addEventListener("mousemove",V),window.addEventListener("mouseup",le),()=>{window.removeEventListener("mousemove",V),window.removeEventListener("mouseup",le),k.current&&(window.clearInterval(k.current),k.current=null);}},[P,kr,oa]);let Ze=$e&&!Ft?te:t,Ye=$e&&!Ft?_:a,ua=c.taskClass(e),Xt=24,Zr=h?e.isCriticalPath?1:.25:1,ne=useCallback(V=>{if(!q)return;V.stopPropagation(),V.preventDefault();let J=E.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;L.current={barRect:J,initialPct:e.progress||0},V.currentTarget.setPointerCapture(V.pointerId),R(e.progress||0);},[q,e.progress,R]),pe=useCallback(V=>{let le=L.current;if(!le)return;let O=E.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??le.barRect;if(!O||O.width<=0)return;let Z=(V.clientX-O.left)/O.width,Te=Math.round(Math.max(0,Math.min(1,Z))*100);V.shiftKey&&(Te=Math.round(Te/25)*25),R(Te);},[R]),pt=useCallback(V=>{let le=L.current;if(!le)return;V.stopPropagation(),V.preventDefault();try{V.currentTarget.releasePointerCapture(V.pointerId);}catch{}let J=ae;L.current=null,R(null),J!=null&&J!==le.initialPct&&w&&w(e,J);},[ae,w,e,R]),je=useCallback(V=>{V.stopPropagation(),V.preventDefault();},[]),it=ae??(e.progress||0);return jsxs("g",{ref:E,"data-task-bar":"true",style:{opacity:Zr,transition:"opacity 300ms ease"},onClick:()=>{!$e&&!F.current&&l?.(e),F.current=false;},onDoubleClick:V=>{!$e&&!F.current&&(V.stopPropagation(),i?.(e));},onContextMenu:V=>{V.preventDefault(),d?.(e,V);},onMouseEnter:()=>!$e&&Be(true),onMouseMove:V=>{x&&tt&&!$e&&!e.segments&&x({task:e,x:t,y:r,width:a,height:Ae,showBelow:false,mouseX:V.clientX,mouseY:V.clientY});},onMouseLeave:()=>{$e||(Be(false),be(null));},children:[jsx("rect",{x:t,y:r,width:a+Xt,height:Ae,fill:"transparent",style:{pointerEvents:"all"}}),tt&&!$e&&!or&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:r,width:Gt,height:Ae,fill:Le==="resize-start"?n.accent:"transparent",opacity:Le==="resize-start"?.15:0,style:{cursor:kt,pointerEvents:"all"},onMouseEnter:()=>be("resize-start"),onMouseDown:V=>Yt(V,"resize-start")}),jsx("rect",{x:t+Gt,y:r,width:a-Gt*2,height:Ae,fill:Le==="move"?n.accent:"transparent",opacity:Le==="move"?.1:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>be("move"),onMouseDown:V=>Yt(V,"move")}),jsx("rect",{x:t+a-Gt,y:r,width:Gt,height:Ae,fill:Le==="resize-end"?n.accent:"transparent",opacity:Le==="resize-end"?.15:0,style:{cursor:kt,pointerEvents:"all"},onMouseEnter:()=>be("resize-end"),onMouseDown:V=>Yt(V,"resize-end")})]}),tt&&!$e&&br&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:r,width:a/2,height:Ae,fill:Le==="move"?n.accent:"transparent",opacity:Le==="move"?.2:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>be("move"),onMouseDown:V=>Yt(V,"move")}),jsx("rect",{x:t+a/2,y:r,width:a/2,height:Ae,fill:Le==="resize-end"?n.accent:"transparent",opacity:Le==="resize-end"?.2:0,style:{cursor:kt,pointerEvents:"all"},onMouseEnter:()=>be("resize-end"),onMouseDown:V=>Yt(V,"resize-end")}),tt&&jsx(motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+Ae-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),$e&&!Ft&&!e.segments&&jsx(motion.rect,{x:te,y:r,width:_,height:Ae,rx:Fe,fill:n.accent,opacity:.15,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),y&&e.baselineStartDate&&e.baselineEndDate&&!$e&&(()=>{let V=e.baselineStartDate.getTime(),le=e.baselineEndDate.getTime(),J=o.getTime(),O=864e5,Z=(V-J)/O,Te=(le-V)/O,C=Z*s,$=Math.max(Te*s,s),ce=Ze+Ye,xe=C+$,ee=e.endDate?.getTime()??0,Je=Math.ceil((ee-le)/O),_e=Je>0,Rt=Je<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:C,y:r,width:$,height:Ae,rx:Fe,fill:"none",stroke:Lt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),_e&&ce>xe&&jsx("rect",{x:xe,y:r,width:ce-xe,height:Ae,rx:0,fill:"#EF4444",opacity:.2}),_e&&jsxs("text",{x:Math.max(ce,xe)+6,y:r+Ae/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Je,"d"]}),Rt&&jsxs("text",{x:ce+6,y:r+Ae/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Je,"d"]})]})})(),!e.segments&&ot&&Xe&&(()=>{let le=r+(Ae-8)/2,J=4,O=e.progress||0,Z=new Date;Z.setHours(0,0,0,0);let Te=e.startDate&&Z>=e.startDate,C=e.endDate&&(()=>{let _e=new Date(e.endDate);return _e.setHours(0,0,0,0),Z>_e})(),$=e.startDate&&Z<e.startDate,ce=1;if(Te&&e.startDate&&e.endDate&&!$){let _e=new Date(e.startDate);_e.setHours(0,0,0,0);let Rt=new Date(e.endDate);Rt.setHours(0,0,0,0);let Et=Math.max(1,(Rt.getTime()-_e.getTime())/(1e3*60*60*24)),Cr=Math.min((Z.getTime()-_e.getTime())/(1e3*60*60*24),Et)/Et*100;ce=Cr>0?O/Cr:1;}let xe;O>=100?xe="#00E5CC":$?xe="#4B5563":C&&O<100?xe="#EF4444":ce>=.95?xe="#22C55E":ce>=.8?xe="#F59E0B":xe="#EF4444";let ee=Math.max(O/100*Ye,O>0?J*2:0),Je=Ye>100&&O>0;return jsxs("g",{"data-task-class":ua,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:Ze,y:le,width:Ye,height:8,rx:J,fill:"rgba(255,255,255,0.10)"}),O>0&&jsx("rect",{x:Ze,y:le,width:ee,height:8,rx:J,fill:xe}),Je&&jsxs("text",{x:Ze+ee+6,y:le+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(O),"%"]})]})})(),!e.segments&&ot&&!Xe&&jsx(motion.rect,{x:Ze,y:r,width:Ye,height:Ae,rx:Fe,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":ua,"data-bar-background":"true",initial:{opacity:0,scale:.95},animate:{opacity:$e&&!Ft?.15:e.parentId?.6:1,scale:tt&&!$e?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:V=>Yt(V),style:{cursor:At,pointerEvents:"all"}}),!e.segments&&!ot&&jsx(motion.rect,{x:Ze,y:r,width:Ye,height:Ae,rx:Fe,fill:Qe,"data-task-class":ua,initial:{opacity:0,scale:.95},animate:{opacity:$e&&!Ft?.15:e.parentId?.6:tt?.9:.8,scale:tt&&!$e?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Xe?void 0:V=>Yt(V),style:{cursor:Xe?"default":At,pointerEvents:"all"}}),ot&&(U||X)&&!e.segments&&jsx("rect",{x:Ze,y:r,width:Ye,height:Ae,rx:Fe,fill:"none",stroke:n.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${n.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&it>0&&!Xe&&jsx("rect",{x:Ze,y:r,width:Math.max(Ye*(it/100),Fe*2),height:Ae,rx:Fe,fill:Qe,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!Xe&&e.progress<100&&(()=>{let V=e.progress>0?Ye*(e.progress/100):0,le=Ze+V,J=Ye-V,O=e.progress===0?Fe:0,Z=e.progress===0?Ze:le,Te=e.progress===0?Ye:J;return jsxs(Fragment,{children:[jsx("rect",{x:Z,y:r,width:Te,height:Ae,rx:O,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:Z,y:r,width:Te,height:Ae,rx:O,fill:"none",stroke:"#00E5CC",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),ot&&!e.segments&&e.progress>0&&e.progress<100&&!Xe&&!$e&&ae===null&&(()=>{let V=Ze+Ye*(e.progress/100),le=8,J=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:V,cy:r+Ae/2,r:le,fill:J?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:V,y:r+Ae/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:J?.initials||J?.name?.charAt(0)?.toUpperCase()||""})]})})(),q&&!$e&&Ye>=40&&(ae!==null||it<88)&&(()=>{let V=Ze+Ye*(it/100),le=r+Ae/2,J=ae!==null,O=J?7:tt?6:5,Z=J||tt?1:.35,Te=Ze+Ye-V,C=Math.max(4,Math.min(12,Te-10)),$=12;return jsxs("g",{children:[jsx("rect",{x:V-$,y:le-12,width:$+C,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:ne,onPointerMove:pe,onPointerUp:pt,onPointerCancel:pt,onClick:je,onDoubleClick:je,onMouseDown:ce=>ce.stopPropagation()}),jsx("circle",{cx:V,cy:le,r:O,fill:"#FFFFFF",stroke:Qe,strokeWidth:2,opacity:Z,style:{pointerEvents:"none",filter:J?`drop-shadow(0 0 4px ${Qe})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),J&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:V-20,y:le-28,width:40,height:18,rx:4,fill:Lt?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:Qe,strokeWidth:1}),jsxs("text",{x:V,y:le-16,textAnchor:"middle",dominantBaseline:"central",fill:Lt?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[ae,"%"]})]})]})})(),e.segments&&e.segments.map((V,le)=>{let J=(V.startDate.getTime()-o.getTime())/864e5*s,Z=(V.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-J+s,Te=$e&&P==="move"&&ge===le,C=qe===le,$=Te?J+Ie:J;return jsxs("g",{onMouseEnter:()=>!$e&&fe(le),onMouseLeave:()=>!$e&&fe(null),children:[jsx(motion.rect,{x:$,y:r,width:Z,height:Ae,rx:Fe,fill:Qe,initial:{opacity:0,scale:.95},animate:{opacity:Te||e.parentId?.6:C?.9:.8,scale:C&&!$e?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ce=>{ce.stopPropagation(),ye(le),ke(J),Yt(ce,void 0,J);},style:{cursor:At,pointerEvents:"all"}}),jsx("rect",{x:$,y:r,width:Z*(e.progress/100),height:Ae,rx:Fe,fill:Qe,opacity:1,style:{pointerEvents:"none"}})]},`segment-${le}`)}),Se&&(U||X)&&!e.segments&&jsxs(Fragment,{children:[X&&!U&&jsx("rect",{x:Ze,y:r,width:Ye,height:Ae,rx:Fe,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),U&&jsx("rect",{x:Ze,y:r,width:Ye,height:Ae,rx:Fe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&Ye>60&&!e.segments&&!(ot&&Xe)&&(()=>{let V=c.taskLabel(e),le=typeof V=="string"?V:e.name,J=le.length>Math.floor(Ye/8)?`${le.substring(0,Math.floor(Ye/8))}...`:le;return jsx("text",{x:Ze+8,y:r+Ae/2,dominantBaseline:"middle",fill:de?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:de?"line-through":"none"},children:J})})(),!$e&&!e.segments&&!Xe&&e.progress>0&&e.progress<100&&(ot?jsxs("text",{x:Ze+Ye+6,y:r+Ae/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Ye>100?jsxs("text",{x:Ze+Ye-12,y:r+Ae/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&Ye>80&&!$e&&!e.segments&&!(ot&&Xe)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Ze+Ye-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Ze+Ye-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(tt||gt)&&!Ft&&!e.segments&&!Xe&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Ze-2,y:r,width:16,height:Ae,fill:"transparent",style:{cursor:kt},onMouseEnter:()=>be("resize-start"),onMouseLeave:()=>be(null),onMouseDown:V=>{V.stopPropagation(),Yt(V,"resize-start");}}),jsx(motion.rect,{x:Ze+4,y:r+8,width:3,height:Ae-16,rx:1.5,fill:Le==="resize-start"||P==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:Ze+Ye-14,y:r,width:16,height:Ae,fill:"transparent",style:{cursor:kt},onMouseEnter:()=>be("resize-end"),onMouseLeave:()=>be(null),onMouseDown:V=>{V.stopPropagation(),Yt(V,"resize-end");}}),jsx(motion.rect,{x:Ze+Ye-7,y:r+8,width:3,height:Ae-16,rx:1.5,fill:Le==="resize-end"||P==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:tt&&!$e&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+a+10,cy:r+Ae/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>be("connect"),onMouseLeave:()=>be(null),onMouseDown:V=>{V.stopPropagation(),Yt(V,"connect");}}),jsx(motion.circle,{cx:t+a+10,cy:r+Ae/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:Le==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Ft&&W&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+a,y1:r+Ae/2,x2:W.x,y2:W.y,stroke:ve?n.statusCompleted:n.accent,strokeWidth:ve?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:ve?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:W.x,cy:W.y,r:ve?8:6,fill:ve?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),ve&&jsx(motion.text,{x:W.x+15,y:W.y,dominantBaseline:"middle",fill:n.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"})]}),(tt||$e)&&!Ft&&!e.segments&&jsx(motion.rect,{x:Ze-1,y:r-1,width:Ye+2,height:Ae+2,rx:Fe+1,fill:"none",stroke:$e?n.accent:ot?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:ot?1:2,opacity:$e||ot?.6:.4,initial:{opacity:0},animate:{opacity:$e||ot?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),gt&&jsxs(Fragment,{children:[jsx("line",{x1:te,y1:0,x2:te,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:te+_,y1:0,x2:te+_,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:tt&&!$e&&!e.segments&&!x&&(()=>{let J=r<100,O=J?r+Ae+13:r-82-13,Z=J?`M ${Ze+Ye/2-6} ${r+Ae+3} L ${Ze+Ye/2} ${r+Ae+13} L ${Ze+Ye/2+6} ${r+Ae+3}`:`M ${Ze+Ye/2-6} ${r-13} L ${Ze+Ye/2} ${r-3} L ${Ze+Ye/2+6} ${r-13}`,Te=O+22,C=O+40,$=O+55,ce=O+70,xe=J?O+82-5:r-18;return jsxs(motion.g,{initial:{opacity:0,y:J?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:J?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:Z,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsx("rect",{x:Ze+Ye/2-120,y:O,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:Ze+Ye/2,y:Te,textAnchor:"middle",fill:n.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:Ze+Ye/2-110,y:C,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Ze+Ye/2-70,y:C,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:da(e.startDate)}),jsx("text",{x:Ze+Ye/2-110,y:$,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Ze+Ye/2-70,y:$,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:da(e.endDate)}),jsx("text",{x:Ze+Ye/2+10,y:C,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Ze+Ye/2+65,y:C,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:qt()}),jsx("text",{x:Ze+Ye/2+10,y:$,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Ze+Ye/2+65,y:$,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:Ze+Ye/2-110,y:ce,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Ze+Ye/2-50,y:ce,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ee=>ee.name).join(", ").substring(0,30),e.assignees.map(ee=>ee.name).join(", ").length>30?"...":""]})]}),!J&&jsx("text",{x:Ze+Ye/2,y:xe,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:br?"Left: move \u2022 Right: resize":or?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var od=260,ss=8,Um=16,Zv=-12;function Wm({tooltipData:e,theme:t,locale:r="en",workingDaysConfig:a}){let[n,s]=useState(null);if(useLayoutEffect(()=>{if(!e){s(null);return}let{task:v,mouseX:w,mouseY:T}=e,E=v.effortMinutes!=null||v.timeLoggedMinutes!=null||v.soldEffortMinutes!=null,F=v.lastActivity!=null,k=(E?155:105)+(F?28:0),D=w+Um,P=T+Zv-k;D+od>window.innerWidth-ss&&(D=w-od-Um),D<ss&&(D=ss);let N=P<ss;N&&(P=T+20),P+k>window.innerHeight-ss&&(P=window.innerHeight-ss-k),s({left:D,top:P,showBelow:N});},[e]),!e||!n)return null;let{task:o}=e,c=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,l={start:r==="es"?"Inicio":"Start",end:r==="es"?"Fin":"End",duration:r==="es"?"Duraci\xF3n":"Duration",progress:r==="es"?"Progreso":"Progress",assignees:r==="es"?"Asignados":"Assignees",estimated:r==="es"?"Estimado":"Estimated",logged:r==="es"?"Registrado":"Logged",quoted:r==="es"?"Ofertado":"Quoted"},i=v=>v.toLocaleDateString(r==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),d=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!a?.enabledWeekdays){let P=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return r==="es"?`${P} d\xEDa${P!==1?"s":""}`:`${P} day${P!==1?"s":""}`}let v=a.enabledWeekdays,w=a.holidayDates instanceof Set?a.holidayDates:new Set(a.holidayDates??[]),T=P=>`${P.getFullYear()}-${String(P.getMonth()+1).padStart(2,"0")}-${String(P.getDate()).padStart(2,"0")}`,E=0,F=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),k=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;F.getTime()<=k.getTime();){let P=F.getDay();v[P]&&!w.has(T(F))&&E++,F.setDate(F.getDate()+1);}let D=Math.max(0,E);return r==="es"?`${D} d\xEDa${D!==1?"s":""}`:`${D} day${D!==1?"s":""}`},u=v=>{if(v==null||v===0)return "N/A";let w=Math.floor(v/60),T=v%60;return w===0?`${T}m`:T===0?`${w}h`:`${w}h ${T}m`},p=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",x=t.accent||"#00E5CC",y=t.bgSecondary||"#1F2937",b=t.border||"#374151",h=jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:od,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:y,border:`1px solid ${b}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:f,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(Qi,{label:l.start,value:o.startDate?i(o.startDate):"N/A",labelColor:p,valueColor:m}),jsx(Qi,{label:l.duration,value:d(),labelColor:p,valueColor:m}),jsx(Qi,{label:l.end,value:o.endDate?i(o.endDate):"N/A",labelColor:p,valueColor:m}),jsx(Qi,{label:l.progress,value:`${o.progress}%`,labelColor:p,valueColor:m})]}),o.assignees&&o.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:p},children:[l.assignees,": "]}),jsx("span",{style:{color:m,fontWeight:500},children:o.assignees.map(v=>v.name).join(", ")})]}),c&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[o.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:p},children:[l.estimated,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:u(o.effortMinutes)})]}),o.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:p},children:[l.logged,":"]})," ",jsx("span",{style:{color:x,fontWeight:600},children:u(o.timeLoggedMinutes)})]}),o.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:p},children:[l.quoted,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:u(o.soldEffortMinutes)})]})]}),o.lastActivity&&jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:p,lineHeight:1.4},children:[jsx("span",{style:{opacity:.7},children:r==="es"?"\xDAltimo: ":"Last: "}),jsx("span",{style:{color:m},children:o.lastActivity.userName})," ",jsx("span",{children:o.lastActivity.summary})," ",jsx("span",{style:{opacity:.6},children:o.lastActivity.relativeTime})]})]}),jsx("style",{children:`
126
126
  @keyframes gantt-tooltip-fade {
127
127
  from { opacity: 0; transform: translateY(${n.showBelow?"-4px":"4px"}); }
128
128
  to { opacity: 1; transform: translateY(0); }
129
129
  }
130
- `})]});return createPortal(h,document.body)}function _i({label:e,value:t,labelColor:a,valueColor:r}){return jsxs("div",{children:[jsxs("span",{style:{color:a},children:[e,": "]}),jsx("span",{style:{color:r,fontWeight:500},children:t})]})}function zs({x1:e,y1:t,x2:a,y2:r,theme:n,onDelete:s,lineStyle:o="curved",isHoverLayer:l=false,onHoverChange:d,hoverOverlayOnly:i=false,colorOverride:u,strokeWidthOverride:m,glowFilter:p}){let[,g]=useState(false),[f,v]=useState(null),y=r-t,b=y>0,h=Math.abs(y)<5,x=20,w=!h&&a<=e,N,D,A=a-e,T=e+A/2;D=T;let E=8;if(o==="squared")if(h)N=`M ${e} ${t} L ${a} ${r}`;else if(w){let Ne=e+15,ze=a-x,Me=b?t+20:t-20;D=ze;let at=b?1:-1;N=`M ${e} ${t} L ${Ne-E} ${t} Q ${Ne} ${t} ${Ne} ${t+at*E} L ${Ne} ${Me-at*E} Q ${Ne} ${Me} ${Ne-E} ${Me} L ${ze+E} ${Me} Q ${ze} ${Me} ${ze} ${Me+at*E} L ${ze} ${r-at*E} Q ${ze} ${r} ${ze+E} ${r} L ${a} ${r}`;}else {D=a-x;let je=b?1:-1;N=`M ${e} ${t} L ${D-E} ${t} Q ${D} ${t} ${D} ${t+je*E} L ${D} ${r-je*E} Q ${D} ${r} ${D+E} ${r} L ${a} ${r}`;}else N=`M ${e} ${t} C ${T} ${t}, ${T} ${r}, ${a} ${r}`;let P=6,k=5,K=`M ${a} ${r} L ${a-P} ${r-k/2} L ${a-P} ${r+k/2} Z`,H=!n.bgPrimary||n.bgPrimary.startsWith("#0")||n.bgPrimary.startsWith("#1"),ee=u||(H?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),I=m||1,Y=n.dependencyHover||(H?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),q="#f87171",V="rgba(248, 113, 113, 0.15)",B=D,X=(t+r)/2;if(f)if(o==="squared")if(h)B=Math.max(e+10,Math.min(a-10,f.x)),X=t;else if(w){let je=e+15,Ne=a-x,ze=b?t+20:t-20,Me=[[e,t,je,t],[je,t,je,ze],[je,ze,Ne,ze],[Ne,ze,Ne,r],[Ne,r,a,r]],at=1/0,be={x:B,y:X};for(let pt of Me){let Ke=Te(f.x,f.y,pt[0],pt[1],pt[2],pt[3]),Ue=Math.hypot(f.x-Ke.x,f.y-Ke.y);Ue<at&&(at=Ue,be=Ke);}B=be.x,X=be.y;}else {let je=[[e,t,D,t],[D,t,D,r],[D,r,a,r]],Ne=1/0,ze={x:B,y:X};for(let Me of je){let at=Te(f.x,f.y,Me[0],Me[1],Me[2],Me[3]),be=Math.hypot(f.x-at.x,f.y-at.y);be<Ne&&(Ne=be,ze=at);}B=ze.x,X=ze.y;}else {let je=T,Ne=t,ze=T,Me=r,at=1/0,be=B,pt=X;for(let Ke=0;Ke<=1;Ke+=.02){let Ue=1-Ke,kt=Ue*Ue*Ue*e+3*Ue*Ue*Ke*je+3*Ue*Ke*Ke*ze+Ke*Ke*Ke*a,Ht=Ue*Ue*Ue*t+3*Ue*Ue*Ke*Ne+3*Ue*Ke*Ke*Me+Ke*Ke*Ke*r,qe=Math.hypot(f.x-kt,f.y-Ht);qe<at&&(at=qe,be=kt,pt=Ht);}B=be,X=pt;}function Te(je,Ne,ze,Me,at,be){let pt=at-ze,Ke=be-Me,Ue=pt*pt+Ke*Ke;if(Ue===0)return {x:ze,y:Me};let kt=((je-ze)*pt+(Ne-Me)*Ke)/Ue;return kt=Math.max(0,Math.min(1,kt)),{x:ze+kt*pt,y:Me+kt*Ke}}let He=je=>{let Ne=je.currentTarget.ownerSVGElement;if(!Ne)return;let ze=Ne.getScreenCTM();if(!ze)return;let Me=ze.inverse();v({x:Me.a*je.clientX+Me.c*je.clientY+Me.e,y:Me.b*je.clientX+Me.d*je.clientY+Me.f});},z=()=>{g(false),v(null),d?.(false);},te=()=>{g(true),d?.(true);},xe=je=>s?jsxs(motion.g,{initial:je,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Ne=>{Ne.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsx("circle",{cx:B,cy:X,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsx("circle",{cx:B,cy:X,r:9,fill:V,stroke:q,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("line",{x1:B-3,y1:X-3,x2:B+3,y2:X+3,stroke:q,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("line",{x1:B+3,y1:X-3,x2:B-3,y2:X+3,stroke:q,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return l?jsxs("g",{"data-dependency-line":"true",onMouseLeave:z,onMouseMove:He,children:[jsx("path",{d:N,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:N,fill:"none",stroke:Y,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:N,fill:"none",stroke:Y,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:K,fill:Y,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:Y,opacity:.9,style:{pointerEvents:"none"}}),xe({opacity:0,scale:.8})]}):i?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:te,onMouseLeave:z,onMouseMove:He,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:N,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx("path",{d:N,fill:"none",stroke:n.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:N,fill:"none",stroke:Y,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsx("path",{d:N,fill:"none",stroke:Y,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:K,fill:Y,stroke:"none",style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:3.5,fill:Y,style:{pointerEvents:"none"}}),xe({opacity:0,scale:0})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:te,onMouseLeave:z,onMouseMove:He,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:N,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:N,fill:"none",stroke:ee,strokeWidth:I,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:p||"none"}}),jsx(motion.path,{d:K,fill:ee,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsx(motion.circle,{cx:a,cy:r,r:3,fill:ee,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Xi({task:e,x:t,y:a,theme:r,onClick:n}){let[s,o]=useState(false),l=16,d=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>o(true),onMouseLeave:()=>o(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{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:d(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 Ie={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let n=r.getDay();n!==0&&n!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let n=a.getDay();n!==0&&n!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,n=i=>{i.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&n(u.subtasks);});};n(e);let s=r.get(a)||[];r.set(a,[...s,t]);let o=new Set,l=new Set,d=i=>{if(!o.has(i)){o.add(i),l.add(i);let u=r.get(i)||[];for(let m of u){if(!o.has(m)&&d(m))return true;if(l.has(m))return true}}return l.delete(i),false};return d(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,o)=>(s.position??0)-(o.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Ie.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Ie.findTaskById(e,t);if(!r||!r.parentId)return a;let n=r.parentId;for(;n;){let s=Ie.findTaskById(e,n);if(s)a.unshift(s),n=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=Ie.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let s=[n.id,`"${n.name.replace(/"/g,'""')}"`,n.startDate?n.startDate.toISOString().split("T")[0]:"",n.endDate?n.endDate.toISOString().split("T")[0]:"",n.progress.toString(),n.status||"",n.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
131
- `)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=Ie.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=Ie.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)=>Ie.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Ie.findTaskById(e,t);return !a||!a.dependencies?[]:Ie.flattenTasks(e).filter(n=>a.dependencies.includes(n.id))},filterByStatus:(e,t)=>Ie.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Ie.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let n=a.startDate.getTime()-r.startDate.getTime();return t?n:-n}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let n=a.endDate.getTime()-r.endDate.getTime();return t?n:-n}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let n=a.progress-r.progress;return t?n:-n}),calculateTotalProgress:e=>{let t=Ie.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,n)=>r+n.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let n=0;n<t.length;n++){let s=t[n];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;n<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>Ie.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),n=new a,s=Ie.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}n.setFontSize(16),n.text("Gantt Chart - Task List",14,20);let o=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=s.map(d=>{let i=d.startDate&&d.endDate?Ie.calculateDuration(d.startDate,d.endDate):0;return [d.name,d.startDate?Ie.formatDate(d.startDate):"N/A",d.endDate?Ie.formatDate(d.endDate):"N/A",i>0?`${i} days`:"N/A",`${d.progress}%`,d.status||"N/A"]});r(n,{head:o,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),n.save(t);}catch(a){throw a}},exportToExcel:async(e,t,a)=>{let r=await import('xlsx'),n=Ie.flattenTasks(e),s=a?.rateMap,o=a?.defaultRate||0,l=y=>{if(!s||!y.assignees||y.assignees.length===0)return o;let b=y.assignees.map(h=>h.id?s[h.id]:void 0).filter(h=>h!=null&&h>0);return b.length===0?o:b.reduce((h,x)=>h+x,0)/b.length},d=new Map,i=(y,b="")=>{[...y].sort((x,w)=>(x.position??0)-(w.position??0)).forEach((x,w)=>{let N=b?`${b}.${w+1}`:`${w+1}`;d.set(x.id,N),x.subtasks?.length&&i(x.subtasks,N);});};i(e);let u=s&&Object.keys(s).length>0||n.some(y=>y._costRate>0),m=n.map(y=>{let b=y.startDate&&y.endDate?Ie.calculateDuration(y.startDate,y.endDate):0,h=y.effortMinutes,x=y.timeLoggedMinutes,w=y.soldEffortMinutes,N=typeof h=="number"?+(h/60).toFixed(1):0,D=typeof x=="number"?+(x/60).toFixed(1):0,A=typeof w=="number"?+(w/60).toFixed(1):0,T=y._costRate>0?y._costRate:l(y),E={WBS:d.get(y.id)||"","Task Name":y.name,"Start Date":y.startDate?Ie.formatDate(y.startDate):"","End Date":y.endDate?Ie.formatDate(y.endDate):"","Duration (days)":b>0?b:"","Progress (%)":y.progress,Status:y.status||"",Assignees:y.assignees?.map(k=>k.name).join(", ")||"","Estimated (h)":N||"","Logged (h)":D||"","Quoted (h)":A||""};u&&(E["$ Estimated"]=N>0&&T>0?Math.round(N*T):"",E["$ Executed"]=D>0&&T>0?Math.round(D*T):"",E["$ Quoted"]=A>0&&T>0?Math.round(A*T):"",E["Rate ($/h)"]=T>0?T:"");let P=y.weight;return E["Weight (%)"]=typeof P=="number"&&P>0?P:"",E["Is Milestone"]=y.isMilestone?"Yes":"No",E}),p=a?.projectName||"";if(p||m.length>0){let y=0,b=0,h=0,x=0,w=0,N=0,D=0,A=0,T=n.filter(k=>k.startDate).map(k=>k.startDate.getTime()),E=n.filter(k=>k.endDate).map(k=>k.endDate.getTime());for(let k of m)typeof k["Estimated (h)"]=="number"&&(y+=k["Estimated (h)"]),typeof k["Logged (h)"]=="number"&&(b+=k["Logged (h)"]),typeof k["Quoted (h)"]=="number"&&(h+=k["Quoted (h)"]),u&&(typeof k["$ Estimated"]=="number"&&(x+=k["$ Estimated"]),typeof k["$ Executed"]=="number"&&(w+=k["$ Executed"]),typeof k["$ Quoted"]=="number"&&(N+=k["$ Quoted"])),typeof k["Progress (%)"]=="number"&&(D+=k["Progress (%)"],A++);let P={WBS:"0","Task Name":`\u{1F4CB} ${p||"PROJECT TOTAL"}`,"Start Date":T.length>0?Ie.formatDate(new Date(Math.min(...T))):"","End Date":E.length>0?Ie.formatDate(new Date(Math.max(...E))):"","Duration (days)":T.length>0&&E.length>0?Ie.calculateDuration(new Date(Math.min(...T)),new Date(Math.max(...E))):"","Progress (%)":A>0?Math.round(D/A):0,Status:"",Assignees:"","Estimated (h)":+y.toFixed(1)||"","Logged (h)":+b.toFixed(1)||"","Quoted (h)":+h.toFixed(1)||""};u&&(P["$ Estimated"]=x||"",P["$ Executed"]=w||"",P["$ Quoted"]=N||"",P["Rate ($/h)"]=""),P["Is Milestone"]="No",m.unshift(P);}let g=r.utils.json_to_sheet(m),f=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},...u?[{wch:14},{wch:14},{wch:14},{wch:12}]:[],{wch:12}];g["!cols"]=f;let v=r.utils.book_new();if(r.utils.book_append_sheet(v,g,"Gantt Tasks"),!t){let y=new Date,b=x=>String(x).padStart(2,"0");t=`Project_${`${y.getFullYear()}-${b(y.getMonth()+1)}-${b(y.getDate())}_${b(y.getHours())}${b(y.getMinutes())}`}.xlsx`;}r.writeFile(v,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Ie.flattenTasks(e),n=new Map;r.forEach((p,g)=>{n.set(p.id,g+1);});let s=p=>p.toISOString().replace("Z",""),o=Ie.getEarliestStartDate(e)||new Date,l=Ie.getLatestEndDate(e)||new Date,d=r.map((p,g)=>{let f=n.get(p.id),v=p.startDate&&p.endDate?Ie.calculateDuration(p.startDate,p.endDate):0,y=(p.dependencies||[]).filter(b=>n.has(b)).map(b=>`
130
+ `})]});return createPortal(h,document.body)}function Qi({label:e,value:t,labelColor:r,valueColor:a}){return jsxs("div",{children:[jsxs("span",{style:{color:r},children:[e,": "]}),jsx("span",{style:{color:a,fontWeight:500},children:t})]})}function Ks({x1:e,y1:t,x2:r,y2:a,theme:n,onDelete:s,lineStyle:o="curved",isHoverLayer:c=false,onHoverChange:l,hoverOverlayOnly:i=false,colorOverride:d,strokeWidthOverride:u,glowFilter:p}){let[,m]=useState(false),[f,x]=useState(null),y=a-t,b=y>0,h=Math.abs(y)<5,v=20,w=!h&&r<=e,T,E,F=r-e,k=e+F/2;E=k;let D=8;if(o==="squared")if(h)T=`M ${e} ${t} L ${r} ${a}`;else if(w){let ke=e+15,Ie=r-v,De=b?t+20:t-20;E=Ie;let qe=b?1:-1;T=`M ${e} ${t} L ${ke-D} ${t} Q ${ke} ${t} ${ke} ${t+qe*D} L ${ke} ${De-qe*D} Q ${ke} ${De} ${ke-D} ${De} L ${Ie+D} ${De} Q ${Ie} ${De} ${Ie} ${De+qe*D} L ${Ie} ${a-qe*D} Q ${Ie} ${a} ${Ie+D} ${a} L ${r} ${a}`;}else {E=r-v;let ze=b?1:-1;T=`M ${e} ${t} L ${E-D} ${t} Q ${E} ${t} ${E} ${t+ze*D} L ${E} ${a-ze*D} Q ${E} ${a} ${E+D} ${a} L ${r} ${a}`;}else T=`M ${e} ${t} C ${k} ${t}, ${k} ${a}, ${r} ${a}`;let P=6,N=5,K=`M ${r} ${a} L ${r-P} ${a-N/2} L ${r-P} ${a+N/2} Z`,H=!n.bgPrimary||n.bgPrimary.startsWith("#0")||n.bgPrimary.startsWith("#1"),te=d||(H?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),I=u||1,_=n.dependencyHover||(H?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),j="#f87171",W="rgba(248, 113, 113, 0.15)",B=E,ve=(t+a)/2;if(f)if(o==="squared")if(h)B=Math.max(e+10,Math.min(r-10,f.x)),ve=t;else if(w){let ze=e+15,ke=r-v,Ie=b?t+20:t-20,De=[[e,t,ze,t],[ze,t,ze,Ie],[ze,Ie,ke,Ie],[ke,Ie,ke,a],[ke,a,r,a]],qe=1/0,fe={x:B,y:ve};for(let tt of De){let Be=We(f.x,f.y,tt[0],tt[1],tt[2],tt[3]),$e=Math.hypot(f.x-Be.x,f.y-Be.y);$e<qe&&(qe=$e,fe=Be);}B=fe.x,ve=fe.y;}else {let ze=[[e,t,E,t],[E,t,E,a],[E,a,r,a]],ke=1/0,Ie={x:B,y:ve};for(let De of ze){let qe=We(f.x,f.y,De[0],De[1],De[2],De[3]),fe=Math.hypot(f.x-qe.x,f.y-qe.y);fe<ke&&(ke=fe,Ie=qe);}B=Ie.x,ve=Ie.y;}else {let ze=k,ke=t,Ie=k,De=a,qe=1/0,fe=B,tt=ve;for(let Be=0;Be<=1;Be+=.02){let $e=1-Be,gt=$e*$e*$e*e+3*$e*$e*Be*ze+3*$e*Be*Be*Ie+Be*Be*Be*r,Ft=$e*$e*$e*t+3*$e*$e*Be*ke+3*$e*Be*Be*De+Be*Be*Be*a,He=Math.hypot(f.x-gt,f.y-Ft);He<qe&&(qe=He,fe=gt,tt=Ft);}B=fe,ve=tt;}function We(ze,ke,Ie,De,qe,fe){let tt=qe-Ie,Be=fe-De,$e=tt*tt+Be*Be;if($e===0)return {x:Ie,y:De};let gt=((ze-Ie)*tt+(ke-De)*Be)/$e;return gt=Math.max(0,Math.min(1,gt)),{x:Ie+gt*tt,y:De+gt*Be}}let Le=ze=>{let ke=ze.currentTarget.ownerSVGElement;if(!ke)return;let Ie=ke.getScreenCTM();if(!Ie)return;let De=Ie.inverse();x({x:De.a*ze.clientX+De.c*ze.clientY+De.e,y:De.b*ze.clientX+De.d*ze.clientY+De.f});},be=()=>{m(false),x(null),l?.(false);},ge=()=>{m(true),l?.(true);},ye=ze=>s?jsxs(motion.g,{initial:ze,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:ke=>{ke.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsx("circle",{cx:B,cy:ve,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsx("circle",{cx:B,cy:ve,r:9,fill:W,stroke:j,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("line",{x1:B-3,y1:ve-3,x2:B+3,y2:ve+3,stroke:j,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("line",{x1:B+3,y1:ve-3,x2:B-3,y2:ve+3,stroke:j,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return c?jsxs("g",{"data-dependency-line":"true",onMouseLeave:be,onMouseMove:Le,children:[jsx("path",{d:T,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:T,fill:"none",stroke:_,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:T,fill:"none",stroke:_,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:K,fill:_,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:r,cy:a,r:4,fill:_,opacity:.9,style:{pointerEvents:"none"}}),ye({opacity:0,scale:.8})]}):i?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:ge,onMouseLeave:be,onMouseMove:Le,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:T,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx("path",{d:T,fill:"none",stroke:n.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:T,fill:"none",stroke:_,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsx("path",{d:T,fill:"none",stroke:_,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:K,fill:_,stroke:"none",style:{pointerEvents:"none"}}),jsx("circle",{cx:r,cy:a,r:3.5,fill:_,style:{pointerEvents:"none"}}),ye({opacity:0,scale:0})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:ge,onMouseLeave:be,onMouseMove:Le,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:T,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:T,fill:"none",stroke:te,strokeWidth:I,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:p||"none"}}),jsx(motion.path,{d:K,fill:te,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsx(motion.circle,{cx:r,cy:a,r:3,fill:te,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function rl({task:e,x:t,y:r,theme:a,onClick:n}){let[s,o]=useState(false),c=16,l=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>o(true),onMouseLeave:()=>o(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:r+16,r:c+4,fill:a.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-c/2,y:r+16-c/2,width:c,height:c,fill:e.isCriticalPath?a.criticalPath:a.milestone,stroke:a.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${r+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-(c+4)/2,y:r+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?a.criticalPath:a.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${r+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:r-50,width:160,height:44,rx:8,fill:a.bgSecondary,stroke:a.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${r-6} L ${t} ${r+4} L ${t+6} ${r-6}`,fill:a.bgSecondary,stroke:a.border,strokeWidth:1}),jsx("rect",{x:t-70,y:r-38,width:8,height:8,fill:e.isCriticalPath?a.criticalPath:a.milestone,transform:`rotate(45 ${t-66} ${r-34})`}),jsx("text",{x:t-55,y:r-32,fill:a.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:r-18,fill:a.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:l(e.startDate)}),e.isCriticalPath&&jsxs("g",{children:[jsx("rect",{x:t+10,y:r-40,width:60,height:16,rx:4,fill:a.criticalPathLight}),jsx("text",{x:t+40,y:r-30,textAnchor:"middle",fill:a.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Ne={calculateEndDate:(e,t)=>{let r=new Date(e);return r.setDate(r.getDate()+t),r},calculateDuration:(e,t)=>{let r=t.getTime()-e.getTime();return Math.ceil(r/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let r=0,a=new Date(e);for(;a<=t;){let n=a.getDay();n!==0&&n!==6&&r++,a.setDate(a.getDate()+1);}return r},addWorkingDays:(e,t)=>{let r=new Date(e),a=0;for(;a<t;){r.setDate(r.getDate()+1);let n=r.getDay();n!==0&&n!==6&&a++;}return r},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,r)=>{let a=new Map,n=i=>{i.forEach(d=>{d.dependencies&&a.set(d.id,d.dependencies),d.subtasks&&n(d.subtasks);});};n(e);let s=a.get(r)||[];a.set(r,[...s,t]);let o=new Set,c=new Set,l=i=>{if(!o.has(i)){o.add(i),c.add(i);let d=a.get(i)||[];for(let u of d){if(!o.has(u)&&l(u))return true;if(c.has(u))return true}}return c.delete(i),false};return l(r)},flattenTasks:e=>{let t=[],r=a=>{[...a].sort((s,o)=>(s.position??0)-(o.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&r(s.subtasks);});};return r(e),t},findTaskById:(e,t)=>{for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=Ne.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=Ne.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let s=Ne.findTaskById(e,n);if(s)r.unshift(s),n=s.parentId;else break}return r},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((r,a)=>{if(!r.id||!r.name)throw new Error(`Invalid task at index ${a}: 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=Ne.flattenTasks(e),a=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let s=[n.id,`"${n.name.replace(/"/g,'""')}"`,n.startDate?n.startDate.toISOString().split("T")[0]:"",n.endDate?n.endDate.toISOString().split("T")[0]:"",n.progress.toString(),n.status||"",n.dependencies?.join(";")||""];a.push(s.join(","));}),a.join(`
131
+ `)},formatDate:e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return `${t}-${r}-${a}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let r=Ne.flattenTasks(e).filter(a=>a.startDate);return r.length===0?null:new Date(Math.min(...r.map(a=>a.startDate.getTime())))},getLatestEndDate:e=>{let r=Ne.flattenTasks(e).filter(a=>a.endDate);return r.length===0?null:new Date(Math.max(...r.map(a=>a.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)=>Ne.flattenTasks(e).filter(a=>a.dependencies&&a.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let r=Ne.findTaskById(e,t);return !r||!r.dependencies?[]:Ne.flattenTasks(e).filter(n=>r.dependencies.includes(n.id))},filterByStatus:(e,t)=>Ne.flattenTasks(e).filter(r=>r.status===t),filterByDateRange:(e,t,r)=>Ne.flattenTasks(e).filter(a=>!a.startDate||!a.endDate?false:a.startDate<=r&&a.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((r,a)=>{if(!r.startDate||!a.startDate)return 0;let n=r.startDate.getTime()-a.startDate.getTime();return t?n:-n}),sortByEndDate:(e,t=true)=>[...e].sort((r,a)=>{if(!r.endDate||!a.endDate)return 0;let n=r.endDate.getTime()-a.endDate.getTime();return t?n:-n}),sortByProgress:(e,t=true)=>[...e].sort((r,a)=>{let n=r.progress-a.progress;return t?n:-n}),calculateTotalProgress:e=>{let t=Ne.flattenTasks(e);if(t.length===0)return 0;let r=t.reduce((a,n)=>a+n.progress,0);return Math.round(r/t.length)},getTaskByPath:(e,t)=>{let r=e,a;for(let n=0;n<t.length;n++){let s=t[n];if(!r||s===void 0||s>=r.length||(a=r[s],!a))return;n<t.length-1&&(r=a.subtasks||[]);}return a},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(r=>Ne.cloneTask(r))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:r}=await import('jspdf'),{default:a}=await import('jspdf-autotable'),n=new r,s=Ne.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}n.setFontSize(16),n.text("Gantt Chart - Task List",14,20);let o=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],c=s.map(l=>{let i=l.startDate&&l.endDate?Ne.calculateDuration(l.startDate,l.endDate):0;return [l.name,l.startDate?Ne.formatDate(l.startDate):"N/A",l.endDate?Ne.formatDate(l.endDate):"N/A",i>0?`${i} days`:"N/A",`${l.progress}%`,l.status||"N/A"]});a(n,{head:o,body:c,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),n.save(t);}catch(r){throw r}},exportToExcel:async(e,t,r)=>{let a=await import('xlsx'),n=Ne.flattenTasks(e),s=r?.rateMap,o=r?.defaultRate||0,c=y=>{if(!s||!y.assignees||y.assignees.length===0)return o;let b=y.assignees.map(h=>h.id?s[h.id]:void 0).filter(h=>h!=null&&h>0);return b.length===0?o:b.reduce((h,v)=>h+v,0)/b.length},l=new Map,i=(y,b="")=>{[...y].sort((v,w)=>(v.position??0)-(w.position??0)).forEach((v,w)=>{let T=b?`${b}.${w+1}`:`${w+1}`;l.set(v.id,T),v.subtasks?.length&&i(v.subtasks,T);});};i(e);let d=s&&Object.keys(s).length>0||n.some(y=>y._costRate>0),u=n.map(y=>{let b=y.startDate&&y.endDate?Ne.calculateDuration(y.startDate,y.endDate):0,h=y.effortMinutes,v=y.timeLoggedMinutes,w=y.soldEffortMinutes,T=typeof h=="number"?+(h/60).toFixed(1):0,E=typeof v=="number"?+(v/60).toFixed(1):0,F=typeof w=="number"?+(w/60).toFixed(1):0,k=y._costRate>0?y._costRate:c(y),D={WBS:l.get(y.id)||"","Task Name":y.name,"Start Date":y.startDate?Ne.formatDate(y.startDate):"","End Date":y.endDate?Ne.formatDate(y.endDate):"","Duration (days)":b>0?b:"","Progress (%)":y.progress,Status:y.status||"",Assignees:y.assignees?.map(N=>N.name).join(", ")||"","Estimated (h)":T||"","Logged (h)":E||"","Quoted (h)":F||""};d&&(D["$ Estimated"]=T>0&&k>0?Math.round(T*k):"",D["$ Executed"]=E>0&&k>0?Math.round(E*k):"",D["$ Quoted"]=F>0&&k>0?Math.round(F*k):"",D["Rate ($/h)"]=k>0?k:"");let P=y.weight;return D["Weight (%)"]=typeof P=="number"&&P>0?P:"",D["Is Milestone"]=y.isMilestone?"Yes":"No",D}),p=r?.projectName||"";if(p||u.length>0){let y=0,b=0,h=0,v=0,w=0,T=0,E=0,F=0,k=n.filter(N=>N.startDate).map(N=>N.startDate.getTime()),D=n.filter(N=>N.endDate).map(N=>N.endDate.getTime());for(let N of u)typeof N["Estimated (h)"]=="number"&&(y+=N["Estimated (h)"]),typeof N["Logged (h)"]=="number"&&(b+=N["Logged (h)"]),typeof N["Quoted (h)"]=="number"&&(h+=N["Quoted (h)"]),d&&(typeof N["$ Estimated"]=="number"&&(v+=N["$ Estimated"]),typeof N["$ Executed"]=="number"&&(w+=N["$ Executed"]),typeof N["$ Quoted"]=="number"&&(T+=N["$ Quoted"])),typeof N["Progress (%)"]=="number"&&(E+=N["Progress (%)"],F++);let P={WBS:"0","Task Name":`\u{1F4CB} ${p||"PROJECT TOTAL"}`,"Start Date":k.length>0?Ne.formatDate(new Date(Math.min(...k))):"","End Date":D.length>0?Ne.formatDate(new Date(Math.max(...D))):"","Duration (days)":k.length>0&&D.length>0?Ne.calculateDuration(new Date(Math.min(...k)),new Date(Math.max(...D))):"","Progress (%)":F>0?Math.round(E/F):0,Status:"",Assignees:"","Estimated (h)":+y.toFixed(1)||"","Logged (h)":+b.toFixed(1)||"","Quoted (h)":+h.toFixed(1)||""};d&&(P["$ Estimated"]=v||"",P["$ Executed"]=w||"",P["$ Quoted"]=T||"",P["Rate ($/h)"]=""),P["Is Milestone"]="No",u.unshift(P);}let m=a.utils.json_to_sheet(u),f=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},...d?[{wch:14},{wch:14},{wch:14},{wch:12}]:[],{wch:12}];m["!cols"]=f;let x=a.utils.book_new();if(a.utils.book_append_sheet(x,m,"Gantt Tasks"),!t){let y=new Date,b=v=>String(v).padStart(2,"0");t=`Project_${`${y.getFullYear()}-${b(y.getMonth()+1)}-${b(y.getDate())}_${b(y.getHours())}${b(y.getMinutes())}`}.xlsx`;}a.writeFile(x,t);},exportToMSProject:(e,t="Gantt Project",r="project.xml")=>{let a=Ne.flattenTasks(e),n=new Map;a.forEach((p,m)=>{n.set(p.id,m+1);});let s=p=>p.toISOString().replace("Z",""),o=Ne.getEarliestStartDate(e)||new Date,c=Ne.getLatestEndDate(e)||new Date,l=a.map((p,m)=>{let f=n.get(p.id),x=p.startDate&&p.endDate?Ne.calculateDuration(p.startDate,p.endDate):0,y=(p.dependencies||[]).filter(b=>n.has(b)).map(b=>`
132
132
  <PredecessorLink>
133
133
  <PredecessorUID>${n.get(b)}</PredecessorUID>
134
134
  <Type>1</Type>
@@ -138,20 +138,20 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
138
138
  </PredecessorLink>`).join("");return `
139
139
  <Task>
140
140
  <UID>${f}</UID>
141
- <ID>${g+1}</ID>
141
+ <ID>${m+1}</ID>
142
142
  <Name>${p.name.replace(/[<>&'"]/g,b=>({"<":"&lt;",">":"&gt;","&":"&amp;","'":"&apos;",'"':"&quot;"})[b]||b)}</Name>
143
143
  <Type>0</Type>
144
144
  <IsNull>0</IsNull>
145
145
  <CreateDate>${s(new Date)}</CreateDate>
146
- <WBS>${g+1}</WBS>
147
- <OutlineNumber>${g+1}</OutlineNumber>
146
+ <WBS>${m+1}</WBS>
147
+ <OutlineNumber>${m+1}</OutlineNumber>
148
148
  <OutlineLevel>${p.level||0}</OutlineLevel>
149
149
  <Priority>500</Priority>
150
150
  <Start>${p.startDate?s(p.startDate):""}</Start>
151
151
  <Finish>${p.endDate?s(p.endDate):""}</Finish>
152
- <Duration>PT${v*8}H0M0S</Duration>
152
+ <Duration>PT${x*8}H0M0S</Duration>
153
153
  <DurationFormat>7</DurationFormat>
154
- <Work>PT${v*8}H0M0S</Work>
154
+ <Work>PT${x*8}H0M0S</Work>
155
155
  <Stop>${p.endDate?s(p.endDate):""}</Stop>
156
156
  <Resume>${p.startDate?s(p.startDate):""}</Resume>
157
157
  <ResumeValid>0</ResumeValid>
@@ -183,15 +183,15 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
183
183
  <OvertimeWork>PT0H0M0S</OvertimeWork>
184
184
  <ActualStart>${p.progress>0&&p.startDate?s(p.startDate):""}</ActualStart>
185
185
  <ActualFinish>${p.progress===100&&p.endDate?s(p.endDate):""}</ActualFinish>
186
- <ActualDuration>PT${Math.round(v*p.progress/100)*8}H0M0S</ActualDuration>
186
+ <ActualDuration>PT${Math.round(x*p.progress/100)*8}H0M0S</ActualDuration>
187
187
  <ActualCost>0</ActualCost>
188
188
  <ActualOvertimeCost>0</ActualOvertimeCost>
189
- <ActualWork>PT${Math.round(v*p.progress/100)*8}H0M0S</ActualWork>
189
+ <ActualWork>PT${Math.round(x*p.progress/100)*8}H0M0S</ActualWork>
190
190
  <ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
191
- <RegularWork>PT${v*8}H0M0S</RegularWork>
192
- <RemainingDuration>PT${Math.round(v*(100-p.progress)/100)*8}H0M0S</RemainingDuration>
191
+ <RegularWork>PT${x*8}H0M0S</RegularWork>
192
+ <RemainingDuration>PT${Math.round(x*(100-p.progress)/100)*8}H0M0S</RemainingDuration>
193
193
  <RemainingCost>0</RemainingCost>
194
- <RemainingWork>PT${Math.round(v*(100-p.progress)/100)*8}H0M0S</RemainingWork>
194
+ <RemainingWork>PT${Math.round(x*(100-p.progress)/100)*8}H0M0S</RemainingWork>
195
195
  <RemainingOvertimeCost>0</RemainingOvertimeCost>
196
196
  <RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
197
197
  <ACWP>0</ACWP>
@@ -220,7 +220,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
220
220
  <LastSaved>${s(new Date)}</LastSaved>
221
221
  <ScheduleFromStart>1</ScheduleFromStart>
222
222
  <StartDate>${s(o)}</StartDate>
223
- <FinishDate>${s(l)}</FinishDate>
223
+ <FinishDate>${s(c)}</FinishDate>
224
224
  <FYStartDate>1</FYStartDate>
225
225
  <CriticalSlackLimit>0</CriticalSlackLimit>
226
226
  <CurrencyDigits>2</CurrencyDigits>
@@ -356,16 +356,16 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
356
356
  </WeekDays>
357
357
  </Calendar>
358
358
  </Calendars>
359
- <Tasks>${d}
359
+ <Tasks>${l}
360
360
  </Tasks>
361
- </Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),m=document.createElement("a");m.href=URL.createObjectURL(u),m.download=a,m.click(),URL.revokeObjectURL(m.href);},calculateCriticalPath:e=>{let t=Ie.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,n=i=>{if(r.has(i.id))return;let u=i.startDate&&i.endDate?Ie.calculateDuration(i.startDate,i.endDate):0,m=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let f=t.find(v=>v.id===g);if(f){n(f);let v=r.get(g)?.ef||0;m=Math.max(m,v);}}let p=m+u;r.set(i.id,{es:m,ef:p});};a.forEach(n);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),o=new Map,l=i=>{if(o.has(i.id))return;let u=i.startDate&&i.endDate?Ie.calculateDuration(i.startDate,i.endDate):0,m=t.filter(f=>f.dependencies&&f.dependencies.includes(i.id)),p=s;if(m.length>0)for(let f of m){l(f);let v=o.get(f.id)?.ls||0;p=Math.min(p,v);}let g=p-u;o.set(i.id,{ls:g,lf:p});};a.forEach(l);let d=[];for(let i of a){let u=r.get(i.id),m=o.get(i.id);if(u&&m){let p=m.ls-u.es;Math.abs(p)<.01&&d.push(i.id);}}return d},calculateCriticalPathFull:e=>{let t=new Map,r=Ie.flattenTasks(e).filter(p=>p.startDate&&p.endDate);if(r.length===0)return t;let n=new Map(r.map(p=>[p.id,p])),s=new Map;for(let p of r)s.has(p.id)||s.set(p.id,[]);for(let p of r)if(p.dependencies){for(let g of p.dependencies)if(n.has(g)){let f=s.get(g);f&&f.push(p.id);}}let o=new Map;for(let p of r)o.set(p.id,0);for(let p of r)if(p.dependencies)for(let g of p.dependencies)n.has(g)&&o.set(p.id,(o.get(p.id)||0)+1);let l=new Map,d=[],i=[];for(let p of r)(o.get(p.id)||0)===0&&i.push(p.id);for(;i.length>0;){let p=i.shift();d.push(p);let g=n.get(p);if(!g||!g.startDate||!g.endDate)continue;let f=Ie.calculateDuration(g.startDate,g.endDate),v=0;if(g.dependencies)for(let b of g.dependencies){let h=l.get(b);h&&(v=Math.max(v,h.ef));}l.set(p,{es:v,ef:v+f});let y=s.get(p)||[];for(let b of y){let h=(o.get(b)||1)-1;o.set(b,h),h===0&&i.push(b);}}if(d.length<r.length)return t;let u=Math.max(...Array.from(l.values()).map(p=>p.ef)),m=new Map;for(let p=d.length-1;p>=0;p--){let g=d[p];if(!g)continue;let f=n.get(g);if(!f||!f.startDate||!f.endDate)continue;let v=Ie.calculateDuration(f.startDate,f.endDate),y=s.get(g)||[],b=u;if(y.length>0)for(let h of y){let x=m.get(h);x&&(b=Math.min(b,x.ls));}m.set(g,{ls:b-v,lf:b});}for(let p of d){let g=l.get(p),f=m.get(p),v=f.ls-g.es,y=s.get(p)||[],b;y.length>0?b=Math.min(...y.map(h=>l.get(h).es))-g.ef:b=u-g.ef,t.set(p,{earlyStart:g.es,earlyFinish:g.ef,lateStart:f.ls,lateFinish:f.lf,totalFloat:Math.round(v*100)/100,freeFloat:Math.max(0,Math.round(b*100)/100),isCritical:v<=.01});}return t},calculateSlack:(e,t)=>{let a=Ie.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Ie.calculateCriticalPath(e).includes(t))return 0;let n=Ie.getDependentTasks(e,t);if(n.length===0){let l=Ie.getLatestEndDate(e);if(!l)return null;let d=Ie.calculateDuration(a.endDate,l);return Math.max(0,d)}let s=n.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,d)=>l-d)[0];if(!s)return null;let o=Ie.calculateDuration(a.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>Ie.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let n=r||new Set;if(n.has(t))return e;n.add(t);let s=Ie.findTaskById(e,t);if(!s||!s.endDate)return e;let o=Ie.getDependentTasks(e,t);if(o.length===0)return e;let l=[...e];for(let d of o){if(n.has(d.id)||!d.startDate||!d.endDate)continue;let i=Ie.calculateDuration(d.startDate,d.endDate),u;if(a!==void 0?(u=new Date(d.startDate),u.setDate(u.getDate()+a)):(u=new Date(s.endDate),u.setDate(u.getDate()+1)),a!==void 0){let g=new Date(s.endDate),f=new Date(g);f.setDate(f.getDate()+1),u<f&&(u=f);}let m=Ie.calculateEndDate(u,i),p=g=>g.map(f=>f.id===d.id?{...f,startDate:u,endDate:m}:f.subtasks?{...f,subtasks:p(f.subtasks)}:f);l=p(l),l=Ie.autoScheduleDependents(l,d.id,a,n);}return l},calculateCascadePreview:(e,t,a,r,n,s,o,l)=>{if(a===0)return [];let d=[],i=n.getTime(),u=1e3*60*60*24,m=Ie.findTaskById(e,t);if(!m||!m.endDate)return [];let p=(g,f,v=new Set)=>{if(v.has(g))return;v.add(g);let y=Ie.getDependentTasks(e,g);for(let b of y){if(!b.startDate||!b.endDate)continue;let h=r.findIndex(k=>k.id===b.id);if(h===-1)continue;let x=b.startDate.getTime(),N=(b.endDate.getTime()-x)/u,A=(x-i)/u*s,T=A+f*s,E=Math.max(N*s,s),P=l+h*o+(o-18)/2;d.push({taskId:b.id,taskName:b.name,originalX:A,previewX:T,width:E,y:P,rowIndex:h,daysDelta:f,color:b.color}),p(b.id,f,v);}};return p(t,a),d},splitTask:(e,t,a,r=3)=>{let n=Ie.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(a<=n.startDate||a>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let o=new Date(a);o.setDate(o.getDate()+r);let l=new Date(n.endDate);l.setDate(l.getDate()+r);let d=[{startDate:new Date(n.startDate),endDate:s},{startDate:o,endDate:l}],i=u=>u.map(m=>m.id===n.id?{...m,endDate:l,segments:d}:m.subtasks?{...m,subtasks:i(m.subtasks)}:m);return i(e)}};function Ji({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:n,endDate:s,zoom:o,locale:l="en",templates:d,dependencyLineStyle:i="curved",showTaskBarLabels:u=true,onTaskClick:m,onTaskDblClick:p,onTaskContextMenu:g,onTaskDateChange:f,onDependencyCreate:v,onDependencyDelete:y,showBaseline:b,showCriticalPath:h=true,showDependencies:x=true,highlightWeekends:w=true,canEditTask:N,onTaskProgressDrag:D,workingDaysConfig:A}){let E=Yr(),P=useRef(null),[k,K]=useState([]),[H,ee]=useState(null),[I,Y]=useState(null),[q,V]=useState(null),B=useRef(false),[X,Te]=useState(new Set),[He,z]=useState(null),te=useCallback(R=>{if(q&&!B.current){let J=R.target,O=false;for(;J&&J!==R.currentTarget;){if(J.getAttribute?.("data-dependency-line")==="true"||J.getAttribute?.("data-dependency-hover-overlay")==="true"){O=true;break}J=J.parentElement;}O||V(null);}},[q]),xe=useCallback(R=>{Y(R);},[]),je=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),Ne=r==="day"?60:r==="week"?20:8,ze=je*Ne*o,Me=R=>{let J=new Date(Date.UTC(R.getFullYear(),R.getMonth(),R.getDate())),O=J.getUTCDay()||7;J.setUTCDate(J.getUTCDate()+4-O);let Z=new Date(Date.UTC(J.getUTCFullYear(),0,1));return Math.ceil(((J.getTime()-Z.getTime())/864e5+1)/7)},at=R=>{let J=R.getDay();return J===0||J===6},be=useMemo(()=>{let R=A?.holidayDates;return R?R instanceof Set?R:new Set(R):null},[A?.holidayDates]),pt=R=>{if(!be)return false;let J=`${R.getFullYear()}-${String(R.getMonth()+1).padStart(2,"0")}-${String(R.getDate()).padStart(2,"0")}`;return be.has(J)},Ke=useCallback(R=>{let J=Math.round(R/(Ne*o)),O=new Date(n);return O.setDate(O.getDate()+J),O},[n,Ne,o]),Ue=useCallback((R,J)=>{if(J.startDate&&J.endDate)return;let O=R.currentTarget.ownerSVGElement;if(!O)return;let Z=O.createSVGPoint();Z.x=R.clientX,Z.y=R.clientY;let Ve=Z.matrixTransform(O.getScreenCTM()?.inverse()),ke=Ke(Ve.x),Re=new Date(ke);Re.setDate(Re.getDate()+1),z(null),f?.(J,ke,Re);},[Ke,f]),kt=useCallback((R,J,O)=>{let Z=R.currentTarget.ownerSVGElement;if(!Z)return;let Ve=Z.createSVGPoint();Ve.x=R.clientX,Ve.y=R.clientY;let ke=Ve.matrixTransform(Z.getScreenCTM()?.inverse()),Re=Ke(ke.x),Pe=Math.round(ke.x/(Ne*o))*Ne*o;z({taskId:J.id,x:Pe,y:O*a+a/2,date:Re});},[Ke,Ne,o,a]),Ht=useCallback(()=>{z(null);},[]),qe=useMemo(()=>{let R=Ve=>Ve.map(ke=>{if(ke.subtasks&&ke.subtasks.length>0){let Re=R(ke.subtasks),Ae=Re.filter(Pe=>Pe.startDate&&Pe.endDate);if(Ae.length>0){let Pe=Ae.map(mt=>mt.startDate.getTime()),ct=Ae.map(mt=>mt.endDate.getTime()),Qe=new Date(Math.min(...Pe)),st=new Date(Math.max(...ct));return {...ke,subtasks:Re,startDate:Qe,endDate:st}}return {...ke,subtasks:Re}}return ke}),J=(Ve,ke=[])=>{let Re=[...Ve].sort((Ae,Pe)=>(Ae.position??0)-(Pe.position??0));for(let Ae of Re)ke.push(Ae),Ae.subtasks&&Ae.subtasks.length>0&&(Ae.isExpanded===void 0||Ae.isExpanded)&&J(Ae.subtasks,ke);return ke},O=R(e);return J(O)},[e]),We=useCallback(R=>{if(!R.startDate||!R.endDate)return {x:0,width:0};let J=R.startDate.getTime(),O=R.endDate.getTime(),Z=n.getTime(),Ve=(J-Z)/(1e3*60*60*24),ke=(O-J)/(1e3*60*60*24)+1,Re=Ve*Ne*o,Ae=Math.max(Ne*o,40),Pe=Math.max(ke*Ne*o,Ae);return {x:Re,width:Pe}},[n,Ne,o]),ot=useMemo(()=>qe.filter(R=>R.startDate&&R.endDate).map(R=>{let{x:J,width:O}=We(R),Ve=qe.findIndex(ke=>ke.id===R.id)*a+(a-18)/2;return {id:R.id,x:J,y:Ve,width:O,height:18}}),[qe,We]),zt=useCallback((R,J,O)=>{if(!O){K([]),ee(null);return}if(ee({taskId:R,daysDelta:J}),J===0){K([]);return}let Z=Ie.calculateCascadePreview(e,R,J,qe,n,Ne*o,a,48);K(Z);},[e,qe,n,Ne,o,a,48]),Ee=useCallback((R,J)=>{if(!H)return J;let O=Ne*o,Z=H.daysDelta*O;if(R===H.taskId)return {x:J.x+Z,width:J.width};let Ve=k.find(ke=>ke.taskId===R);return Ve?{x:Ve.previewX,width:Ve.width}:J},[H,k,Ne,o]),nt=useMemo(()=>{let R=[],J=new Date(n);for(;J<=s;){let Ve=(J.getTime()-n.getTime())/864e5*Ne*o;if(r==="day")R.push({date:new Date(J),label:J.toLocaleDateString(l,{day:"numeric",month:"short"}),x:Ve}),J.setDate(J.getDate()+1);else if(r==="week"){let ke=Me(J);R.push({date:new Date(J),label:`${E.labels.week} ${ke}`,x:Ve}),J.setDate(J.getDate()+7);}else R.push({date:new Date(J),label:J.toLocaleDateString(l,{month:"short",year:"numeric"}),x:Ve}),J.setMonth(J.getMonth()+1);}return R},[n,s,r,Ne,o,l,E.labels.week]),F=useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*Ne*o,[n,Ne,o]),le=Math.max(qe.length*a,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(ze,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(ze,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),nt.map((R,J)=>jsxs("g",{children:[J>0&&jsx("line",{x1:R.x,y1:0,x2:R.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:R.x+8,y:48/2,fill:r==="day"&&!at(R.date)&&pt(R.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:R.label})]},`header-${J}`)),F>=0&&F<=ze&&jsxs("g",{children:[jsx("circle",{cx:F,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:F,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${F-18}, 2)`,children:[jsx("rect",{x:0,y:0,width:36,height:14,rx:2,fill:"rgba(0,0,0,0.8)",stroke:t.today,strokeWidth:.5,opacity:.8}),jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:E.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:P,width:Math.max(ze,1e3),height:le,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:te,children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#00E5CC",opacity:"0.18"}),jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsx("rect",{x:0,y:0,width:Math.max(ze,1e3),height:le,fill:t.bgPrimary}),qe.map((R,J)=>jsx("rect",{x:0,y:J*a,width:Math.max(ze,1e3),height:a,fill:J%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${R.id}`)),nt.map((R,J)=>J>0?jsx("line",{x1:R.x,y1:0,x2:R.x,y2:qe.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${J}`):null),nt.map((R,J)=>{let O=nt[J+1]?.x||ze,Z=w&&at(R.date),Ve=r==="day"&&!at(R.date)&&pt(R.date);return Z||Ve?jsxs("g",{children:[jsx("rect",{x:R.x,y:0,width:O-R.x,height:qe.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsx("rect",{x:R.x,y:0,width:O-R.x,height:qe.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${J}`):null}),qe.map((R,J)=>{let O=R.startDate&&R.endDate;return jsx("g",{children:!O&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:J*a,width:ze,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Z=>Ue(Z,R),onMouseMove:Z=>kt(Z,R,J),onMouseLeave:()=>{Ht();}},`clickable-${R.id}`),He&&He.taskId===R.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:He.x,y1:J*a+4,x2:He.x,y2:J*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:He.x,cy:He.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:He.x,cy:He.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${He.x}, ${J*a-8})`,children:[jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:He.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!He||He.taskId!==R.id)&&jsx("text",{x:F>0?F:100,y:J*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:E.labels.clickToSetDates},`placeholder-${R.id}`)]})},`row-group-${R.id}`)}),qe.map((R,J)=>{if(!R.startDate||!R.endDate)return null;let{x:O,width:Z}=We(R),Ve=J*a+(a-18)/2,ke=R.subtasks&&R.subtasks.length>0&&!R.isMilestone;if(R.isMilestone)return jsx(Xi,{task:R,x:O+Z/2,y:Ve+12,theme:t,onClick:m},R.id);if(ke){let Re=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),Ae=8,Pe=Ve+(a-18)/2+(18-Ae)/2,ct=4,Qe=R.progress||0,st=new Date;st.setHours(0,0,0,0);let mt=R.startDate&&st>=R.startDate,jt=R.endDate&&(()=>{let rt=new Date(R.endDate);return rt.setHours(0,0,0,0),st>rt})(),St=R.startDate&&st<R.startDate,Ut=1;if(mt&&R.startDate&&R.endDate&&!St){let rt=new Date(R.startDate);rt.setHours(0,0,0,0);let da=new Date(R.endDate);da.setHours(0,0,0,0);let ha=Math.max(1,(da.getTime()-rt.getTime())/(1e3*60*60*24)),ne=Math.min((st.getTime()-rt.getTime())/(1e3*60*60*24),ha)/ha*100;Ut=ne>0?Qe/ne:1;}let gt;Qe>=100?gt="#00E5CC":St?gt="#4B5563":jt&&Qe<100?gt="#EF4444":Ut>=.95?gt="#22C55E":Ut>=.8?gt="#F59E0B":gt="#EF4444";let Mt=Math.max(Qe/100*Z,Qe>0?ct*2:0),Bt=Z>100&&Qe>0,_t=R.isCriticalPath;return jsxs("g",{onClick:()=>m?.(R),onContextMenu:rt=>{rt.preventDefault(),rt.stopPropagation(),g?.(R,rt);},onMouseMove:rt=>{xe({task:R,x:O,y:Pe,width:Z,height:Ae,showBelow:Pe<100,mouseX:rt.clientX,mouseY:rt.clientY});},onMouseLeave:()=>xe(null),style:{cursor:"default",opacity:h?_t?1:.25:1,transition:"opacity 300ms ease"},children:[jsx("rect",{x:O,y:Ve,width:Z,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:O,y:Pe,width:Z,height:Ae,rx:ct,fill:Re?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),Qe>0&&jsx("rect",{x:O,y:Pe,width:Mt,height:Ae,rx:ct,fill:gt}),h&&_t&&jsx("rect",{x:O,y:Pe,width:Z,height:Ae,rx:ct,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Bt&&jsxs("text",{x:O+Mt+6,y:Pe+Ae/2,dominantBaseline:"central",fill:Re?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(Qe),"%"]})]},R.id)}return jsx(ji,{task:R,x:O,y:Ve,width:Z,theme:t,dayWidth:Ne*o,startDate:n,templates:d,onClick:m,onDoubleClick:p,onContextMenu:g,onDateChange:f,onDependencyCreate:v,allTaskPositions:ot,onDragMove:zt,onHoverChange:xe,showBaseline:b,showTaskBarLabels:u,showCriticalPath:h,readOnly:N?!N(R):false,onProgressChange:D},R.id)}),x&&qe.map((R,J)=>!R.dependencies||R.dependencies.length===0||!R.startDate||!R.endDate?null:R.dependencies.map(O=>{let Z=qe.find(gt=>gt.id===O);if(!Z||!Z.startDate||!Z.endDate)return null;let Ve=qe.findIndex(gt=>gt.id===O),ke=Ee(Z.id,We(Z)),Re=Ee(R.id,We(R)),Ae=ke.x+ke.width,Pe=Ve*a+26,ct=Re.x,Qe=J*a+26,st=`dep-${O}-${R.id}`;if(X.has(st))return null;let mt=h&&R.isCriticalPath&&Z.isCriticalPath;return jsx(zs,{x1:Ae,y1:Pe,x2:ct,y2:Qe,theme:t,lineStyle:i,colorOverride:h?mt?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:h?mt?2:1:void 0,glowFilter:mt?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>y?.(R.id,O),onHoverChange:gt=>{B.current=gt,gt&&V({key:st,fromId:O,toId:R.id,exitX:Ae,exitY:Pe,enterX:ct,enterY:Qe});}},st)})),k.map(R=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:R.previewX,y:R.y-48,width:R.width,height:18,rx:6,fill:R.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(R.daysDelta)>0&&jsx("text",{x:R.previewX+R.width/2,y:R.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:R.daysDelta>0?`+${R.daysDelta}d`:`${R.daysDelta}d`})]},`cascade-preview-${R.taskId}`)),x&&q&&jsx(zs,{x1:q.exitX,y1:q.exitY,x2:q.enterX,y2:q.enterY,theme:t,lineStyle:i,onDelete:()=>{let R=q.key;V(null),B.current=false,Te(J=>new Set(J).add(R)),y?.(q.toId,q.fromId);},hoverOverlayOnly:true,onHoverChange:R=>{B.current=R,R||V(null);}},`${q.key}-hover-overlay`),F>=0&&F<=ze&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:F,y1:0,x2:F,y2:le,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:F,y1:0,x2:F,y2:le,stroke:t.today,strokeWidth:1,opacity:1})]})]}),I&&jsx(Hm,{tooltipData:I,theme:t,locale:l==="es"?"es":"en",workingDaysConfig:A})]})}var jv=['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"'],Wm=({size:e=16})=>jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),_v=()=>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"})}),Kv=()=>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"})}),qv=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Yv=()=>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 el({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:l,onDependencyDelete:d}){let[i,u]=useState(false),[m,p]=useState(false),[g,f]=useState([]),[v,y]=useState(""),[b,h]=useState(false),[x,w]=useState(true),[N,D]=useState(""),[A,T]=useState(-1),[E,P]=useState(false),[k,K]=useState(0),H=useRef(null),ee=useRef(null),I=useRef(null),Y=useRef(null),{enabled:q=true,placeholder:V='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:X,suggestions:Te=jv,maxHistory:He=50,persistHistory:z,mentionableUsers:te=[]}=a,xe=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",je=xe?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Ne=xe?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",ze=xe?"0 0 20px rgba(0, 229, 204, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(0, 229, 204, 0.04)":"0 0 20px rgba(0, 229, 204, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",Me=xe?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",at=xe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",be=xe?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",pt=xe?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",Ke=xe?"rgba(0, 229, 204, 0.9)":"#00E5CC",Ue=xe?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",kt=xe?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Ht=xe?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 229, 204, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(0, 229, 204, 0.04)",qe=xe?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",We=xe?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",ot=xe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",zt=xe?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Ee=xe?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",nt=xe?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",F=xe?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",le=xe?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",R=xe?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",J="rgba(0, 229, 204, 0.04)",O=xe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",Z=xe?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ve=xe?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",ke=xe?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Re=xe?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",Ae=xe?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Pe=xe?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",ct=xe?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",Qe="rgba(0, 229, 204, 0.06)",st=xe?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",mt=xe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",jt=xe?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",St=xe?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Ut=xe?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",gt=xe?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Mt=xe?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Bt=xe?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",_t=xe?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Wt=xe?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",rt=xe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",da=xe?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",ha=xe?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",W=xe?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",ne=xe?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",ft=z?.storageKey||"gantt-ai-history",Tt=z?.maxMessages??5,pa=te.filter(U=>{if(!N)return true;let oe=N.toLowerCase();return U.name.toLowerCase().includes(oe)||U.email&&U.email.toLowerCase().includes(oe)}).slice(0,5),ce=useCallback(U=>{if(y(U),te.length===0)return;let oe=H.current;if(!oe)return;let Le=oe.selectionStart||U.length,C=U.slice(0,Le),$=C.lastIndexOf("@");if($>=0&&(($>0?C[$-1]:" ")===" "||$===0)){let De=C.slice($+1);if(De.length<=40){D(De),T($),P(true),K(0);return}}P(false),D(""),T(-1);},[te.length]),ve=useCallback(U=>{let oe=v.slice(0,A),Le=v.slice(A+1+N.length),C=`${oe}@${U.name} ${Le}`;y(C),P(false),D(""),T(-1),setTimeout(()=>H.current?.focus(),0);},[v,A,N]),Et=useCallback(U=>{if(!E||pa.length===0)return false;if(U.key==="ArrowDown")return U.preventDefault(),K(oe=>oe<pa.length-1?oe+1:0),true;if(U.key==="ArrowUp")return U.preventDefault(),K(oe=>oe>0?oe-1:pa.length-1),true;if(U.key==="Enter"||U.key==="Tab"){U.preventDefault();let oe=pa[k];return oe&&ve(oe),true}return U.key==="Escape"?(P(false),true):false},[E,pa,k,ve]);useEffect(()=>{if(z?.enabled)try{let U=localStorage.getItem(ft);if(U){let Le=JSON.parse(U).map(C=>({...C,timestamp:new Date(C.timestamp)}));f(Le.slice(-Tt));}}catch(U){console.warn("[GanttAIAssistant] Failed to load persisted history:",U);}},[z?.enabled,ft,Tt]),useEffect(()=>{if(z?.enabled&&g.length>0)try{let U=g.filter(oe=>!oe.isLoading).slice(-Tt);localStorage.setItem(ft,JSON.stringify(U));}catch(U){console.warn("[GanttAIAssistant] Failed to persist history:",U);}},[g,z?.enabled,ft,Tt]),useEffect(()=>{ee.current&&ee.current.scrollIntoView({behavior:"smooth"});},[g]),useEffect(()=>{i&&!m&&H.current&&setTimeout(()=>H.current?.focus(),100);},[i,m]);let it=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&&n?.(U.taskId,U.updates);break;case "create_task":U.newTask&&s?.(U.newTask);break;case "delete_task":U.taskId&&o?.(U.taskId);break;case "link_tasks":U.dependencyFrom&&U.dependencyTo&&l?.(U.dependencyFrom,U.dependencyTo);break;case "unlink_tasks":U.taskId&&U.dependencyFrom&&d?.(U.taskId,U.dependencyFrom);break}},[n,s,o,l,d]),wt=useCallback(async U=>{if(!U.trim()||b)return;let oe={id:`user-${Date.now()}`,role:"user",content:U,timestamp:new Date};f(C=>[...C.slice(-(He-1)),oe]),y(""),w(false),h(true);let Le={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(C=>[...C,Le]);try{if(X){let C=g.filter(fe=>!fe.isLoading&&fe.content).slice(-6).map(fe=>({role:fe.role,content:fe.content})),$=await X(U,e,C);f(fe=>{let De=fe.filter(ut=>!ut.isLoading),se={id:`assistant-${Date.now()}`,role:"assistant",content:$.message,timestamp:new Date,command:$};return [...De,se]}),it($);}else f(C=>[...C.filter(fe=>!fe.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(C){f($=>[...$.filter(De=>!De.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${C instanceof Error?C.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[b,He,X,e,it]),_=U=>{U.preventDefault(),wt(v);},ge=U=>{y(U),H.current?.focus();};if(useEffect(()=>{let U=oe=>{(oe.metaKey||oe.ctrlKey)&&oe.key==="k"&&(oe.preventDefault(),u(Le=>!Le),i||p(false)),oe.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[i]),useEffect(()=>{if(!i)return;let U=Le=>{let C=Le.target;I.current&&!I.current.contains(C)&&u(false);},oe=setTimeout(()=>{document.addEventListener("mousedown",U);},100);return ()=>{clearTimeout(oe),document.removeEventListener("mousedown",U);}},[i]),!q)return null;let ae={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxs(ra,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${ae[B]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:je,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Ne}`,color:"#00E5CC",cursor:"pointer",boxShadow:ze,overflow:"visible"},onClick:()=>u(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${Me}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${at}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(Wm,{size:18}),jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:Ke,background:be,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${pt}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
361
+ </Project>`,d=new Blob([i],{type:"application/xml;charset=utf-8;"}),u=document.createElement("a");u.href=URL.createObjectURL(d),u.download=r,u.click(),URL.revokeObjectURL(u.href);},calculateCriticalPath:e=>{let t=Ne.flattenTasks(e),r=t.filter(i=>i.startDate&&i.endDate);if(r.length===0)return [];let a=new Map,n=i=>{if(a.has(i.id))return;let d=i.startDate&&i.endDate?Ne.calculateDuration(i.startDate,i.endDate):0,u=0;if(i.dependencies&&i.dependencies.length>0)for(let m of i.dependencies){let f=t.find(x=>x.id===m);if(f){n(f);let x=a.get(m)?.ef||0;u=Math.max(u,x);}}let p=u+d;a.set(i.id,{es:u,ef:p});};r.forEach(n);let s=Math.max(...Array.from(a.values()).map(i=>i.ef)),o=new Map,c=i=>{if(o.has(i.id))return;let d=i.startDate&&i.endDate?Ne.calculateDuration(i.startDate,i.endDate):0,u=t.filter(f=>f.dependencies&&f.dependencies.includes(i.id)),p=s;if(u.length>0)for(let f of u){c(f);let x=o.get(f.id)?.ls||0;p=Math.min(p,x);}let m=p-d;o.set(i.id,{ls:m,lf:p});};r.forEach(c);let l=[];for(let i of r){let d=a.get(i.id),u=o.get(i.id);if(d&&u){let p=u.ls-d.es;Math.abs(p)<.01&&l.push(i.id);}}return l},calculateCriticalPathFull:e=>{let t=new Map,a=Ne.flattenTasks(e).filter(p=>p.startDate&&p.endDate);if(a.length===0)return t;let n=new Map(a.map(p=>[p.id,p])),s=new Map;for(let p of a)s.has(p.id)||s.set(p.id,[]);for(let p of a)if(p.dependencies){for(let m of p.dependencies)if(n.has(m)){let f=s.get(m);f&&f.push(p.id);}}let o=new Map;for(let p of a)o.set(p.id,0);for(let p of a)if(p.dependencies)for(let m of p.dependencies)n.has(m)&&o.set(p.id,(o.get(p.id)||0)+1);let c=new Map,l=[],i=[];for(let p of a)(o.get(p.id)||0)===0&&i.push(p.id);for(;i.length>0;){let p=i.shift();l.push(p);let m=n.get(p);if(!m||!m.startDate||!m.endDate)continue;let f=Ne.calculateDuration(m.startDate,m.endDate),x=0;if(m.dependencies)for(let b of m.dependencies){let h=c.get(b);h&&(x=Math.max(x,h.ef));}c.set(p,{es:x,ef:x+f});let y=s.get(p)||[];for(let b of y){let h=(o.get(b)||1)-1;o.set(b,h),h===0&&i.push(b);}}if(l.length<a.length)return t;let d=Math.max(...Array.from(c.values()).map(p=>p.ef)),u=new Map;for(let p=l.length-1;p>=0;p--){let m=l[p];if(!m)continue;let f=n.get(m);if(!f||!f.startDate||!f.endDate)continue;let x=Ne.calculateDuration(f.startDate,f.endDate),y=s.get(m)||[],b=d;if(y.length>0)for(let h of y){let v=u.get(h);v&&(b=Math.min(b,v.ls));}u.set(m,{ls:b-x,lf:b});}for(let p of l){let m=c.get(p),f=u.get(p),x=f.ls-m.es,y=s.get(p)||[],b;y.length>0?b=Math.min(...y.map(h=>c.get(h).es))-m.ef:b=d-m.ef,t.set(p,{earlyStart:m.es,earlyFinish:m.ef,lateStart:f.ls,lateFinish:f.lf,totalFloat:Math.round(x*100)/100,freeFloat:Math.max(0,Math.round(b*100)/100),isCritical:x<=.01});}return t},calculateSlack:(e,t)=>{let r=Ne.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return null;if(Ne.calculateCriticalPath(e).includes(t))return 0;let n=Ne.getDependentTasks(e,t);if(n.length===0){let c=Ne.getLatestEndDate(e);if(!c)return null;let l=Ne.calculateDuration(r.endDate,c);return Math.max(0,l)}let s=n.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,l)=>c-l)[0];if(!s)return null;let o=Ne.calculateDuration(r.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>Ne.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,r,a)=>{let n=a||new Set;if(n.has(t))return e;n.add(t);let s=Ne.findTaskById(e,t);if(!s||!s.endDate)return e;let o=Ne.getDependentTasks(e,t);if(o.length===0)return e;let c=[...e];for(let l of o){if(n.has(l.id)||!l.startDate||!l.endDate)continue;let i=Ne.calculateDuration(l.startDate,l.endDate),d;if(r!==void 0?(d=new Date(l.startDate),d.setDate(d.getDate()+r)):(d=new Date(s.endDate),d.setDate(d.getDate()+1)),r!==void 0){let m=new Date(s.endDate),f=new Date(m);f.setDate(f.getDate()+1),d<f&&(d=f);}let u=Ne.calculateEndDate(d,i),p=m=>m.map(f=>f.id===l.id?{...f,startDate:d,endDate:u}:f.subtasks?{...f,subtasks:p(f.subtasks)}:f);c=p(c),c=Ne.autoScheduleDependents(c,l.id,r,n);}return c},calculateCascadePreview:(e,t,r,a,n,s,o,c)=>{if(r===0)return [];let l=[],i=n.getTime(),d=1e3*60*60*24,u=Ne.findTaskById(e,t);if(!u||!u.endDate)return [];let p=(m,f,x=new Set)=>{if(x.has(m))return;x.add(m);let y=Ne.getDependentTasks(e,m);for(let b of y){if(!b.startDate||!b.endDate)continue;let h=a.findIndex(N=>N.id===b.id);if(h===-1)continue;let v=b.startDate.getTime(),T=(b.endDate.getTime()-v)/d,F=(v-i)/d*s,k=F+f*s,D=Math.max(T*s,s),P=c+h*o+(o-18)/2;l.push({taskId:b.id,taskName:b.name,originalX:F,previewX:k,width:D,y:P,rowIndex:h,daysDelta:f,color:b.color}),p(b.id,f,x);}};return p(t,r),l},splitTask:(e,t,r,a=3)=>{let n=Ne.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(r<=n.startDate||r>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(r);s.setDate(s.getDate()-1);let o=new Date(r);o.setDate(o.getDate()+a);let c=new Date(n.endDate);c.setDate(c.getDate()+a);let l=[{startDate:new Date(n.startDate),endDate:s},{startDate:o,endDate:c}],i=d=>d.map(u=>u.id===n.id?{...u,endDate:c,segments:l}:u.subtasks?{...u,subtasks:i(u.subtasks)}:u);return i(e)}};function al({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:s,zoom:o,locale:c="en",templates:l,dependencyLineStyle:i="curved",showTaskBarLabels:d=true,onTaskClick:u,onTaskDblClick:p,onTaskContextMenu:m,onTaskDateChange:f,onDependencyCreate:x,onDependencyDelete:y,showBaseline:b,showCriticalPath:h=true,showDependencies:v=true,highlightWeekends:w=true,canEditTask:T,onTaskProgressDrag:E,workingDaysConfig:F}){let D=_a(),P=useRef(null),[N,K]=useState([]),[H,te]=useState(null),[I,_]=useState(null),[j,W]=useState(null),B=useRef(false),[ve,We]=useState(new Set),[Le,be]=useState(null),ge=useCallback(R=>{if(j&&!B.current){let q=R.target,U=false;for(;q&&q!==R.currentTarget;){if(q.getAttribute?.("data-dependency-line")==="true"||q.getAttribute?.("data-dependency-hover-overlay")==="true"){U=true;break}q=q.parentElement;}U||W(null);}},[j]),ye=useCallback(R=>{_(R);},[]),ze=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),ke=a==="day"?60:a==="week"?20:8,Ie=ze*ke*o,De=R=>{let q=new Date(Date.UTC(R.getFullYear(),R.getMonth(),R.getDate())),U=q.getUTCDay()||7;q.setUTCDate(q.getUTCDate()+4-U);let X=new Date(Date.UTC(q.getUTCFullYear(),0,1));return Math.ceil(((q.getTime()-X.getTime())/864e5+1)/7)},qe=R=>{let q=R.getDay();return q===0||q===6},fe=useMemo(()=>{let R=F?.holidayDates;return R?R instanceof Set?R:new Set(R):null},[F?.holidayDates]),tt=R=>{if(!fe)return false;let q=`${R.getFullYear()}-${String(R.getMonth()+1).padStart(2,"0")}-${String(R.getDate()).padStart(2,"0")}`;return fe.has(q)},Be=useCallback(R=>{let q=Math.round(R/(ke*o)),U=new Date(n);return U.setDate(U.getDate()+q),U},[n,ke,o]),$e=useCallback((R,q)=>{if(q.startDate&&q.endDate)return;let U=R.currentTarget.ownerSVGElement;if(!U)return;let X=U.createSVGPoint();X.x=R.clientX,X.y=R.clientY;let Se=X.matrixTransform(U.getScreenCTM()?.inverse()),de=Be(Se.x),et=new Date(de);et.setDate(et.getDate()+1),be(null),f?.(q,de,et);},[Be,f]),gt=useCallback((R,q,U)=>{let X=R.currentTarget.ownerSVGElement;if(!X)return;let Se=X.createSVGPoint();Se.x=R.clientX,Se.y=R.clientY;let de=Se.matrixTransform(X.getScreenCTM()?.inverse()),et=Be(de.x),Qe=Math.round(de.x/(ke*o))*ke*o;be({taskId:q.id,x:Qe,y:U*r+r/2,date:et});},[Be,ke,o,r]),Ft=useCallback(()=>{be(null);},[]),He=useMemo(()=>{let R=Se=>Se.map(de=>{if(de.subtasks&&de.subtasks.length>0){let et=R(de.subtasks),rt=et.filter(Qe=>Qe.startDate&&Qe.endDate);if(rt.length>0){let Qe=rt.map(Gt=>Gt.startDate.getTime()),At=rt.map(Gt=>Gt.endDate.getTime()),kt=new Date(Math.min(...Qe)),jt=new Date(Math.max(...At));return {...de,subtasks:et,startDate:kt,endDate:jt}}return {...de,subtasks:et}}return de}),q=(Se,de=[])=>{let et=[...Se].sort((rt,Qe)=>(rt.position??0)-(Qe.position??0));for(let rt of et)de.push(rt),rt.subtasks&&rt.subtasks.length>0&&(rt.isExpanded===void 0||rt.isExpanded)&&q(rt.subtasks,de);return de},U=R(e);return q(U)},[e]),Ae=useCallback(R=>{if(!R.startDate||!R.endDate)return {x:0,width:0};let q=R.startDate.getTime(),U=R.endDate.getTime(),X=n.getTime(),Se=(q-X)/(1e3*60*60*24),de=(U-q)/(1e3*60*60*24)+1,et=Se*ke*o,rt=Math.max(ke*o,40),Qe=Math.max(de*ke*o,rt);return {x:et,width:Qe}},[n,ke,o]),ot=useMemo(()=>He.filter(R=>R.startDate&&R.endDate).map(R=>{let{x:q,width:U}=Ae(R),Se=He.findIndex(de=>de.id===R.id)*r+(r-18)/2;return {id:R.id,x:q,y:Se,width:U,height:18}}),[He,Ae]),Lt=useCallback((R,q,U)=>{if(!U){K([]),te(null);return}if(te({taskId:R,daysDelta:q}),q===0){K([]);return}let X=Ne.calculateCascadePreview(e,R,q,He,n,ke*o,r,48);K(X);},[e,He,n,ke,o,r,48]),Fe=useCallback((R,q)=>{if(!H)return q;let U=ke*o,X=H.daysDelta*U;if(R===H.taskId)return {x:q.x+X,width:q.width};let Se=N.find(de=>de.taskId===R);return Se?{x:Se.previewX,width:Se.width}:q},[H,N,ke,o]),Xe=useMemo(()=>{let R=[],q=new Date(n);for(;q<=s;){let Se=(q.getTime()-n.getTime())/864e5*ke*o;if(a==="day")R.push({date:new Date(q),label:q.toLocaleDateString(c,{day:"numeric",month:"short"}),x:Se}),q.setDate(q.getDate()+1);else if(a==="week"){let de=De(q);R.push({date:new Date(q),label:`${D.labels.week} ${de}`,x:Se}),q.setDate(q.getDate()+7);}else R.push({date:new Date(q),label:q.toLocaleDateString(c,{month:"short",year:"numeric"}),x:Se}),q.setMonth(q.getMonth()+1);}return R},[n,s,a,ke,o,c,D.labels.week]),L=useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*ke*o,[n,ke,o]),ae=Math.max(He.length*r,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(Ie,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(Ie,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),Xe.map((R,q)=>jsxs("g",{children:[q>0&&jsx("line",{x1:R.x,y1:0,x2:R.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:R.x+8,y:48/2,fill:a==="day"&&!qe(R.date)&&tt(R.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:R.label})]},`header-${q}`)),L>=0&&L<=Ie&&jsxs("g",{children:[jsx("circle",{cx:L,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:L,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${L-18}, 2)`,children:[jsx("rect",{x:0,y:0,width:36,height:14,rx:2,fill:"rgba(0,0,0,0.8)",stroke:t.today,strokeWidth:.5,opacity:.8}),jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:D.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:P,width:Math.max(Ie,1e3),height:ae,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:ge,children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#00E5CC",opacity:"0.18"}),jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsx("rect",{x:0,y:0,width:Math.max(Ie,1e3),height:ae,fill:t.bgPrimary}),He.map((R,q)=>jsx("rect",{x:0,y:q*r,width:Math.max(Ie,1e3),height:r,fill:q%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${R.id}`)),Xe.map((R,q)=>q>0?jsx("line",{x1:R.x,y1:0,x2:R.x,y2:He.length*r,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${q}`):null),Xe.map((R,q)=>{let U=Xe[q+1]?.x||Ie,X=w&&qe(R.date),Se=a==="day"&&!qe(R.date)&&tt(R.date);return X||Se?jsxs("g",{children:[jsx("rect",{x:R.x,y:0,width:U-R.x,height:He.length*r,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsx("rect",{x:R.x,y:0,width:U-R.x,height:He.length*r,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${q}`):null}),He.map((R,q)=>{let U=R.startDate&&R.endDate;return jsx("g",{children:!U&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:q*r,width:Ie,height:r,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:X=>$e(X,R),onMouseMove:X=>gt(X,R,q),onMouseLeave:()=>{Ft();}},`clickable-${R.id}`),Le&&Le.taskId===R.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:Le.x,y1:q*r+4,x2:Le.x,y2:q*r+r-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:Le.x,cy:Le.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:Le.x,cy:Le.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${Le.x}, ${q*r-8})`,children:[jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:Le.date.toLocaleDateString(c==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!Le||Le.taskId!==R.id)&&jsx("text",{x:L>0?L:100,y:q*r+r/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:D.labels.clickToSetDates},`placeholder-${R.id}`)]})},`row-group-${R.id}`)}),He.map((R,q)=>{if(!R.startDate||!R.endDate)return null;let{x:U,width:X}=Ae(R),Se=q*r+(r-18)/2,de=R.subtasks&&R.subtasks.length>0&&!R.isMilestone;if(R.isMilestone)return jsx(rl,{task:R,x:U+X/2,y:Se+12,theme:t,onClick:u},R.id);if(de){let et=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),rt=8,Qe=Se+(r-18)/2+(18-rt)/2,At=4,kt=R.progress||0,jt=new Date;jt.setHours(0,0,0,0);let Gt=R.startDate&&jt>=R.startDate,or=R.endDate&&(()=>{let tr=new Date(R.endDate);return tr.setHours(0,0,0,0),jt>tr})(),br=R.startDate&&jt<R.startDate,da=1;if(Gt&&R.startDate&&R.endDate&&!br){let tr=new Date(R.startDate);tr.setHours(0,0,0,0);let kr=new Date(R.endDate);kr.setHours(0,0,0,0);let oa=Math.max(1,(kr.getTime()-tr.getTime())/(1e3*60*60*24)),Ye=Math.min((jt.getTime()-tr.getTime())/(1e3*60*60*24),oa)/oa*100;da=Ye>0?kt/Ye:1;}let qt;kt>=100?qt="#00E5CC":br?qt="#4B5563":or&&kt<100?qt="#EF4444":da>=.95?qt="#22C55E":da>=.8?qt="#F59E0B":qt="#EF4444";let gr=Math.max(kt/100*X,kt>0?At*2:0),St=X>100&&kt>0,Lr=R.isCriticalPath;return jsxs("g",{onClick:()=>u?.(R),onContextMenu:tr=>{tr.preventDefault(),tr.stopPropagation(),m?.(R,tr);},onMouseMove:tr=>{ye({task:R,x:U,y:Qe,width:X,height:rt,showBelow:Qe<100,mouseX:tr.clientX,mouseY:tr.clientY});},onMouseLeave:()=>ye(null),style:{cursor:"default",opacity:h?Lr?1:.25:1,transition:"opacity 300ms ease"},children:[jsx("rect",{x:U,y:Se,width:X,height:r,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:U,y:Qe,width:X,height:rt,rx:At,fill:et?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),kt>0&&jsx("rect",{x:U,y:Qe,width:gr,height:rt,rx:At,fill:qt}),h&&Lr&&jsx("rect",{x:U,y:Qe,width:X,height:rt,rx:At,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),St&&jsxs("text",{x:U+gr+6,y:Qe+rt/2,dominantBaseline:"central",fill:et?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(kt),"%"]})]},R.id)}return jsx(Ji,{task:R,x:U,y:Se,width:X,theme:t,dayWidth:ke*o,startDate:n,templates:l,onClick:u,onDoubleClick:p,onContextMenu:m,onDateChange:f,onDependencyCreate:x,allTaskPositions:ot,onDragMove:Lt,onHoverChange:ye,showBaseline:b,showTaskBarLabels:d,showCriticalPath:h,readOnly:T?!T(R):false,onProgressChange:E},R.id)}),v&&He.map((R,q)=>!R.dependencies||R.dependencies.length===0||!R.startDate||!R.endDate?null:R.dependencies.map(U=>{let X=He.find(qt=>qt.id===U);if(!X||!X.startDate||!X.endDate)return null;let Se=He.findIndex(qt=>qt.id===U),de=Fe(X.id,Ae(X)),et=Fe(R.id,Ae(R)),rt=de.x+de.width,Qe=Se*r+26,At=et.x,kt=q*r+26,jt=`dep-${U}-${R.id}`;if(ve.has(jt))return null;let Gt=h&&R.isCriticalPath&&X.isCriticalPath;return jsx(Ks,{x1:rt,y1:Qe,x2:At,y2:kt,theme:t,lineStyle:i,colorOverride:h?Gt?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:h?Gt?2:1:void 0,glowFilter:Gt?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>y?.(R.id,U),onHoverChange:qt=>{B.current=qt,qt&&W({key:jt,fromId:U,toId:R.id,exitX:rt,exitY:Qe,enterX:At,enterY:kt});}},jt)})),N.map(R=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:R.previewX,y:R.y-48,width:R.width,height:18,rx:6,fill:R.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(R.daysDelta)>0&&jsx("text",{x:R.previewX+R.width/2,y:R.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:R.daysDelta>0?`+${R.daysDelta}d`:`${R.daysDelta}d`})]},`cascade-preview-${R.taskId}`)),v&&j&&jsx(Ks,{x1:j.exitX,y1:j.exitY,x2:j.enterX,y2:j.enterY,theme:t,lineStyle:i,onDelete:()=>{let R=j.key;W(null),B.current=false,We(q=>new Set(q).add(R)),y?.(j.toId,j.fromId);},hoverOverlayOnly:true,onHoverChange:R=>{B.current=R,R||W(null);}},`${j.key}-hover-overlay`),L>=0&&L<=Ie&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:L,y1:0,x2:L,y2:ae,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:L,y1:0,x2:L,y2:ae,stroke:t.today,strokeWidth:1,opacity:1})]})]}),I&&jsx(Wm,{tooltipData:I,theme:t,locale:c==="es"?"es":"en",workingDaysConfig:F})]})}var aw=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],Vm=({size:e=16})=>jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),nw=()=>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"})}),ow=()=>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"})}),sw=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),iw=()=>jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsx(motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function sl({tasks:e,theme:t,config:r,onTasksUpdate:a,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:c,onDependencyDelete:l}){let[i,d]=useState(false),[u,p]=useState(false),[m,f]=useState([]),[x,y]=useState(""),[b,h]=useState(false),[v,w]=useState(true),[T,E]=useState(""),[F,k]=useState(-1),[D,P]=useState(false),[N,K]=useState(0),H=useRef(null),te=useRef(null),I=useRef(null),_=useRef(null),{enabled:j=true,placeholder:W='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:ve,suggestions:We=aw,maxHistory:Le=50,persistHistory:be,mentionableUsers:ge=[]}=r,ye=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",ze=ye?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",ke=ye?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",Ie=ye?"0 0 20px rgba(0, 229, 204, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(0, 229, 204, 0.04)":"0 0 20px rgba(0, 229, 204, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",De=ye?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",qe=ye?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",fe=ye?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",tt=ye?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",Be=ye?"rgba(0, 229, 204, 0.9)":"#00E5CC",$e=ye?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",gt=ye?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Ft=ye?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 229, 204, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(0, 229, 204, 0.04)",He=ye?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",Ae=ye?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",ot=ye?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",Lt=ye?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Fe=ye?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",Xe=ye?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",L=ye?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",ae=ye?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",R=ye?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",q="rgba(0, 229, 204, 0.04)",U=ye?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",X=ye?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Se=ye?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",de=ye?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",et=ye?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",rt=ye?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Qe=ye?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",At=ye?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",kt="rgba(0, 229, 204, 0.06)",jt=ye?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",Gt=ye?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",or=ye?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",br=ye?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",da=ye?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",qt=ye?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",gr=ye?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",St=ye?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Lr=ye?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Yt=ye?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",tr=ye?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",kr=ye?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",oa=ye?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Ze=ye?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Ye=ye?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",ua=be?.storageKey||"gantt-ai-history",Xt=be?.maxMessages??5,Zr=ge.filter(O=>{if(!T)return true;let Z=T.toLowerCase();return O.name.toLowerCase().includes(Z)||O.email&&O.email.toLowerCase().includes(Z)}).slice(0,5),ne=useCallback(O=>{if(y(O),ge.length===0)return;let Z=H.current;if(!Z)return;let Te=Z.selectionStart||O.length,C=O.slice(0,Te),$=C.lastIndexOf("@");if($>=0&&(($>0?C[$-1]:" ")===" "||$===0)){let xe=C.slice($+1);if(xe.length<=40){E(xe),k($),P(true),K(0);return}}P(false),E(""),k(-1);},[ge.length]),pe=useCallback(O=>{let Z=x.slice(0,F),Te=x.slice(F+1+T.length),C=`${Z}@${O.name} ${Te}`;y(C),P(false),E(""),k(-1),setTimeout(()=>H.current?.focus(),0);},[x,F,T]),pt=useCallback(O=>{if(!D||Zr.length===0)return false;if(O.key==="ArrowDown")return O.preventDefault(),K(Z=>Z<Zr.length-1?Z+1:0),true;if(O.key==="ArrowUp")return O.preventDefault(),K(Z=>Z>0?Z-1:Zr.length-1),true;if(O.key==="Enter"||O.key==="Tab"){O.preventDefault();let Z=Zr[N];return Z&&pe(Z),true}return O.key==="Escape"?(P(false),true):false},[D,Zr,N,pe]);useEffect(()=>{if(be?.enabled)try{let O=localStorage.getItem(ua);if(O){let Te=JSON.parse(O).map(C=>({...C,timestamp:new Date(C.timestamp)}));f(Te.slice(-Xt));}}catch(O){console.warn("[GanttAIAssistant] Failed to load persisted history:",O);}},[be?.enabled,ua,Xt]),useEffect(()=>{if(be?.enabled&&m.length>0)try{let O=m.filter(Z=>!Z.isLoading).slice(-Xt);localStorage.setItem(ua,JSON.stringify(O));}catch(O){console.warn("[GanttAIAssistant] Failed to persist history:",O);}},[m,be?.enabled,ua,Xt]),useEffect(()=>{te.current&&te.current.scrollIntoView({behavior:"smooth"});},[m]),useEffect(()=>{i&&!u&&H.current&&setTimeout(()=>H.current?.focus(),100);},[i,u]);let je=useCallback(O=>{if(O.success)switch(O.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":O.taskId&&O.updates&&n?.(O.taskId,O.updates);break;case "create_task":O.newTask&&s?.(O.newTask);break;case "delete_task":O.taskId&&o?.(O.taskId);break;case "link_tasks":O.dependencyFrom&&O.dependencyTo&&c?.(O.dependencyFrom,O.dependencyTo);break;case "unlink_tasks":O.taskId&&O.dependencyFrom&&l?.(O.taskId,O.dependencyFrom);break}},[n,s,o,c,l]),it=useCallback(async O=>{if(!O.trim()||b)return;let Z={id:`user-${Date.now()}`,role:"user",content:O,timestamp:new Date};f(C=>[...C.slice(-(Le-1)),Z]),y(""),w(false),h(true);let Te={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(C=>[...C,Te]);try{if(ve){let C=m.filter(ce=>!ce.isLoading&&ce.content).slice(-6).map(ce=>({role:ce.role,content:ce.content})),$=await ve(O,e,C);f(ce=>{let xe=ce.filter(Je=>!Je.isLoading),ee={id:`assistant-${Date.now()}`,role:"assistant",content:$.message,timestamp:new Date,command:$};return [...xe,ee]}),je($);}else f(C=>[...C.filter(ce=>!ce.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(C){f($=>[...$.filter(xe=>!xe.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${C instanceof Error?C.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[b,Le,ve,e,je]),V=O=>{O.preventDefault(),it(x);},le=O=>{y(O),H.current?.focus();};if(useEffect(()=>{let O=Z=>{(Z.metaKey||Z.ctrlKey)&&Z.key==="k"&&(Z.preventDefault(),d(Te=>!Te),i||p(false)),Z.key==="Escape"&&i&&d(false);};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[i]),useEffect(()=>{if(!i)return;let O=Te=>{let C=Te.target;I.current&&!I.current.contains(C)&&d(false);},Z=setTimeout(()=>{document.addEventListener("mousedown",O);},100);return ()=>{clearTimeout(Z),document.removeEventListener("mousedown",O);}},[i]),!j)return null;let J={"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(lr,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${J[B]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:ze,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${ke}`,color:"#00E5CC",cursor:"pointer",boxShadow:Ie,overflow:"visible"},onClick:()=>d(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${De}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${qe}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(Vm,{size:18}),jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:Be,background:fe,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${tt}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
362
362
  @keyframes ai-fab-pulse {
363
363
  0%, 100% { transform: scale(1); opacity: 0.4; }
364
364
  50% { transform: scale(1.15); opacity: 0; }
365
365
  }
366
- `})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:I,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:m?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${ae[B]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:Ue,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${kt}`,boxShadow:Ht},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:qe,borderBottom:`1px solid ${We}`},children:[jsxs("div",{className:"flex items-center gap-2.5",children:[jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:ot,border:`1px solid ${zt}`,color:"#00E5CC"},children:jsx(Wm,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Ee},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>p(U=>!U),className:"p-1.5 rounded-lg transition-colors",style:{color:nt},onMouseEnter:U=>{U.currentTarget.style.background=le,U.currentTarget.style.color=F;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=nt;},children:jsx(qv,{})}),jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg transition-colors",style:{color:nt},onMouseEnter:U=>{U.currentTarget.style.background=le,U.currentTarget.style.color=F;},onMouseLeave:U=>{U.currentTarget.style.background="transparent",U.currentTarget.style.color=nt;},children:jsx(Kv,{})})]})]}),jsx(AnimatePresence,{children:!m&&jsxs(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[g.length===0&&x&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:R,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:Te.slice(0,4).map((U,oe)=>jsx("button",{onClick:()=>ge(U),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:J,color:Z,border:`1px solid ${O}`},onMouseEnter:Le=>{Le.currentTarget.style.borderColor=Ve,Le.currentTarget.style.color="#00E5CC";},onMouseLeave:Le=>{Le.currentTarget.style.borderColor=O,Le.currentTarget.style.color=Z;},children:U.length>30?U.slice(0,30)+"...":U},oe))})]}),g.map(U=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${U.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${U.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:U.role==="user"?ke:Ae,color:U.role==="user"?"#00E5CC":ct,border:U.role==="user"?`1px solid ${Re}`:`1px solid ${Pe}`},children:[U.isLoading?jsx(Yv,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:U.content}),U.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:U.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:U.command.success?"#10B981":"#EF4444",border:`1px solid ${U.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[U.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:U.command.type.replace(/_/g," ")})]})]})},U.id)),jsx("div",{ref:ee})]}),jsxs("form",{onSubmit:U=>{if(E&&pa.length>0){U.preventDefault();return}_(U);},className:"p-3 relative",style:{borderTop:`1px solid ${Qe}`},children:[jsx(AnimatePresence,{children:E&&pa.length>0&&jsx(motion.div,{ref:Y,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:Bt,border:`1px solid ${_t}`,boxShadow:Wt,backdropFilter:"blur(12px)"},children:pa.map((U,oe)=>jsxs("button",{type:"button",onClick:()=>ve(U),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:oe===k?rt:"transparent",color:da},onMouseEnter:()=>K(oe),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:W,border:`1px solid ${ne}`,color:"#00E5CC"},children:U.name.split(" ").map(Le=>Le[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:U.name}),U.email&&jsx("div",{className:"text-xs truncate",style:{color:ha},children:U.email})]})]},U.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:st,border:`1px solid ${mt}`},children:[jsx("input",{ref:H,type:"text",value:v,onChange:U=>ce(U.target.value),onKeyDown:U=>{Et(U);},placeholder:V,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:jt,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!v.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:v.trim()?St:"transparent",color:v.trim()?"#00E5CC":gt,border:v.trim()?`1px solid ${Ut}`:"1px solid transparent"},children:jsx(_v,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Mt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function Vm(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),n=useRef(false),s=useCallback((i,u=true)=>{r(m=>{let p=typeof i=="function"?i(m.present):i;if(n.current)return {...m,present:p};if(!u)return {...m,present:p};let g=[...m.past,m.present];return g.length>t&&g.shift(),{past:g,present:p,future:[]}});},[t]),o=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],m=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:m,present:u,future:[i.present,...i.future]}});},[]),l=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],m=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:u,future:m}});},[]),d=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:o,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:d}}function Gm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:n=true}){useEffect(()=>{if(!n)return;let s=o=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,d=l?o.metaKey:o.ctrlKey;if(d&&o.key==="z"&&!o.shiftKey&&a){o.preventDefault(),e();return}if(r){if(!l&&d&&o.key==="y"){o.preventDefault(),t();return}if(l&&d&&o.shiftKey&&o.key==="z"){o.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,n]);}var Zv={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Ie.formatDate(e.startDate)} - ${Ie.formatDate(e.endDate)}`);let a=Ie.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=>Ie.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function jm(e){return {...Zv,...e}}var i2=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Ym=forwardRef(function({tasks:t,config:a={},onTasksChange:r},n){let{theme:s,timeScale:o="week",rowDensity:l="comfortable",showThemeSelector:d=true,showExportButton:i=true,onExportSuccess:u,projectName:m,availableUsers:p=[],templates:g,enableAutoCriticalPath:f=true,persistExpandedState:v,persistFilter:y,persistColumns:b,clearFiltersKey:h,aiAssistant:x,locale:w="en",customTranslations:N,showCreateTaskButton:D=false,createTaskLabel:A,onCreateTask:T,taskFilter:E,onTaskFilterChange:P,toolbarRightContent:k,showBaseline:K,viewMode:H,onViewModeChange:ee,projectForecast:I,onThemeChange:Y,onTaskClick:q,onTaskDblClick:V,onTaskContextMenu:B,onTaskUpdate:X,onDependentTasksScheduled:Te,onProgressChange:He,onTaskEdit:z,onTaskAddSubtask:te,onTaskMarkIncomplete:xe,onTaskSetInProgress:je,onDependencyCreate:Ne,onDependencyDelete:ze,onBeforeTaskAdd:Me,onAfterTaskAdd:at,onBeforeTaskUpdate:be,onAfterTaskUpdate:pt,onBeforeTaskDelete:Ke,onAfterTaskDelete:Ue,permissions:kt,onCopySnapshotLink:Ht}=a,We=useContext(Hi)?.theme,[ot,zt]=useState(We||s||"dark"),[Ee,nt]=useState(o),[F,le]=useState(l),[R,J]=useState(1),[O,Z]=useState("all"),[Ve,ke]=useState(H||"execution"),Re=H??Ve,Ae=useCallback(M=>{ke(M),ee?.(M);},[ee]),Pe=K??Re==="oracle",[ct,Qe]=useState(a.showCriticalPath!==false),[st,mt]=useState(a.showDependencies!==false),[jt,St]=useState(a.highlightWeekends!==false),Ut=useCallback(M=>{Qe(M),a.onShowCriticalPathChange?.(M);},[a.onShowCriticalPathChange]),gt=useCallback(M=>{mt(M),a.onShowDependenciesChange?.(M);},[a.onShowDependenciesChange]),Mt=useCallback(M=>{St(M),a.onHighlightWeekendsChange?.(M);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(Ee);},[Ee]),useEffect(()=>{a.onZoomChange?.(R);},[R]);let Bt=useRef(a.onDateRangeChange);Bt.current=a.onDateRangeChange;let _t=useCallback(()=>y?typeof y=="string"?y:"gantt-filter-state":null,[y]),[Wt,rt]=useState(()=>{if(!y)return "all";try{let M=typeof y=="string"?y:"gantt-filter-state",L=localStorage.getItem(M);if(L){let G=JSON.parse(L);if(G.taskFilter)return G.taskFilter}}catch(M){console.warn("[GanttBoard] Error loading filter state from localStorage:",M);}return "all"}),da=E??Wt,ha=P??rt,[W,ne]=useState(()=>{if(!y)return false;try{let M=typeof y=="string"?y:"gantt-filter-state",L=localStorage.getItem(M);if(L){let G=JSON.parse(L);if(typeof G.hideCompleted=="boolean")return G.hideCompleted}}catch(M){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",M);}return false});useEffect(()=>{let M=_t();if(M)try{let L={taskFilter:da,hideCompleted:W};localStorage.setItem(M,JSON.stringify(L));}catch(L){console.warn("[GanttBoard] Error saving filter state to localStorage:",L);}},[da,W,_t]);let ft=useRef(h);useEffect(()=>{if(ft.current!==h&&h!==void 0){rt("all"),ne(false);let M=_t();if(M)try{localStorage.removeItem(M);}catch(L){console.warn("[GanttBoard] Error clearing filter state from localStorage:",L);}}ft.current=h;},[h,_t]);let[Tt,pa]=useState(0),[ce,ve]=useState(false),[Et,it]=useState(null),[wt,_]=useState({isOpen:false,x:0,y:0,task:null}),[ge,ae]=useState(null),[U,oe]=useState(null);useEffect(()=>{We&&We!==ot&&zt(We);},[We]),useEffect(()=>{s&&s!==ot&&zt(s);},[s]);let Le=useCallback(M=>{zt(M),Y?.(M);},[Y]),{state:C,setState:$,undo:fe,redo:De,canUndo:se,canRedo:ut,clearHistory:lt}=Vm(t,50),Zt=useMemo(()=>{let M=(L,G=0)=>{let Q=G;for(let ue of L)ue.subtasks?.length&&(Q=Math.max(Q,M(ue.subtasks,G+1)));return Q};return M(C)+1},[C]),Yt=useCallback(()=>v?typeof v=="string"?v:"gantt-expanded-tasks":null,[v]),Kt=useRef(new Map),La=useRef(false);if(!La.current&&v){La.current=true;let M=typeof v=="string"?v:"gantt-expanded-tasks";try{let L=localStorage.getItem(M);if(L){let G=JSON.parse(L);Array.isArray(G)&&(Kt.current=new Map(G));}}catch(L){console.warn("[GanttBoard] Error loading expanded state from localStorage:",L);}}let Rr=useCallback(()=>{let M=Yt();if(M)try{let L=Array.from(Kt.current.entries());localStorage.setItem(M,JSON.stringify(L));}catch(L){console.warn("[GanttBoard] Error saving expanded state to localStorage:",L);}},[Yt]),na=useRef(0),Fn=useRef(C);useEffect(()=>{Fn.current=C;},[C]);let po=useRef(false),gs=useCallback(M=>{Z(M),na.current+=1,$(L=>{let G=(ue,we=0)=>ue.map(et=>{let tt=M==="all"||we<M-1;return et.subtasks?.length&&Kt.current.set(et.id,tt),{...et,isExpanded:tt,subtasks:et.subtasks?G(et.subtasks,we+1):void 0}}),Q=G(L);return Rr(),Q});},[$,Rr]);useEffect(()=>{if(na.current>0){na.current-=1;return}let M=G=>{let Q=new Map;for(let ue of G){let we=ue.id;Q.get(we)||Q.set(we,ue);}return Array.from(Q.values())},L=G=>G.map(Q=>{let ue=Kt.current.get(Q.id),we=ue!==void 0?{...Q,isExpanded:ue}:Q;if(we.subtasks?.length){let et=M(we.subtasks);return {...we,subtasks:L(et)}}return we});if(Kt.current.size>0)$(Xr(L(t)));else {let G=Q=>Q.map(ue=>ue.subtasks?.length?{...ue,subtasks:M(G(ue.subtasks))}:ue);$(Xr(G(t)));}},[t,$]);let mo=useRef(t),ii=useRef(true);useEffect(()=>{if(ii.current){ii.current=false,mo.current=C;return}if(po.current){po.current=false,mo.current=C;return}if(!r)return;let M=JSON.stringify(mo.current),L=JSON.stringify(C);M!==L&&(mo.current=C,r(C));},[C,r]);let er=useMemo(()=>zd(w,N),[w,N]),fs=useCallback(M=>[{id:"name",label:M.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:M.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:M.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:M.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:M.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:M.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:M.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:M.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),Vr=useMemo(()=>b?typeof b=="string"?b:"gantt-columns-state":null,[b]),[Gr,Or]=useState(()=>{let M=fs(er);if(!b)return M;try{let L=typeof b=="string"?b:"gantt-columns-state",G=localStorage.getItem(L);if(!G)return M;let Q=JSON.parse(G),ue=new Map(Q.map(we=>[we.id,we]));return M.map(we=>{let et=ue.get(we.id);return et?{...we,visible:et.visible??we.visible,width:et.width??we.width}:we})}catch(L){return console.warn("[GanttBoard] Error loading columns state from localStorage:",L),M}}),An=useRef(Vr);useEffect(()=>{if(An.current===Vr)return;An.current=Vr;let M=fs(er);if(!Vr){Or(M);return}try{let L=localStorage.getItem(Vr);if(!L){Or(M);return}let G=JSON.parse(L),Q=new Map(G.map(ue=>[ue.id,ue]));Or(M.map(ue=>{let we=Q.get(ue.id);return we?{...ue,visible:we.visible??ue.visible,width:we.width??ue.width}:ue}));}catch(L){console.warn("[GanttBoard] Error reloading columns state from localStorage:",L),Or(M);}},[Vr,fs,er]),useEffect(()=>{if(Vr&&An.current===Vr)try{let M=Gr.map(L=>({id:L.id,visible:L.visible,width:L.width}));localStorage.setItem(Vr,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving columns state to localStorage:",M);}},[Gr,Vr]),useEffect(()=>{Or(M=>M.map(L=>({...L,label:er.columns[L.id==="name"?"taskName":L.id]||L.label})));},[er]);let Oo=useMemo(()=>Gr.filter(L=>L.visible).reduce((L,G)=>L+G.width,0),[Gr]),sn=useRef(Gr.filter(M=>M.visible).map(M=>M.id).join(","));useEffect(()=>{let M=Gr.filter(Q=>Q.visible),L=M.map(Q=>Q.id).join(","),G=sn.current;if(L!==G){let Q=M.some(we=>we.id!=="name"),ue=G.includes(",");Q?!ue&&Q&&it(null):it(null),sn.current=L;}},[Gr]);let S=60,re=.6,ye=useMemo(()=>{let L=Oo+S,G=typeof window<"u"?window.innerWidth*re:800,Q=Math.max(L,G);return Et!==null?Math.max(200,Math.min(Et,Q)):Math.max(200,L)},[Et,Oo]),Se=useRef(null),Fe=useRef(null),Ye=useRef(null),me=useRef(null),_e=useRef(null),Oe=useMemo(()=>lm(ot),[ot]),yt=useMemo(()=>({theme:Oe,themeName:ot}),[Oe,ot]),ea=useMemo(()=>jm(g),[g]),Nt=useMemo(()=>{if(!f||!ct)return C;let M=Ie.calculateCriticalPathFull(C),L=G=>G.map(Q=>{let ue=M.get(Q.id),we=Q.subtasks?L(Q.subtasks):void 0,et=we?.some(ya=>ya.isCriticalPath||ya.subtasks&&ya.subtasks.some(aa=>aa.isCriticalPath))||false,tt=ue?ue.isCritical:et;return {...Q,isCriticalPath:tt,cpmData:ue||void 0,subtasks:we}});return L(C)},[C,f,ct]),Dt=useMemo(()=>Ie.flattenTasks(C).some(L=>L.dependencies&&L.dependencies.length>0),[C]),wa=useMemo(()=>{let M=(L,G="")=>[...L].sort((ue,we)=>(ue.position??0)-(we.position??0)).map((ue,we)=>{let et=we+1,tt=G?`${G}.${et}`:`${et}.0`,ya=G?`${G}.${et}`:`${et}`;return {...ue,wbsCode:tt,subtasks:ue.subtasks?.length?M(ue.subtasks,ya):ue.subtasks}});return M(Nt)},[Nt]),Ea=useMemo(()=>{if(da==="all"&&!W)return wa;let M=L=>{let G=[];for(let Q of L){let ue=Q.subtasks?.length?M(Q.subtasks):void 0,we=false;if(W)we=Q.progress<100;else switch(da){case "all":we=true;break;case "incomplete":we=Q.progress<100;break;case "in_progress":we=Q.progress>0&&Q.progress<100;break;case "completed":we=Q.progress===100;break}(we||ue&&ue.length>0)&&G.push({...Q,subtasks:ue});}return G};return M(wa)},[wa,da,W]),Xa=i2(F);Gm({undo:fe,redo:De,canUndo:se,canRedo:ut,enabled:true}),useImperativeHandle(n,()=>({getTask:M=>Ie.findTaskById(C,M),addTask:(M,L)=>{$(G=>{if(!L)return [...G,{...M,level:0}];let Q=ue=>ue.map(we=>we.id===L?{...we,subtasks:[...we.subtasks||[],{...M,parentId:L,level:(we.level||0)+1}],isExpanded:true}:we.subtasks?{...we,subtasks:Q(we.subtasks)}:we);return Q(G)});},updateTask:(M,L)=>{$(G=>{let Q=ue=>ue.map(we=>we.id===M?{...we,...L}:we.subtasks?{...we,subtasks:Q(we.subtasks)}:we);return Q(G)});},deleteTask:M=>{$(L=>{let G=Q=>Q.filter(ue=>ue.id===M?false:(ue.subtasks&&(ue.subtasks=G(ue.subtasks)),true));return G(L)});},deleteTasks:M=>{$(L=>Yd(L,M));},duplicateTask:M=>{if(a.onTaskDuplicate){let L=Ie.findTaskById(C,M);L&&a.onTaskDuplicate(L);}else $(L=>$s(L,[M]).tasks);},splitTask:(M,L,G=3)=>{$(Q=>Ie.splitTask(Q,M,L,G));},calculateEndDate:Ie.calculateEndDate,calculateDuration:Ie.calculateDuration,validateDependency:(M,L)=>!Ie.validateDependencies(C,M,L),getAllTasks:()=>Ie.flattenTasks(C),getTasksByStatus:M=>Ie.flattenTasks(C).filter(L=>L.status===M),getTasksByParent:M=>M?Ie.findTaskById(C,M)?.subtasks||[]:C.filter(G=>!G.parentId),getCriticalPath:()=>Ie.flattenTasks(C).filter(M=>M.isCriticalPath),indentTask:M=>{$(L=>Xr(_d(L,[M])));},outdentTask:M=>{$(L=>Xr(Kd(L,[M])));},moveTask:(M,L)=>{$(G=>qd(G,[M],L));},createSubtask:async M=>{let{tasks:L,newTask:G}=Qd(C,M);if(Me){let Q=Me({...G,parentId:M});if((Q instanceof Promise?await Q:Q)===false)return}$(Xr(L)),at&&at({...G,parentId:M});},scrollToTask:M=>{let G=Ie.flattenTasks(C).findIndex(Q=>Q.id===M);if(G!==-1&&Se.current){let Q=G*Xa;Se.current.scrollTo({top:Q,behavior:"smooth"}),Ye.current&&Ye.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(M,L=2e3)=>{},expandTask:M=>{$(L=>{let G=Q=>Q.map(ue=>ue.id===M?{...ue,isExpanded:true}:ue.subtasks?{...ue,subtasks:G(ue.subtasks)}:ue);return G(L)});},collapseTask:M=>{$(L=>{let G=Q=>Q.map(ue=>ue.id===M?{...ue,isExpanded:false}:ue.subtasks?{...ue,subtasks:G(ue.subtasks)}:ue);return G(L)});},expandAll:()=>{$(M=>{let L=G=>G.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?L(Q.subtasks):void 0}));return L(M)});},collapseAll:()=>{$(M=>{let L=G=>G.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?L(Q.subtasks):void 0}));return L(M)});},collapseToLevel:M=>{gs(M);},undo:fe,redo:De,canUndo:()=>se,canRedo:()=>ut,clearHistory:lt,exportToPNG:async()=>{if(!me.current||!Se.current||!Ye.current)throw new Error("Gantt container not found");let M=me.current,L=Se.current,G=Fe.current||L.querySelector(".gantt-grid-scroll"),Q=Ye.current,ue=G?.scrollTop||0,we=Q.scrollTop,et=M.style.overflow,tt=M.style.height,ya=L.style.overflow;try{let aa=G?.querySelector(".gantt-taskgrid-content"),ka=Q.querySelector("svg"),br=aa?.scrollHeight||G?.scrollHeight||600,$r=ka?.getBoundingClientRect().height||Q.scrollHeight,dn=(M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(br,$r)+20;G&&(G.scrollTop=0),Q.scrollTop=0,M.style.overflow="visible",M.style.height=`${dn}px`,L.style.overflow="visible",await new Promise(Bn=>setTimeout(Bn,100));let go=await toPng(M,{backgroundColor:Oe.bgPrimary,pixelRatio:2,filter:Bn=>{if(!(Bn instanceof Element))return !0;let li=window.getComputedStyle(Bn),ys=parseInt(li.zIndex,10);return (isNaN(ys)||ys<50)&&li.position!=="fixed"}});return await(await fetch(go)).blob()}finally{M.style.overflow=et,M.style.height=tt,L.style.overflow=ya,G&&(G.scrollTop=ue),Q.scrollTop=we;}},exportToPDF:async M=>{await Ie.exportToPDF(C,M);},exportToExcel:async M=>{await Ie.exportToExcel(C,M,Al.current);},exportToJSON:()=>Ie.exportToJSON(C),exportToCSV:()=>Ie.exportToCSV(C),importFromJSON:M=>{let L=Ie.importFromJSON(M);$(L);},getTasks:()=>C,refresh:()=>{$(M=>[...M]);},clearAll:()=>{$([]);},scrollToToday:()=>{let M=Ye.current,L=_e.current;if(!M||!L)return;let Q=(new Date().getTime()-L.startDate.getTime())/(1e3*60*60*24),ue=L.timeScale==="day"?60:L.timeScale==="week"?20:8,we=Q*ue*L.zoom,et=M.clientWidth,tt=Math.max(0,we-et/2);M.scrollTo({left:tt,behavior:"smooth"});}}),[C,fe,De,se,ut,lt,Oe,Xa]);let ta=useCallback(M=>{Or(L=>L.map(G=>G.id===M?{...G,visible:!G.visible}:G));},[]),ma=useCallback((M,L)=>{Or(G=>G.map(Q=>{if(Q.id!==M)return Q;let ue=Q.minWidth??100,we=Q.maxWidth??800,et=Math.max(ue,Math.min(we,L));return {...Q,width:et}}));},[]),Vt=useCallback(M=>{$(L=>{let G=Jd(L,M),Q=ue=>{for(let we of ue){if(we.id===M){Kt.current.set(M,we.isExpanded??true);return}we.subtasks?.length&&Q(we.subtasks);}};return Q(G),Rr(),G}),a.onTaskToggleExpand?.(M);},[a,Rr]),Ft=useCallback((M,L)=>{if(be&&be(M,L)===false)return;let Q=Ie.findTaskById(C,M)?.progress,ue=et=>et.map(tt=>tt.id===M?{...tt,...L}:tt.subtasks?{...tt,subtasks:ue(tt.subtasks)}:tt);$(et=>ue(et));let we=Ie.findTaskById(ue(C),M);we&&(X?.(we),pt?.(we),L.progress!==void 0&&Q!==void 0&&L.progress!==Q&&He?.(M,Q,L.progress));},[C,X,be,pt,He]),Ua=useCallback((M,L,G)=>{if(M.length===0)return;let Q=new Set(M),ue=we=>we.map(et=>{let tt=Q.has(et.id)?{...et,[L]:G}:et;return tt.subtasks?{...tt,subtasks:ue(tt.subtasks)}:tt});$(we=>{let et=ue(we);return a.onBulkFill?.(M,L,G,et),et});},[a]),hr=useCallback(M=>{M.length!==0&&(na.current+=1,po.current=true,$(L=>Xr(_d(L,M))),a.onTaskIndent?.(M[0]));},[a]),kr=useCallback(M=>{M.length!==0&&(na.current+=1,po.current=true,$(L=>Xr(Kd(L,M))),a.onTaskOutdent?.(M[0]));},[a]),fr=useCallback((M,L,G)=>{na.current+=1,po.current=true,$(Q=>Xr(Pm(Q,M,L,G))),a.onTaskReparent?.(M,L,G);},[a]),tr=useCallback((M,L)=>{M.length!==0&&(na.current+=1,po.current=true,$(G=>qd(G,M,L)),a.onTaskMove?.(M[0],L));},[a]),No=useCallback(async M=>{let L=[];for(let G of M)Ke&&await Promise.resolve(Ke(G))===false||L.push(G);L.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(L):($(G=>Xr(Yd(G,L))),L.forEach(G=>a.onTaskDelete?.(G))),Ue&&L.forEach(G=>Ue(G)));},[a,Ke,Ue]),bs=useCallback(M=>{a.onTaskDuplicate?M.forEach(L=>{let G=Ie.findTaskById(C,L);G&&a.onTaskDuplicate(G);}):$(L=>$s(L,M).tasks);},[a,C]),ln=useCallback((M,L)=>{$(G=>{let{tasks:Q,newTask:ue}=Mm(G,M,L);return Me&&Me(ue)===false?G:(a.onTaskCreate?.(ue.parentId,ue.position||0),at?.(ue),Q)});},[a,Me,at]),Pf=useCallback((M,L)=>{$(G=>Xd(G,M,L)),a.onTaskRename?.(M,L);},[a]),Pl=useCallback(M=>{let{onTaskAddSubtask:L}=a;if(L){let G=Qn(C,M);if(G){L(G);return}}$(G=>{let{tasks:Q}=Qd(G,M);return a.onTaskCreate?.(M,0),Q});},[a,C]),Ff=useCallback((M,L)=>{let G=Math.max(0,Math.min(100,Math.round(L))),Q={progress:G};G===100?Q.status="completed":G>0?Q.status="in-progress":Q.status="todo",Ft(M.id,Q);},[Ft]),Af=useCallback((M,L,G)=>{let Q=!M.startDate&&!M.endDate,ue=M.startDate?Math.round((L.getTime()-M.startDate.getTime())/(1e3*60*60*24)):0,we=aa=>aa.map(ka=>ka.id===M.id?{...ka,startDate:L,endDate:G,...M.segments&&{segments:M.segments}}:ka.subtasks?{...ka,subtasks:we(ka.subtasks)}:ka),et=we(C),tt=et;et=Ie.autoScheduleDependents(et,M.id,ue),et=Xr(et),$(et);let ya={...M,startDate:L,endDate:G};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(M,L,G):X?.(ya),Te&&ue!==0){let aa=Ie.flattenTasks(tt),ka=Ie.flattenTasks(et),br=[];for(let $r of ka){if($r.id===M.id)continue;let $o=aa.find(go=>go.id===$r.id);if(!$o)continue;let In=$r.startDate?.getTime()!==$o.startDate?.getTime(),dn=$r.endDate?.getTime()!==$o.endDate?.getTime();(In||dn)&&br.push($r);}br.length>0&&Te(br);}},[C,X,Te,a]),Lf=useCallback((M,L)=>{B?.(M,L),_({isOpen:true,x:L.clientX,y:L.clientY,task:M});},[B]),If=useCallback((M,L)=>{let G=Ie.splitTask(C,M.id,L);$(G),_({isOpen:false,x:0,y:0,task:null});},[C]),gu=useCallback(M=>{let L=Ie.findTaskById(C,M.id)||M;V?.(L),z||ae(L);},[C,V,z]),fu=useCallback((M,L,G)=>{let Q=new Map,ue=aa=>{aa.forEach(ka=>{ka.dependencies&&Q.set(ka.id,ka.dependencies),ka.subtasks&&ue(ka.subtasks);});};ue(G);let we=Q.get(L)||[];Q.set(L,[...we,M]);let et=new Set,tt=new Set,ya=aa=>{if(!et.has(aa)){et.add(aa),tt.add(aa);let ka=Q.get(aa)||[];for(let br of ka){if(!et.has(br)&&ya(br))return true;if(tt.has(br))return true}}return tt.delete(aa),false};return ya(L)},[]),bu=useCallback((M,L)=>{if(fu(M.id,L,Fn.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
366
+ `})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:I,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:u?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${J[B]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:$e,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${gt}`,boxShadow:Ft},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:He,borderBottom:`1px solid ${Ae}`},children:[jsxs("div",{className:"flex items-center gap-2.5",children:[jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:ot,border:`1px solid ${Lt}`,color:"#00E5CC"},children:jsx(Vm,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Fe},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>p(O=>!O),className:"p-1.5 rounded-lg transition-colors",style:{color:Xe},onMouseEnter:O=>{O.currentTarget.style.background=ae,O.currentTarget.style.color=L;},onMouseLeave:O=>{O.currentTarget.style.background="transparent",O.currentTarget.style.color=Xe;},children:jsx(sw,{})}),jsx("button",{onClick:()=>d(false),className:"p-1.5 rounded-lg transition-colors",style:{color:Xe},onMouseEnter:O=>{O.currentTarget.style.background=ae,O.currentTarget.style.color=L;},onMouseLeave:O=>{O.currentTarget.style.background="transparent",O.currentTarget.style.color=Xe;},children:jsx(ow,{})})]})]}),jsx(AnimatePresence,{children:!u&&jsxs(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[m.length===0&&v&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:R,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:We.slice(0,4).map((O,Z)=>jsx("button",{onClick:()=>le(O),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:q,color:X,border:`1px solid ${U}`},onMouseEnter:Te=>{Te.currentTarget.style.borderColor=Se,Te.currentTarget.style.color="#00E5CC";},onMouseLeave:Te=>{Te.currentTarget.style.borderColor=U,Te.currentTarget.style.color=X;},children:O.length>30?O.slice(0,30)+"...":O},Z))})]}),m.map(O=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${O.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${O.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:O.role==="user"?de:rt,color:O.role==="user"?"#00E5CC":At,border:O.role==="user"?`1px solid ${et}`:`1px solid ${Qe}`},children:[O.isLoading?jsx(iw,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:O.content}),O.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:O.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:O.command.success?"#10B981":"#EF4444",border:`1px solid ${O.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[O.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:O.command.type.replace(/_/g," ")})]})]})},O.id)),jsx("div",{ref:te})]}),jsxs("form",{onSubmit:O=>{if(D&&Zr.length>0){O.preventDefault();return}V(O);},className:"p-3 relative",style:{borderTop:`1px solid ${kt}`},children:[jsx(AnimatePresence,{children:D&&Zr.length>0&&jsx(motion.div,{ref:_,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:St,border:`1px solid ${Lr}`,boxShadow:Yt,backdropFilter:"blur(12px)"},children:Zr.map((O,Z)=>jsxs("button",{type:"button",onClick:()=>pe(O),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:Z===N?tr:"transparent",color:kr},onMouseEnter:()=>K(Z),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:Ze,border:`1px solid ${Ye}`,color:"#00E5CC"},children:O.name.split(" ").map(Te=>Te[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:O.name}),O.email&&jsx("div",{className:"text-xs truncate",style:{color:oa},children:O.email})]})]},O.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:jt,border:`1px solid ${Gt}`},children:[jsx("input",{ref:H,type:"text",value:x,onChange:O=>ne(O.target.value),onKeyDown:O=>{pt(O);},placeholder:W,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:or,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!x.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?br:"transparent",color:x.trim()?"#00E5CC":qt,border:x.trim()?`1px solid ${da}`:"1px solid transparent"},children:jsx(nw,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:gr,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function jm(e,t=50){let[r,a]=useState({past:[],present:e,future:[]}),n=useRef(false),s=useCallback((i,d=true)=>{a(u=>{let p=typeof i=="function"?i(u.present):i;if(n.current)return {...u,present:p};if(!d)return {...u,present:p};let m=[...u.past,u.present];return m.length>t&&m.shift(),{past:m,present:p,future:[]}});},[t]),o=useCallback(()=>{a(i=>{if(i.past.length===0)return i;let d=i.past[i.past.length-1],u=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:u,present:d,future:[i.present,...i.future]}});},[]),c=useCallback(()=>{a(i=>{if(i.future.length===0)return i;let d=i.future[0],u=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:d,future:u}});},[]),l=useCallback(()=>{a(i=>({past:[],present:i.present,future:[]}));},[]);return {state:r.present,setState:s,undo:o,redo:c,canUndo:r.past.length>0,canRedo:r.future.length>0,clearHistory:l}}function _m({undo:e,redo:t,canUndo:r,canRedo:a,enabled:n=true}){useEffect(()=>{if(!n)return;let s=o=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,l=c?o.metaKey:o.ctrlKey;if(l&&o.key==="z"&&!o.shiftKey&&r){o.preventDefault(),e();return}if(a){if(!c&&l&&o.key==="y"){o.preventDefault(),t();return}if(c&&l&&o.shiftKey&&o.key==="z"){o.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,r,a,n]);}var uw={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Ne.formatDate(e.startDate)} - ${Ne.formatDate(e.endDate)}`);let r=Ne.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${r} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let r=e.assignees.map(a=>a.name).join(", ");t.push(`Assigned: ${r}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,r)=>r,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>Ne.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Km(e){return {...uw,...e}}var xw=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Jm=forwardRef(function({tasks:t,config:r={},onTasksChange:a},n){let{theme:s,timeScale:o="week",rowDensity:c="comfortable",showThemeSelector:l=true,showExportButton:i=true,onExportSuccess:d,projectName:u,availableUsers:p=[],templates:m,enableAutoCriticalPath:f=true,persistExpandedState:x,persistFilter:y,persistColumns:b,clearFiltersKey:h,aiAssistant:v,locale:w="en",customTranslations:T,showCreateTaskButton:E=false,createTaskLabel:F,onCreateTask:k,taskFilter:D,onTaskFilterChange:P,toolbarRightContent:N,showBaseline:K,viewMode:H,onViewModeChange:te,projectForecast:I,onThemeChange:_,onTaskClick:j,onTaskDblClick:W,onTaskContextMenu:B,onTaskUpdate:ve,onDependentTasksScheduled:We,onProgressChange:Le,onTaskEdit:be,onTaskAddSubtask:ge,onTaskMarkIncomplete:ye,onTaskSetInProgress:ze,onDependencyCreate:ke,onDependencyDelete:Ie,onBeforeTaskAdd:De,onAfterTaskAdd:qe,onBeforeTaskUpdate:fe,onAfterTaskUpdate:tt,onBeforeTaskDelete:Be,onAfterTaskDelete:$e,permissions:gt,onCopySnapshotLink:Ft}=r,Ae=useContext(ji)?.theme,[ot,Lt]=useState(Ae||s||"dark"),[Fe,Xe]=useState(o),[L,ae]=useState(c),[R,q]=useState(1),[U,X]=useState("all"),[Se,de]=useState(H||"execution"),et=H??Se,rt=useCallback(M=>{de(M),te?.(M);},[te]),Qe=K??et==="oracle",[At,kt]=useState(r.showCriticalPath!==false),[jt,Gt]=useState(r.showDependencies!==false),[or,br]=useState(r.highlightWeekends!==false),da=useCallback(M=>{kt(M),r.onShowCriticalPathChange?.(M);},[r.onShowCriticalPathChange]),qt=useCallback(M=>{Gt(M),r.onShowDependenciesChange?.(M);},[r.onShowDependenciesChange]),gr=useCallback(M=>{br(M),r.onHighlightWeekendsChange?.(M);},[r.onHighlightWeekendsChange]);useEffect(()=>{r.onTimeScaleChange?.(Fe);},[Fe]),useEffect(()=>{r.onZoomChange?.(R);},[R]);let St=useRef(r.onDateRangeChange);St.current=r.onDateRangeChange;let Lr=useCallback(()=>y?typeof y=="string"?y:"gantt-filter-state":null,[y]),[Yt,tr]=useState(()=>{if(!y)return "all";try{let M=typeof y=="string"?y:"gantt-filter-state",A=localStorage.getItem(M);if(A){let z=JSON.parse(A);if(z.taskFilter)return z.taskFilter}}catch(M){console.warn("[GanttBoard] Error loading filter state from localStorage:",M);}return "all"}),kr=D??Yt,oa=P??tr,[Ze,Ye]=useState(()=>{if(!y)return false;try{let M=typeof y=="string"?y:"gantt-filter-state",A=localStorage.getItem(M);if(A){let z=JSON.parse(A);if(typeof z.hideCompleted=="boolean")return z.hideCompleted}}catch(M){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",M);}return false});useEffect(()=>{let M=Lr();if(M)try{let A={taskFilter:kr,hideCompleted:Ze};localStorage.setItem(M,JSON.stringify(A));}catch(A){console.warn("[GanttBoard] Error saving filter state to localStorage:",A);}},[kr,Ze,Lr]);let ua=useRef(h);useEffect(()=>{if(ua.current!==h&&h!==void 0){tr("all"),Ye(false);let M=Lr();if(M)try{localStorage.removeItem(M);}catch(A){console.warn("[GanttBoard] Error clearing filter state from localStorage:",A);}}ua.current=h;},[h,Lr]);let[Xt,Zr]=useState(0),[ne,pe]=useState(false),[pt,je]=useState(null),[it,V]=useState({isOpen:false,x:0,y:0,task:null}),[le,J]=useState(null),[O,Z]=useState(null);useEffect(()=>{Ae&&Ae!==ot&&Lt(Ae);},[Ae]),useEffect(()=>{s&&s!==ot&&Lt(s);},[s]);let Te=useCallback(M=>{Lt(M),_?.(M);},[_]),{state:C,setState:$,undo:ce,redo:xe,canUndo:ee,canRedo:Je,clearHistory:_e}=jm(t,50),Rt=useMemo(()=>{let M=(A,z=0)=>{let Y=z;for(let oe of A)oe.subtasks?.length&&(Y=Math.max(Y,M(oe.subtasks,z+1)));return Y};return M(C)+1},[C]),Et=useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),Nt=useRef(new Map),Cr=useRef(false);if(!Cr.current&&x){Cr.current=true;let M=typeof x=="string"?x:"gantt-expanded-tasks";try{let A=localStorage.getItem(M);if(A){let z=JSON.parse(A);Array.isArray(z)&&(Nt.current=new Map(z));}}catch(A){console.warn("[GanttBoard] Error loading expanded state from localStorage:",A);}}let Aa=useCallback(()=>{let M=Et();if(M)try{let A=Array.from(Nt.current.entries());localStorage.setItem(M,JSON.stringify(A));}catch(A){console.warn("[GanttBoard] Error saving expanded state to localStorage:",A);}},[Et]),Ut=useRef(0),$o=useRef(C);useEffect(()=>{$o.current=C;},[C]);let bn=useRef(false),ws=useCallback(M=>{X(M),Ut.current+=1,$(A=>{let z=(oe,me=0)=>oe.map(Ge=>{let Ve=M==="all"||me<M-1;return Ge.subtasks?.length&&Nt.current.set(Ge.id,Ve),{...Ge,isExpanded:Ve,subtasks:Ge.subtasks?z(Ge.subtasks,me+1):void 0}}),Y=z(A);return Aa(),Y});},[$,Aa]);useEffect(()=>{if(Ut.current>0){Ut.current-=1;return}let M=z=>{let Y=new Map;for(let oe of z){let me=oe.id;Y.get(me)||Y.set(me,oe);}return Array.from(Y.values())},A=z=>z.map(Y=>{let oe=Nt.current.get(Y.id),me=oe!==void 0?{...Y,isExpanded:oe}:Y;if(me.subtasks?.length){let Ge=M(me.subtasks);return {...me,subtasks:A(Ge)}}return me});if(Nt.current.size>0)$(Ka(A(t)));else {let z=Y=>Y.map(oe=>oe.subtasks?.length?{...oe,subtasks:M(z(oe.subtasks))}:oe);$(Ka(z(t)));}},[t,$]);let hn=useRef(t),pi=useRef(true);useEffect(()=>{if(pi.current){pi.current=false,hn.current=C;return}if(bn.current){bn.current=false,hn.current=C;return}if(!a)return;let M=JSON.stringify(hn.current),A=JSON.stringify(C);M!==A&&(hn.current=C,a(C));},[C,a]);let Kr=useMemo(()=>_c(w,T),[w,T]),ks=useCallback(M=>[{id:"name",label:M.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:M.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:M.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:M.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:M.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:M.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:M.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:M.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),Wa=useMemo(()=>b?typeof b=="string"?b:"gantt-columns-state":null,[b]),[za,Ia]=useState(()=>{let M=ks(Kr);if(!b)return M;try{let A=typeof b=="string"?b:"gantt-columns-state",z=localStorage.getItem(A);if(!z)return M;let Y=JSON.parse(z),oe=new Map(Y.map(me=>[me.id,me]));return M.map(me=>{let Ge=oe.get(me.id);return Ge?{...me,visible:Ge.visible??me.visible,width:Ge.width??me.width}:me})}catch(A){return console.warn("[GanttBoard] Error loading columns state from localStorage:",A),M}}),Oo=useRef(Wa);useEffect(()=>{if(Oo.current===Wa)return;Oo.current=Wa;let M=ks(Kr);if(!Wa){Ia(M);return}try{let A=localStorage.getItem(Wa);if(!A){Ia(M);return}let z=JSON.parse(A),Y=new Map(z.map(oe=>[oe.id,oe]));Ia(M.map(oe=>{let me=Y.get(oe.id);return me?{...oe,visible:me.visible??oe.visible,width:me.width??oe.width}:oe}));}catch(A){console.warn("[GanttBoard] Error reloading columns state from localStorage:",A),Ia(M);}},[Wa,ks,Kr]),useEffect(()=>{if(Wa&&Oo.current===Wa)try{let M=za.map(A=>({id:A.id,visible:A.visible,width:A.width}));localStorage.setItem(Wa,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving columns state to localStorage:",M);}},[za,Wa]),useEffect(()=>{Ia(M=>M.map(A=>({...A,label:Kr.columns[A.id==="name"?"taskName":A.id]||A.label})));},[Kr]);let Vn=useMemo(()=>za.filter(A=>A.visible).reduce((A,z)=>A+z.width,0),[za]),mo=useRef(za.filter(M=>M.visible).map(M=>M.id).join(","));useEffect(()=>{let M=za.filter(Y=>Y.visible),A=M.map(Y=>Y.id).join(","),z=mo.current;if(A!==z){let Y=M.some(me=>me.id!=="name"),oe=z.includes(",");Y?!oe&&Y&&je(null):je(null),mo.current=A;}},[za]);let S=60,Q=.6,ue=useMemo(()=>{let A=Vn+S,z=typeof window<"u"?window.innerWidth*Q:800,Y=Math.max(A,z);return pt!==null?Math.max(200,Math.min(pt,Y)):Math.max(200,A)},[pt,Vn]),we=useRef(null),Ce=useRef(null),Oe=useRef(null),ie=useRef(null),Re=useRef(null),Me=useMemo(()=>dm(ot),[ot]),st=useMemo(()=>({theme:Me,themeName:ot}),[Me,ot]),Bt=useMemo(()=>Km(m),[m]),dt=useMemo(()=>{if(!f||!At)return C;let M=Ne.calculateCriticalPathFull(C),A=z=>z.map(Y=>{let oe=M.get(Y.id),me=Y.subtasks?A(Y.subtasks):void 0,Ge=me?.some(rr=>rr.isCriticalPath||rr.subtasks&&rr.subtasks.some(Ot=>Ot.isCriticalPath))||false,Ve=oe?oe.isCritical:Ge;return {...Y,isCriticalPath:Ve,cpmData:oe||void 0,subtasks:me}});return A(C)},[C,f,At]),ut=useMemo(()=>Ne.flattenTasks(C).some(A=>A.dependencies&&A.dependencies.length>0),[C]),sr=useMemo(()=>{let M=(A,z="")=>[...A].sort((oe,me)=>(oe.position??0)-(me.position??0)).map((oe,me)=>{let Ge=me+1,Ve=z?`${z}.${Ge}`:`${Ge}.0`,rr=z?`${z}.${Ge}`:`${Ge}`;return {...oe,wbsCode:Ve,subtasks:oe.subtasks?.length?M(oe.subtasks,rr):oe.subtasks}});return M(dt)},[dt]),hr=useMemo(()=>{if(kr==="all"&&!Ze)return sr;let M=A=>{let z=[];for(let Y of A){let oe=Y.subtasks?.length?M(Y.subtasks):void 0,me=false;if(Ze)me=Y.progress<100;else switch(kr){case "all":me=true;break;case "incomplete":me=Y.progress<100;break;case "in_progress":me=Y.progress>0&&Y.progress<100;break;case "completed":me=Y.progress===100;break}(me||oe&&oe.length>0)&&z.push({...Y,subtasks:oe});}return z};return M(sr)},[sr,kr,Ze]),Gr=xw(L);_m({undo:ce,redo:xe,canUndo:ee,canRedo:Je,enabled:true}),useImperativeHandle(n,()=>({getTask:M=>Ne.findTaskById(C,M),addTask:(M,A)=>{$(z=>{if(!A)return [...z,{...M,level:0}];let Y=oe=>oe.map(me=>me.id===A?{...me,subtasks:[...me.subtasks||[],{...M,parentId:A,level:(me.level||0)+1}],isExpanded:true}:me.subtasks?{...me,subtasks:Y(me.subtasks)}:me);return Y(z)});},updateTask:(M,A)=>{$(z=>{let Y=oe=>oe.map(me=>me.id===M?{...me,...A}:me.subtasks?{...me,subtasks:Y(me.subtasks)}:me);return Y(z)});},deleteTask:M=>{$(A=>{let z=Y=>Y.filter(oe=>oe.id===M?false:(oe.subtasks&&(oe.subtasks=z(oe.subtasks)),true));return z(A)});},deleteTasks:M=>{$(A=>td(A,M));},duplicateTask:M=>{if(r.onTaskDuplicate){let A=Ne.findTaskById(C,M);A&&r.onTaskDuplicate(A);}else $(A=>js(A,[M]).tasks);},splitTask:(M,A,z=3)=>{$(Y=>Ne.splitTask(Y,M,A,z));},calculateEndDate:Ne.calculateEndDate,calculateDuration:Ne.calculateDuration,validateDependency:(M,A)=>!Ne.validateDependencies(C,M,A),getAllTasks:()=>Ne.flattenTasks(C),getTasksByStatus:M=>Ne.flattenTasks(C).filter(A=>A.status===M),getTasksByParent:M=>M?Ne.findTaskById(C,M)?.subtasks||[]:C.filter(z=>!z.parentId),getCriticalPath:()=>Ne.flattenTasks(C).filter(M=>M.isCriticalPath),indentTask:M=>{$(A=>Ka(Qc(A,[M])));},outdentTask:M=>{$(A=>Ka(Zc(A,[M])));},moveTask:(M,A)=>{$(z=>ed(z,[M],A));},createSubtask:async M=>{let{tasks:A,newTask:z}=nd(C,M);if(De){let Y=De({...z,parentId:M});if((Y instanceof Promise?await Y:Y)===false)return}$(Ka(A)),qe&&qe({...z,parentId:M});},scrollToTask:M=>{let z=Ne.flattenTasks(C).findIndex(Y=>Y.id===M);if(z!==-1&&we.current){let Y=z*Gr;we.current.scrollTo({top:Y,behavior:"smooth"}),Oe.current&&Oe.current.scrollTo({top:Y,behavior:"smooth"});}},highlightTask:(M,A=2e3)=>{},expandTask:M=>{$(A=>{let z=Y=>Y.map(oe=>oe.id===M?{...oe,isExpanded:true}:oe.subtasks?{...oe,subtasks:z(oe.subtasks)}:oe);return z(A)});},collapseTask:M=>{$(A=>{let z=Y=>Y.map(oe=>oe.id===M?{...oe,isExpanded:false}:oe.subtasks?{...oe,subtasks:z(oe.subtasks)}:oe);return z(A)});},expandAll:()=>{$(M=>{let A=z=>z.map(Y=>({...Y,isExpanded:true,subtasks:Y.subtasks?A(Y.subtasks):void 0}));return A(M)});},collapseAll:()=>{$(M=>{let A=z=>z.map(Y=>({...Y,isExpanded:false,subtasks:Y.subtasks?A(Y.subtasks):void 0}));return A(M)});},collapseToLevel:M=>{ws(M);},undo:ce,redo:xe,canUndo:()=>ee,canRedo:()=>Je,clearHistory:_e,exportToPNG:async()=>{if(!ie.current||!we.current||!Oe.current)throw new Error("Gantt container not found");let M=ie.current,A=we.current,z=Ce.current||A.querySelector(".gantt-grid-scroll"),Y=Oe.current,oe=z?.scrollTop||0,me=Y.scrollTop,Ge=M.style.overflow,Ve=M.style.height,rr=A.style.overflow;try{let Ot=z?.querySelector(".gantt-taskgrid-content"),ir=Y.querySelector("svg"),ma=Ot?.scrollHeight||z?.scrollHeight||600,Ra=ir?.getBoundingClientRect().height||Y.scrollHeight,fo=(M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(ma,Ra)+20;z&&(z.scrollTop=0),Y.scrollTop=0,M.style.overflow="visible",M.style.height=`${fo}px`,A.style.overflow="visible",await new Promise(Wo=>setTimeout(Wo,100));let yn=await toPng(M,{backgroundColor:Me.bgPrimary,pixelRatio:2,filter:Wo=>{if(!(Wo instanceof Element))return !0;let mi=window.getComputedStyle(Wo),Ns=parseInt(mi.zIndex,10);return (isNaN(Ns)||Ns<50)&&mi.position!=="fixed"}});return await(await fetch(yn)).blob()}finally{M.style.overflow=Ge,M.style.height=Ve,A.style.overflow=rr,z&&(z.scrollTop=oe),Y.scrollTop=me;}},exportToPDF:async M=>{await Ne.exportToPDF(C,M);},exportToExcel:async M=>{await Ne.exportToExcel(C,M,zl.current);},exportToJSON:()=>Ne.exportToJSON(C),exportToCSV:()=>Ne.exportToCSV(C),importFromJSON:M=>{let A=Ne.importFromJSON(M);$(A);},getTasks:()=>C,refresh:()=>{$(M=>[...M]);},clearAll:()=>{$([]);},scrollToToday:()=>{let M=Oe.current,A=Re.current;if(!M||!A)return;let Y=(new Date().getTime()-A.startDate.getTime())/(1e3*60*60*24),oe=A.timeScale==="day"?60:A.timeScale==="week"?20:8,me=Y*oe*A.zoom,Ge=M.clientWidth,Ve=Math.max(0,me-Ge/2);M.scrollTo({left:Ve,behavior:"smooth"});}}),[C,ce,xe,ee,Je,_e,Me,Gr]);let $t=useCallback(M=>{Ia(A=>A.map(z=>z.id===M?{...z,visible:!z.visible}:z));},[]),Jt=useCallback((M,A)=>{Ia(z=>z.map(Y=>{if(Y.id!==M)return Y;let oe=Y.minWidth??100,me=Y.maxWidth??800,Ge=Math.max(oe,Math.min(me,A));return {...Y,width:Ge}}));},[]),Ct=useCallback(M=>{$(A=>{let z=ad(A,M),Y=oe=>{for(let me of oe){if(me.id===M){Nt.current.set(M,me.isExpanded??true);return}me.subtasks?.length&&Y(me.subtasks);}};return Y(z),Aa(),z}),r.onTaskToggleExpand?.(M);},[r,Aa]),ft=useCallback((M,A)=>{if(fe&&fe(M,A)===false)return;let Y=Ne.findTaskById(C,M)?.progress,oe=Ge=>Ge.map(Ve=>Ve.id===M?{...Ve,...A}:Ve.subtasks?{...Ve,subtasks:oe(Ve.subtasks)}:Ve);$(Ge=>oe(Ge));let me=Ne.findTaskById(oe(C),M);me&&(ve?.(me),tt?.(me),A.progress!==void 0&&Y!==void 0&&A.progress!==Y&&Le?.(M,Y,A.progress));},[C,ve,fe,tt,Le]),Ar=useCallback((M,A,z)=>{if(M.length===0)return;let Y=new Set(M),oe=me=>me.map(Ge=>{let Ve=Y.has(Ge.id)?{...Ge,[A]:z}:Ge;return Ve.subtasks?{...Ve,subtasks:oe(Ve.subtasks)}:Ve});$(me=>{let Ge=oe(me);return r.onBulkFill?.(M,A,z,Ge),Ge});},[r]),ga=useCallback(M=>{M.length!==0&&(Ut.current+=1,bn.current=true,$(A=>Ka(Qc(A,M))),r.onTaskIndent?.(M[0]));},[r]),xa=useCallback(M=>{M.length!==0&&(Ut.current+=1,bn.current=true,$(A=>Ka(Zc(A,M))),r.onTaskOutdent?.(M[0]));},[r]),pa=useCallback((M,A,z)=>{Ut.current+=1,bn.current=true,$(Y=>Ka(Lm(Y,M,A,z))),r.onTaskReparent?.(M,A,z);},[r]),qr=useCallback((M,A)=>{M.length!==0&&(Ut.current+=1,bn.current=true,$(z=>ed(z,M,A)),r.onTaskMove?.(M[0],A));},[r]),Pn=useCallback(async M=>{let A=[];for(let z of M)Be&&await Promise.resolve(Be(z))===false||A.push(z);A.length!==0&&(r.onMultiTaskDelete?r.onMultiTaskDelete(A):($(z=>Ka(td(z,A))),A.forEach(z=>r.onTaskDelete?.(z))),$e&&A.forEach(z=>$e(z)));},[r,Be,$e]),Cs=useCallback(M=>{r.onTaskDuplicate?M.forEach(A=>{let z=Ne.findTaskById(C,A);z&&r.onTaskDuplicate(z);}):$(A=>js(A,M).tasks);},[r,C]),go=useCallback((M,A)=>{$(z=>{let{tasks:Y,newTask:oe}=Fm(z,M,A);return De&&De(oe)===false?z:(r.onTaskCreate?.(oe.parentId,oe.position||0),qe?.(oe),Y)});},[r,De,qe]),Qf=useCallback((M,A)=>{$(z=>rd(z,M,A)),r.onTaskRename?.(M,A);},[r]),Ul=useCallback(M=>{let{onTaskAddSubtask:A}=r;if(A){let z=ns(C,M);if(z){A(z);return}}$(z=>{let{tasks:Y}=nd(z,M);return r.onTaskCreate?.(M,0),Y});},[r,C]),Zf=useCallback((M,A)=>{let z=Math.max(0,Math.min(100,Math.round(A))),Y={progress:z};z===100?Y.status="completed":z>0?Y.status="in-progress":Y.status="todo",ft(M.id,Y);},[ft]),eb=useCallback((M,A,z)=>{let Y=!M.startDate&&!M.endDate,oe=M.startDate?Math.round((A.getTime()-M.startDate.getTime())/(1e3*60*60*24)):0,me=Ot=>Ot.map(ir=>ir.id===M.id?{...ir,startDate:A,endDate:z,...M.segments&&{segments:M.segments}}:ir.subtasks?{...ir,subtasks:me(ir.subtasks)}:ir),Ge=me(C),Ve=Ge;Ge=Ne.autoScheduleDependents(Ge,M.id,oe),Ge=Ka(Ge),$(Ge);let rr={...M,startDate:A,endDate:z};if(Y&&r?.onTaskDateChange?r.onTaskDateChange(M,A,z):ve?.(rr),We&&oe!==0){let Ot=Ne.flattenTasks(Ve),ir=Ne.flattenTasks(Ge),ma=[];for(let Ra of ir){if(Ra.id===M.id)continue;let jn=Ot.find(yn=>yn.id===Ra.id);if(!jn)continue;let Uo=Ra.startDate?.getTime()!==jn.startDate?.getTime(),fo=Ra.endDate?.getTime()!==jn.endDate?.getTime();(Uo||fo)&&ma.push(Ra);}ma.length>0&&We(ma);}},[C,ve,We,r]),tb=useCallback((M,A)=>{B?.(M,A),V({isOpen:true,x:A.clientX,y:A.clientY,task:M});},[B]),rb=useCallback((M,A)=>{let z=Ne.splitTask(C,M.id,A);$(z),V({isOpen:false,x:0,y:0,task:null});},[C]),hu=useCallback(M=>{let A=Ne.findTaskById(C,M.id)||M;W?.(A),be||J(A);},[C,W,be]),yu=useCallback((M,A,z)=>{let Y=new Map,oe=Ot=>{Ot.forEach(ir=>{ir.dependencies&&Y.set(ir.id,ir.dependencies),ir.subtasks&&oe(ir.subtasks);});};oe(z);let me=Y.get(A)||[];Y.set(A,[...me,M]);let Ge=new Set,Ve=new Set,rr=Ot=>{if(!Ge.has(Ot)){Ge.add(Ot),Ve.add(Ot);let ir=Y.get(Ot)||[];for(let ma of ir){if(!Ge.has(ma)&&rr(ma))return true;if(Ve.has(ma))return true}}return Ve.delete(Ot),false};return rr(A)},[]),xu=useCallback((M,A)=>{if(yu(M.id,A,$o.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
367
367
 
368
- Task dependencies must flow in one direction only.`);return}let G=Q=>Q.map(ue=>{if(ue.id===L){let we=ue.dependencies||[];if(!we.includes(M.id))return {...ue,dependencies:[...we,M.id]}}return ue.subtasks?{...ue,subtasks:G(ue.subtasks)}:ue});na.current+=1,$(Q=>G(Q)),Ne?.(M.id,L);},[Ne,fu]),hu=useCallback((M,L)=>{let G=Q=>Q.map(ue=>{if(ue.id===M&&ue.dependencies){let we=ue.dependencies.filter(et=>et!==L);return {...ue,dependencies:we}}return ue.subtasks?{...ue,subtasks:G(ue.subtasks)}:ue});na.current+=1,$(Q=>G(Q)),ze?.(M,L);},[ze]),{startDate:Do,endDate:Fl}=useMemo(()=>{let M=C.filter(we=>we.startDate&&we.endDate);if(M.length===0){let we=new Date,et=new Date(we);et.setDate(et.getDate()-30);let tt=new Date(we);return tt.setDate(tt.getDate()+60),{startDate:et,endDate:tt}}let L=M.flatMap(we=>[we.startDate,we.endDate]).filter(we=>we!==void 0),G=new Date(Math.min(...L.map(we=>we.getTime()))),Q=new Date(Math.max(...L.map(we=>we.getTime()))),ue=Ee==="day"?7:Ee==="week"?14:30;return G.setDate(G.getDate()-ue),Q.setDate(Q.getDate()+ue),{startDate:G,endDate:Q}},[C,Ee]);useEffect(()=>{Bt.current?.(Do,Fl);},[Do,Fl]);let Bf=useCallback(async()=>{if(!me.current||!Se.current||!Ye.current)return;await new Promise(dn=>setTimeout(dn,200));let M=me.current,L=Se.current,G=Fe.current||L.querySelector(".gantt-grid-scroll"),Q=Ye.current,ue=G?.scrollTop||0,we=G?.scrollLeft||0,et=Q.scrollTop,tt=Q.scrollLeft,ya=M.style.overflow,aa=M.style.height,ka=G?.style.overflow||"",br=Q.style.overflow,$r=L.style.overflow,$o=M.style.width,In=Q.style.width;try{let dn=G?.querySelector(".gantt-taskgrid-content"),go=Q.querySelector("svg"),Bl=go?.getAttribute("height")?parseInt(go.getAttribute("height"),10):go?.getBoundingClientRect().height||0,Bn=dn?.scrollHeight||G?.scrollHeight||600,li=Math.max(Bl,Q.scrollHeight),ys=go?.getAttribute("width")?parseInt(go.getAttribute("width"),10):go?.getBoundingClientRect().width||Q.scrollWidth,Vf=M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,Rl=Math.max(Bn,li,Bl),wu=Vf+Rl+50,ku=(G?.offsetWidth||L.offsetWidth||300)+ys+10;G&&(G.scrollTop=0,G.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,M.style.overflow="visible",M.style.height=`${wu}px`,M.style.width=`${ku}px`,L.style.overflow="visible",G&&(G.style.overflow="visible",G.style.height=`${Rl+50}px`),Q.style.overflow="visible",Q.style.height=`${Rl+50}px`,Q.style.width=`${ys+10}px`,await new Promise(di=>setTimeout(di,150));let Gf=await toPng(M,{backgroundColor:Oe.bgPrimary,pixelRatio:2,width:ku,height:wu,skipFonts:!1,filter:di=>{if(!(di instanceof Element))return !0;let Cu=window.getComputedStyle(di),Tu=parseInt(Cu.zIndex,10);return !(!isNaN(Tu)&&Tu>=50||Cu.position==="fixed")}}),Ol=document.createElement("a");Ol.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Ol.href=Gf,Ol.click();}finally{M.style.overflow=ya,M.style.height=aa,M.style.width=$o,L.style.overflow=$r,G&&(G.style.overflow=ka,G.style.height="",G.scrollTop=ue,G.scrollLeft=we),Q.style.overflow=br,Q.style.height="",Q.style.width=In,Q.scrollTop=et,Q.scrollLeft=tt;}u?.("png");},[Oe,u]),Rf=useCallback(async()=>{await Ie.exportToPDF(C),u?.("pdf");},[C,u]),Al=useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m});Al.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m};let Of=useCallback(async()=>{if(a.onExportExcel){await a.onExportExcel(),u?.("excel");return}let M=new Date,L=ue=>String(ue).padStart(2,"0"),G=`${M.getFullYear()}-${L(M.getMonth()+1)}-${L(M.getDate())}_${L(M.getHours())}${L(M.getMinutes())}`,Q=m?m.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Ie.exportToExcel(C,`${Q}_${G}.xlsx`,Al.current),u?.("excel");},[C,m,u,a.onExportExcel]),$f=useCallback(()=>{let M=Ie.exportToCSV(C),L=new Blob([M],{type:"text/csv;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(L),G.download="gantt-chart.csv",G.click(),URL.revokeObjectURL(G.href),u?.("csv");},[C,u]),Hf=useCallback(()=>{let M=Ie.exportToJSON(C),L=new Blob([M],{type:"application/json;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(L),G.download="gantt-chart.json",G.click(),URL.revokeObjectURL(G.href),u?.("json");},[C,u]),zf=useCallback(()=>{Ie.exportToMSProject(C,"Gantt Project","project.xml"),u?.("msproject");},[C,u]),Uf=M=>{M.preventDefault(),ve(true);},Ln=useRef(false),[Ll,yu]=useState(false),hs=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let M=Ye.current,L=Se.current?.querySelector(".gantt-grid-scroll");if(!M||!L)return;let G=()=>{if(Ln.current)return;Ln.current=true;let tt=M.scrollTop;pa(tt),L.scrollTop=tt,requestAnimationFrame(()=>{Ln.current=false;});},Q=()=>{if(Ln.current)return;Ln.current=true;let tt=L.scrollTop;pa(tt),M.scrollTop=tt,requestAnimationFrame(()=>{Ln.current=false;});},ue=tt=>{if(ce&&L){let aa=L.parentElement?.getBoundingClientRect()?.left||0,ka=tt.clientX-aa,br=200,$r=Oo+S,$o=window.innerWidth*re,In=Math.max($r,$o);ka>=br&&ka<=In&&it(ka);}if(Ll&&M){let ya=tt.clientX-hs.current.x,aa=tt.clientY-hs.current.y;M.scrollLeft=hs.current.scrollLeft-ya,M.scrollTop=hs.current.scrollTop-aa;}},we=()=>{ve(false),yu(false);},et=tt=>{if(tt.button!==0)return;let ya=tt.target;ya.closest("[data-task-bar]")||ya.closest("[data-dependency-line]")||ya.closest("button")||ya.closest('[role="button"]')||ya.tagName==="rect"&&ya.getAttribute("data-clickable")==="true"||(yu(true),hs.current={x:tt.clientX,y:tt.clientY,scrollLeft:M.scrollLeft,scrollTop:M.scrollTop},tt.preventDefault());};return M.addEventListener("scroll",G),L.addEventListener("scroll",Q),M.addEventListener("mousedown",et),document.addEventListener("mousemove",ue),document.addEventListener("mouseup",we),()=>{M.removeEventListener("scroll",G),L.removeEventListener("scroll",Q),M.removeEventListener("mousedown",et),document.removeEventListener("mousemove",ue),document.removeEventListener("mouseup",we);}},[ce,Ll,Oo]),_e.current={startDate:Do,timeScale:Ee,zoom:R};let Il=a.onTodayVisibilityChange,xu=useRef(null);useEffect(()=>{if(!Il)return;let M=Ye.current;if(!M)return;let L=Ee==="day"?60:Ee==="week"?20:8,G=()=>{let we=(new Date().getTime()-Do.getTime())/(1e3*60*60*24)*L*R,et=M.scrollLeft,tt=et+M.clientWidth,ya=we>=et&&we<=tt;xu.current!==ya&&(xu.current=ya,Il(ya));};return G(),M.addEventListener("scroll",G,{passive:true}),window.addEventListener("resize",G),()=>{M.removeEventListener("scroll",G),window.removeEventListener("resize",G);}},[Il,Do,Ee,R]);let vu=useRef(false),Wf=useRef(null);return useLayoutEffect(()=>{if(vu.current||C.length===0||!Ye.current)return;vu.current=true,Wf.current=Do;let M=Ye.current,L=new Date,G=Ee==="day"?60:Ee==="week"?20:8,Q=(L.getTime()-Do.getTime())/(1e3*60*60*24),ue=M.clientWidth,et=Q*G*R-ue/2;Q>=0&&ue>0&&(M.scrollLeft=Math.max(0,et));},[C.length,Do,Ee,R]),jsx(qn.Provider,{value:er,children:jsx(Wl.Provider,{value:yt,children:jsxs("div",{ref:me,className:"flex flex-col h-full w-full",style:{backgroundColor:Oe.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Oe.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Oe.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx("div",{style:{position:"relative",zIndex:100},children:jsx(Ui,{theme:Oe,timeScale:Ee,onTimeScaleChange:nt,zoom:R,onZoomChange:J,currentTheme:ot,onThemeChange:Le,rowDensity:F,onRowDensityChange:le,showThemeSelector:d,showCreateTaskButton:D&&kt?.canCreateTask!==false&&!kt?.canCreateSubtaskOnly,createTaskLabel:A,onCreateTask:T,taskFilter:da,onTaskFilterChange:ha,hideCompleted:W,onHideCompletedChange:ne,toolbarRightContent:k,wbsLevel:O,onWbsLevelChange:gs,maxWbsDepth:Zt,viewMode:Re,onViewModeChange:Ae,projectForecast:I,onExportPNG:i?Bf:void 0,onExportPDF:i?Rf:void 0,onExportExcel:i?Of:void 0,onExportCSV:i?$f:void 0,onExportJSON:i?Hf:void 0,onExportMSProject:i?zf:void 0,showCriticalPath:ct,onShowCriticalPathChange:Ut,showDependencies:st,onShowDependenciesChange:gt,highlightWeekends:jt,onHighlightWeekendsChange:Mt,showBaseline:Pe,onShowBaselineChange:M=>{M&&Re!=="oracle"&&Ae("oracle"),!M&&Re==="oracle"&&Ae("execution");},onCopySnapshotLink:Ht,hasDependencies:Dt})}),jsxs("div",{ref:Se,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:Fe,className:"gantt-grid-scroll flex-shrink-0",style:{width:ye,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(Gi,{tasks:Ea,allTasks:wa,theme:Oe,rowHeight:Xa,availableUsers:p,templates:ea,showCriticalPath:ct,onTaskClick:q,onTaskDblClick:gu,onTaskContextMenu:B,onTaskToggle:Vt,scrollTop:Tt,columns:Gr,onToggleColumn:ta,onColumnResize:ma,onTaskUpdate:Ft,onBulkFill:Ua,onTaskIndent:hr,onTaskOutdent:kr,onTaskMove:tr,onMultiTaskDelete:No,onTaskDuplicate:bs,onTaskCreate:ln,onTaskRename:Pf,onCreateSubtask:Pl,onOpenTaskModal:q?M=>q(M):void 0,onDeleteRequest:(M,L)=>oe({taskIds:M,taskName:L}),onTaskReparent:fr,scrollContainerRef:Fe})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:Oe.border,zIndex:15},onMouseDown:Uf}),jsx("div",{ref:Ye,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Ll?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Ji,{tasks:Ea,theme:Oe,rowHeight:Xa,timeScale:Ee,startDate:Do,endDate:Fl,zoom:R,locale:w,templates:ea,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:q,onTaskDblClick:gu,onTaskContextMenu:Lf,onTaskDateChange:Af,onTaskProgressDrag:Ff,onDependencyCreate:bu,onDependencyDelete:hu,showBaseline:Pe,showCriticalPath:ct,showDependencies:st,highlightWeekends:jt,canEditTask:kt?.canEditTask,workingDaysConfig:a?.workingDaysConfig})})]}),wt.task&&jsx(Jn,{isOpen:wt.isOpen,x:wt.x,y:wt.y,theme:Oe,onClose:()=>_({isOpen:false,x:0,y:0,task:null}),items:(()=>{let M=wt.task;if(!M)return [];let L=Ie.findTaskById(C,M.id)||M,G=L.subtasks&&L.subtasks.length>0,Q=kt?.canCreateTask!==false,ue=kt?.canDeleteTask!==false;if(G){let aa=[],ka=kt?.canDuplicateTask!==false;return Q&&aa.push({id:"addSubtask",label:er.contextMenu?.addSubtask||"Add Subtask",icon:va.Add,onClick:()=>{te?te(L):Pl(L.id);}}),ka&&aa.push({id:"duplicate",label:er.contextMenu?.duplicateTask||"Duplicate Task",icon:va.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(L):$(br=>$s(br,[L.id]).tasks),_({isOpen:false,x:0,y:0,task:null});}}),ue&&(aa.length>0&&aa.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),aa.push({id:"delete",label:er.contextMenu?.deleteTask||"Delete Task",icon:va.Delete,onClick:()=>{oe({taskIds:[L.id],taskName:L.name});}})),aa}let we=kt?.canUpdateTask!==false,et=kt?.canDuplicateTask!==false,tt=[];return we&&tt.push({id:"edit",label:er.contextMenu?.editTask||"Edit Task",icon:va.Pencil,onClick:()=>{z?z(L):ae(L);}}),Q&&tt.push({id:"addSubtask",label:er.contextMenu?.addSubtask||"Add Subtask",icon:va.Add,onClick:()=>{te?te(L):Pl(L.id);}}),tt.length>0&&we&&tt.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),we&&(tt.push({id:"markIncomplete",label:er.contextMenu?.markIncomplete||"Mark Incomplete",icon:va.MarkIncomplete,onClick:()=>{xe?xe(L):Ft(L.id,{status:"todo",progress:0});},disabled:L.status==="todo"}),tt.push({id:"setInProgress",label:er.contextMenu?.setInProgress||"Set In Progress",icon:va.SetInProgress,onClick:()=>{je?je(L):Ft(L.id,{status:"in-progress"});},disabled:L.status==="in-progress"}),tt.push({id:"markComplete",label:er.contextMenu?.markComplete||"Mark Complete",icon:va.MarkComplete,onClick:()=>{Ft(L.id,{status:"completed",progress:100});},disabled:L.status==="completed"})),(et||we&&L.startDate&&L.endDate)&&tt.length>0&&tt.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),et&&tt.push({id:"duplicate",label:er.contextMenu?.duplicateTask||"Duplicate Task",icon:va.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(L):$(aa=>$s(aa,[L.id]).tasks),_({isOpen:false,x:0,y:0,task:null});}}),we&&L.startDate&&L.endDate&&tt.push({id:"split",label:er.contextMenu?.splitTask||"Split Task",icon:va.Split,onClick:()=>{let aa=L.startDate.getTime(),ka=L.endDate.getTime(),br=aa+(ka-aa)/2,$r=new Date(br);If(L,$r);}}),ue&&(tt.length>0&&tt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),tt.push({id:"delete",label:er.contextMenu?.deleteTask||"Delete Task",icon:va.Delete,onClick:()=>{oe({taskIds:[L.id],taskName:L.name});}})),tt})()}),jsx(Mo,{task:ge,isOpen:!!ge,onClose:()=>ae(null),onTaskUpdate:M=>{ge&&(Ft(ge.id,M),ae(null));},theme:ot==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:p,availableTasks:t}),jsx(AnimatePresence,{children:U&&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:()=>oe(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:M=>M.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Oe.bgSecondary,border:`1px solid ${Oe.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Oe.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:Oe.textPrimary,fontFamily:"Inter, sans-serif"},children:[er.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:Oe.textSecondary,fontFamily:"Inter, sans-serif"},children:w==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsx("p",{className:"text-sm leading-relaxed",style:{color:Oe.textSecondary,fontFamily:"Inter, sans-serif"},children:U.taskIds.length>1?jsxs(Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar":"You are about to delete"," ",jsxs("span",{className:"font-semibold",style:{color:Oe.textPrimary},children:[U.taskIds.length," ",w==="es"?"tareas":"tasks"]}),"."]}):jsxs(Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:Oe.textPrimary},children:['"',U.taskName,'"']}),"."]})})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Oe.bgPrimary,borderTop:`1px solid ${Oe.border}`},children:[jsx("button",{onClick:()=>oe(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Oe.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=Oe.hoverBg;},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{No(U.taskIds),oe(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:M=>{M.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),x?.enabled&&jsx(el,{tasks:C,theme:Oe,config:x,onTasksUpdate:$,onTaskUpdate:Ft,onTaskCreate:M=>{$(L=>[...L,M]);},onTaskDelete:M=>{No([M]);},onDependencyCreate:(M,L)=>{let G=Ie.findTaskById(C,M);G&&bu(G,L);},onDependencyDelete:hu})]})})})});function y2(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 x2(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),d=parseInt(a[2],10);return l*60+d}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let n=t.match(/(\d+)m/);if(n&&n[1])return parseInt(n[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let o=t.match(/^(\d+)$/);return o&&o[1]?parseInt(o[1],10)*60:null}var tc=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],ac=[{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 Qm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:n=[],onSubmit:s,isLoading:o=false,mode:l=a?"edit":"create",theme:d="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:m,attachments:p=[],onUploadAttachments:g,onDeleteAttachment:f,defaultStatus:v}){let y=[...tc,...i.filter(F=>!tc.some(le=>le.id===F.id))],b=xt[d]||xt.dark,[h,x]=useState(false),[w,N]=useState(false),[D,A]=useState(false),[T,E]=useState(false),[P,k]=useState({top:0,left:0}),[K,H]=useState(null),[ee,I]=useState(new Date),[Y,q]=useState({top:0,left:0}),[V,B]=useState(false),[X$1,Te]=useState([]),[He,z]=useState(false),[te,xe]=useState(""),je=useRef(null),Ne=useRef(null),ze=useRef(null),Me=useRef(null),at=useRef(null),[be,pt]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[Ke,Ue]=useState({});useEffect(()=>{a?(pt({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#00E5CC",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[],parentId:a.parentId||null,location:a.location||"",equipment:a.equipment||""}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&B(true)):(pt({name:"",description:"",progress:0,status:v||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),B(false),Te([]));},[a,e,v]),useEffect(()=>{let F=le=>{je.current&&!je.current.contains(le.target)&&x(false),Ne.current&&!Ne.current.contains(le.target)&&N(false),ze.current&&!ze.current.contains(le.target)&&A(false),Me.current&&!Me.current.contains(le.target)&&E(false);};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[]);let kt=()=>{let F={};return be.name.trim()||(F.name="El nombre es requerido"),be.startDate&&be.endDate&&be.startDate>be.endDate&&(F.endDate="La fecha de fin debe ser posterior a la de inicio"),Ue(F),Object.keys(F).length===0},Ht=async F=>{if(F.preventDefault(),!!kt())try{let le=l==="create"&&X$1.length>0?{...be,pendingFiles:X$1}:be;await s(le),Te([]),t();}catch(le){console.error("Error submitting task:",le);}},qe=(F,le)=>{pt(R=>{let J={...R,[F]:le};if(F==="status"){let O=le;O==="todo"?J.progress=0:O==="in-progress"?(R.progress===0||R.progress===100)&&(J.progress=50):O==="completed"||O==="closed"?J.progress=100:(O==="in-review"||O==="review")&&(J.progress=75);}if(F==="progress"){let O=typeof le=="number"?le:parseInt(le,10);O===100&&R.status!=="completed"?J.status="completed":O>0&&O<100&&R.status==="todo"?J.status="in-progress":O===0&&R.status!=="todo"&&(J.status="todo");}return J}),Ke[F]&&Ue(R=>{let J={...R};return delete J[F],J});},We=y.find(F=>F.id===be.status)??tc[0],ot=ac.find(F=>F.id===be.priority)??ac[1],zt=fn.find(F=>F.value===be.color)??fn[0],Ee=d==="dark",nt={backgroundColor:Ee?"#1d1f27":b.bgSecondary,border:`1px solid ${Ee?"rgba(65,71,84,0.1)":b.borderLight}`,color:b.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:Ee?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsx(motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":d,style:{backgroundColor:Ee?"#0a0a0a":b.bgPrimary,border:`1px solid ${Ee?"rgba(65,71,84,0.1)":b.border}`,boxShadow:Ee?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:F=>F.stopPropagation(),children:jsxs("form",{onSubmit:Ht,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsx("input",{type:"text",value:be.name,onChange:F=>qe("name",F.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:b.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:o,autoFocus:true}),Ke.name&&jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Ke.name]}),jsx("textarea",{value:be.description||"",onChange:F=>qe("description",F.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:b.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":b.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:o})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:je,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&x(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...nt,borderColor:We.color,backgroundColor:`${We.color}15`},disabled:o,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:We.color}}),jsx("span",{style:{color:We.color},children:We.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:We.color}})]}),jsx(AnimatePresence,{children:h&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:Ee?"#0a0a0a":b.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":b.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:y.map(F=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:le=>le.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{qe("status",F.id),x(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:F.color}}),F.title,be.status===F.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},F.id))})})]}),jsxs("div",{ref:Ne,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&N(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:nt,disabled:o,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:ot.color}}),jsx("span",{children:ot.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:w&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:Ee?"#0a0a0a":b.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":b.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:ac.map(F=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:le=>le.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{qe("priority",F.id),N(false);},children:[jsx("span",{children:F.icon}),F.label,be.priority===F.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},F.id))})})]}),n.length>0&&jsxs("div",{ref:ze,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&A(!D),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:nt,disabled:o,children:[be.assignees&&be.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:be.assignees.slice(0,3).map((F,le)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:F.color||b.accent,borderColor:b.bgSecondary},children:F.initials},le))}),be.assignees.length>3&&jsxs("span",{style:{color:b.textTertiary},children:["+",be.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:b.textTertiary}}),jsx("span",{style:{color:b.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:D&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:Ee?"#0a0a0a":b.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":b.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(F=>{let le=be.assignees?.some(R=>R.name===F.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:R=>R.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:R=>R.currentTarget.style.backgroundColor="transparent",onClick:()=>{let R=le?(be.assignees||[]).filter(J=>J.name!==F.name):[...be.assignees||[],{name:F.name,avatar:F.avatar,initials:F.name.split(" ").map(J=>J[0]).join("").toUpperCase().slice(0,2),color:b.accent}];qe("assignees",R);},children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:b.accent},children:F.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:F.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:le&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:b.accent}})})]},F.id)})})})]}),jsxs("div",{ref:Me,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!o)if(T)E(false);else {if(Me.current){let F=Me.current.getBoundingClientRect(),le=window.innerHeight,R=120,O=le-F.bottom<R?F.top-R-8:F.bottom+8;k({top:O,left:F.left});}E(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:nt,disabled:o,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:be.color}}),jsx("span",{children:zt.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:T&&jsxs(ra,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>E(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${P.top}px`,left:`${P.left}px`,zIndex:99999,backgroundColor:Ee?"#0a0a0a":b.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":b.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:F=>F.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:fn.slice(0,18).map(F=>{let le=be.color===F.value;return jsx("button",{type:"button",onClick:R=>{R.preventDefault(),R.stopPropagation(),qe("color",F.value),E(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:F.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:F.value,outline:le?`2px solid ${F.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},F.value)})})})})]})})]}),u.length>0||m?jsx(Wo,{selectedTags:be.tags||[],availableTags:u,onChange:F=>qe("tags",F),onCreateTag:m,theme:b,disabled:o}):null]}),jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxs("div",{className:"space-y-3",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:Ee?"#191b22":b.bgSecondary,borderRadius:8,border:`1px solid ${Ee?"rgba(65,71,84,0.05)":b.borderLight}`,padding:"10px 16px"},children:[jsx(Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxs("div",{ref:at,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!o&&!be.isMilestone)if(K==="start")H(null);else {if(at.current){let F=at.current.getBoundingClientRect();q({top:F.bottom+8,left:Math.max(16,F.left-40)});}H("start"),I(be.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...nt,opacity:be.isMilestone?.5:1,cursor:be.isMilestone?"not-allowed":"pointer"},disabled:o||be.isMilestone,children:be.startDate?be.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:b.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!o&&!be.isMilestone)if(K==="end")H(null);else {if(at.current){let F=at.current.getBoundingClientRect();q({top:F.bottom+8,left:Math.max(16,F.left-40)});}H("end"),I(be.endDate||be.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...nt,opacity:be.isMilestone?.5:1,cursor:be.isMilestone?"not-allowed":"pointer"},disabled:o||be.isMilestone,children:be.endDate?be.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:K&&jsxs(ra,{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:`${Y.top}px`,left:`${Y.left}px`,zIndex:99999,backgroundColor:Ee?"#0a0a0a":b.bgPrimary,border:`1px solid ${Ee?"#262626":b.border}`,boxShadow:Ee?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:F=>F.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${Ee?"#262626":b.border}`},children:[(()=>{let F=new Date,le=new Date(F);le.setDate(F.getDate()+1);let R=new Date(F);R.setDate(F.getDate()+7);let J=new Date(F);return J.setDate(F.getDate()+14),[{label:"Hoy",date:F},{label:"Ma\xF1ana",date:le},{label:"Pr\xF3xima semana",date:R},{label:"2 semanas",date:J}].map((Z,Ve)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:ke=>ke.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:ke=>ke.currentTarget.style.backgroundColor="transparent",onClick:()=>{K==="start"?(qe("startDate",Z.date),(!be.endDate||Z.date>be.endDate)&&qe("endDate",Z.date),H("end")):(qe("endDate",Z.date),(!be.startDate||Z.date<be.startDate)&&qe("startDate",Z.date),H(null));},children:Z.label},Ve))})(),jsx("div",{style:{borderTop:`1px solid ${b.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:F=>F.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:F=>F.currentTarget.style.backgroundColor="transparent",onClick:()=>{qe("startDate",void 0),qe("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:()=>I(new Date(ee.getFullYear(),ee.getMonth()-1)),className:"p-1 rounded",onMouseEnter:F=>F.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:F=>F.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:b.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:b.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:ee.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>I(new Date(ee.getFullYear(),ee.getMonth()+1)),className:"p-1 rounded",onMouseEnter:F=>F.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:F=>F.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:b.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((F,le)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:b.textTertiary},children:F},le))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let F=ee.getFullYear(),le=ee.getMonth(),R=new Date(F,le,1).getDay(),J=new Date(F,le+1,0).getDate(),O=new Date,Z=[];for(let ke=R-1;ke>=0;ke--)Z.push({day:new Date(F,le,-ke).getDate(),date:new Date(F,le-1,new Date(F,le,-ke).getDate()),isCurrentMonth:false});for(let ke=1;ke<=J;ke++)Z.push({day:ke,date:new Date(F,le,ke),isCurrentMonth:true});let Ve=42-Z.length;for(let ke=1;ke<=Ve;ke++)Z.push({day:ke,date:new Date(F,le+1,ke),isCurrentMonth:false});return Z.map((ke,Re)=>{let Ae=ke.date.toDateString()===O.toDateString(),Pe=be.startDate?.toDateString()===ke.date.toDateString(),ct=be.endDate?.toDateString()===ke.date.toDateString(),Qe=be.startDate&&be.endDate&&ke.date>=be.startDate&&ke.date<=be.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:ke.isCurrentMonth?Pe||ct?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:Pe?b.accent:ct?"#7C3AED":Qe?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ae&&!Pe&&!ct?`inset 0 0 0 1px ${b.accent}`:"none"},onClick:()=>{K==="start"?(qe("startDate",ke.date),be.endDate&&ke.date>be.endDate&&qe("endDate",ke.date),H("end")):(qe("endDate",ke.date),be.startDate&&ke.date<be.startDate&&qe("startDate",ke.date),H(null));},children:ke.day},Re)})})()})]})]})]})})]}),Ke.endDate&&jsx("span",{className:"text-xs text-red-400",children:Ke.endDate})]})]}),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary},children:"Progreso Inicial"}),jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[be.progress,"%"]})]}),jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Ee?"#33343c":"#E5E7EB"},onClick:F=>{if(o)return;let le=F.currentTarget.getBoundingClientRect(),R=Math.round((F.clientX-le.left)/le.width*100/5)*5;qe("progress",Math.max(0,Math.min(100,R)));},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${be.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxs("div",{style:{borderTop:`1px solid ${Ee?"rgba(65,71,84,0.05)":b.borderLight}`,paddingTop:16},children:[jsxs("button",{type:"button",onClick:()=>B(!V),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:b.textPrimary},children:[jsx(ChevronDown,{className:`w-4 h-4 transition-transform ${V?"":"-rotate-90"}`,style:{color:b.textTertiary}}),jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsx(AnimatePresence,{children:V&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Horas Estimadas"})]}),jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:be.effortMinutes?y2(be.effortMinutes):"",onChange:F=>{let le=x2(F.target.value);qe("effortMinutes",le);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`}})]}),r.length>0&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Fase Padre"})]}),jsxs("select",{value:be.parentId||"",onChange:F=>qe("parentId",F.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o,children:[jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(F=>F.id!==a?.id).map(F=>jsx("option",{value:F.id,children:F.name},F.id))]})]}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Ubicaci\xF3n"})]}),jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:be.location||"",onChange:F=>qe("location",F.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Activo / Equipo"})]}),jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:be.equipment||"",onChange:F=>qe("equipment",F.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]})]}),(g||p.length>0||l==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxs("span",{className:"text-xs",style:{color:b.textTertiary},children:["Adjuntos ",l==="create"?X$1.length>0&&`(${X$1.length})`:p.length>0&&`(${p.length})`]})]}),l==="create"?jsx(xo,{cardId:"pending",attachments:X$1.map((F,le)=>({id:`pending-${le}`,cardId:"pending",name:F.name,size:F.size,type:F.type,url:URL.createObjectURL(F),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:F=>Te(le=>[...le,...F]),onDelete:F=>{let le=parseInt(F.replace("pending-",""),10);Te(R=>R.filter((J,O)=>O!==le));},maxSizeMB:10,maxFiles:20}):jsx(xo,{cardId:a?.id||"new",attachments:p,onUpload:g&&a?.id?F=>g(a.id,F):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),l==="create"&&X$1.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:b.textTertiary},children:[X$1.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:F=>F.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:F=>F.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:be.isMilestone,onChange:F=>qe("isMilestone",F.target.checked),className:"w-4 h-4 rounded",style:{accentColor:b.accent},disabled:o}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:b.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:b.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),be.dependencies&&be.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:be.dependencies.map(F=>{let le=r.find(R=>R.id===F);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${b.accent}20`,color:b.accent},children:[le?.name||F.slice(0,8),jsx("button",{type:"button",onClick:()=>{let R=(be.dependencies||[]).filter(J=>J!==F);qe("dependencies",R);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:o,children:jsx(X,{className:"w-3 h-3"})})]},F)})}),jsxs("button",{type:"button",onClick:()=>{z(!He),xe("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textSecondary},disabled:o,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:He&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{z(false),xe("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:Ee?"#0a0a0a":b.bgPrimary,backdropFilter:Ee?"blur(16px)":void 0,border:`1px solid ${Ee?"#262626":b.border}`,boxShadow:Ee?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${b.border}`},children:jsx("input",{type:"text",value:te,onChange:F=>xe(F.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:b.bgSecondary,color:b.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(F=>F.id!==a?.id).filter(F=>te===""||F.name.toLowerCase().includes(te.toLowerCase())).map(F=>{let le=be.dependencies?.includes(F.id);return jsxs("button",{type:"button",onClick:()=>{let R=be.dependencies||[],J;le?J=R.filter(O=>O!==F.id):J=[...R,F.id],qe("dependencies",J);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:le?`${b.accent}10`:"transparent"},onMouseEnter:R=>{le||(R.currentTarget.style.backgroundColor=b.hoverBg);},onMouseLeave:R=>{R.currentTarget.style.backgroundColor=le?`${b.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:le?b.accent:"transparent",borderColor:le?b.accent:b.borderLight},children:le&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:b.textPrimary},children:F.name}),jsx("span",{className:"text-[10px]",style:{color:b.textTertiary},children:F.id.slice(0,8)})]})]},F.id)}),r.filter(F=>F.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:b.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${Ee?"rgba(65,71,84,0.1)":b.border}`,backgroundColor:Ee?"rgba(25,27,34,0.2)":void 0},children:[jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:b.textTertiary},onMouseEnter:F=>F.currentTarget.style.color=b.textPrimary,onMouseLeave:F=>F.currentTarget.style.color=b.textTertiary,disabled:o,children:"Cancelar"}),jsx("button",{type:"submit",disabled:o,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#00E5CC",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:F=>!o&&(F.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:F=>!o&&(F.currentTarget.style.filter="brightness(1)"),children:o?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:l==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var Zm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
368
+ Task dependencies must flow in one direction only.`);return}let z=Y=>Y.map(oe=>{if(oe.id===A){let me=oe.dependencies||[];if(!me.includes(M.id))return {...oe,dependencies:[...me,M.id]}}return oe.subtasks?{...oe,subtasks:z(oe.subtasks)}:oe});Ut.current+=1,$(Y=>z(Y)),ke?.(M.id,A);},[ke,yu]),vu=useCallback((M,A)=>{let z=Y=>Y.map(oe=>{if(oe.id===M&&oe.dependencies){let me=oe.dependencies.filter(Ge=>Ge!==A);return {...oe,dependencies:me}}return oe.subtasks?{...oe,subtasks:z(oe.subtasks)}:oe});Ut.current+=1,$(Y=>z(Y)),Ie?.(M,A);},[Ie]),{startDate:Fn,endDate:Wl}=useMemo(()=>{let M=C.filter(me=>me.startDate&&me.endDate);if(M.length===0){let me=new Date,Ge=new Date(me);Ge.setDate(Ge.getDate()-30);let Ve=new Date(me);return Ve.setDate(Ve.getDate()+60),{startDate:Ge,endDate:Ve}}let A=M.flatMap(me=>[me.startDate,me.endDate]).filter(me=>me!==void 0),z=new Date(Math.min(...A.map(me=>me.getTime()))),Y=new Date(Math.max(...A.map(me=>me.getTime()))),oe=Fe==="day"?7:Fe==="week"?14:30;return z.setDate(z.getDate()-oe),Y.setDate(Y.getDate()+oe),{startDate:z,endDate:Y}},[C,Fe]);useEffect(()=>{St.current?.(Fn,Wl);},[Fn,Wl]);let ab=useCallback(async()=>{if(!ie.current||!we.current||!Oe.current)return;await new Promise(fo=>setTimeout(fo,200));let M=ie.current,A=we.current,z=Ce.current||A.querySelector(".gantt-grid-scroll"),Y=Oe.current,oe=z?.scrollTop||0,me=z?.scrollLeft||0,Ge=Y.scrollTop,Ve=Y.scrollLeft,rr=M.style.overflow,Ot=M.style.height,ir=z?.style.overflow||"",ma=Y.style.overflow,Ra=A.style.overflow,jn=M.style.width,Uo=Y.style.width;try{let fo=z?.querySelector(".gantt-taskgrid-content"),yn=Y.querySelector("svg"),jl=yn?.getAttribute("height")?parseInt(yn.getAttribute("height"),10):yn?.getBoundingClientRect().height||0,Wo=fo?.scrollHeight||z?.scrollHeight||600,mi=Math.max(jl,Y.scrollHeight),Ns=yn?.getAttribute("width")?parseInt(yn.getAttribute("width"),10):yn?.getBoundingClientRect().width||Y.scrollWidth,ub=M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,_l=Math.max(Wo,mi,jl),Tu=ub+_l+50,Nu=(z?.offsetWidth||A.offsetWidth||300)+Ns+10;z&&(z.scrollTop=0,z.scrollLeft=0),Y.scrollTop=0,Y.scrollLeft=0,M.style.overflow="visible",M.style.height=`${Tu}px`,M.style.width=`${Nu}px`,A.style.overflow="visible",z&&(z.style.overflow="visible",z.style.height=`${_l+50}px`),Y.style.overflow="visible",Y.style.height=`${_l+50}px`,Y.style.width=`${Ns+10}px`,await new Promise(gi=>setTimeout(gi,150));let pb=await toPng(M,{backgroundColor:Me.bgPrimary,pixelRatio:2,width:Nu,height:Tu,skipFonts:!1,filter:gi=>{if(!(gi instanceof Element))return !0;let Du=window.getComputedStyle(gi),Su=parseInt(Du.zIndex,10);return !(!isNaN(Su)&&Su>=50||Du.position==="fixed")}}),Kl=document.createElement("a");Kl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Kl.href=pb,Kl.click();}finally{M.style.overflow=rr,M.style.height=Ot,M.style.width=jn,A.style.overflow=Ra,z&&(z.style.overflow=ir,z.style.height="",z.scrollTop=oe,z.scrollLeft=me),Y.style.overflow=ma,Y.style.height="",Y.style.width=Uo,Y.scrollTop=Ge,Y.scrollLeft=Ve;}d?.("png");},[Me,d]),nb=useCallback(async()=>{await Ne.exportToPDF(C),d?.("pdf");},[C,d]),zl=useRef({rateMap:r.rateMap,defaultRate:r.defaultRate,projectName:u});zl.current={rateMap:r.rateMap,defaultRate:r.defaultRate,projectName:u};let ob=useCallback(async()=>{if(r.onExportExcel){await r.onExportExcel(),d?.("excel");return}let M=new Date,A=oe=>String(oe).padStart(2,"0"),z=`${M.getFullYear()}-${A(M.getMonth()+1)}-${A(M.getDate())}_${A(M.getHours())}${A(M.getMinutes())}`,Y=u?u.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Ne.exportToExcel(C,`${Y}_${z}.xlsx`,zl.current),d?.("excel");},[C,u,d,r.onExportExcel]),sb=useCallback(()=>{let M=Ne.exportToCSV(C),A=new Blob([M],{type:"text/csv;charset=utf-8;"}),z=document.createElement("a");z.href=URL.createObjectURL(A),z.download="gantt-chart.csv",z.click(),URL.revokeObjectURL(z.href),d?.("csv");},[C,d]),ib=useCallback(()=>{let M=Ne.exportToJSON(C),A=new Blob([M],{type:"application/json;charset=utf-8;"}),z=document.createElement("a");z.href=URL.createObjectURL(A),z.download="gantt-chart.json",z.click(),URL.revokeObjectURL(z.href),d?.("json");},[C,d]),lb=useCallback(()=>{Ne.exportToMSProject(C,"Gantt Project","project.xml"),d?.("msproject");},[C,d]),cb=M=>{M.preventDefault(),pe(true);},Ho=useRef(false),[Gl,wu]=useState(false),Ts=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let M=Oe.current,A=we.current?.querySelector(".gantt-grid-scroll");if(!M||!A)return;let z=()=>{if(Ho.current)return;Ho.current=true;let Ve=M.scrollTop;Zr(Ve),A.scrollTop=Ve,requestAnimationFrame(()=>{Ho.current=false;});},Y=()=>{if(Ho.current)return;Ho.current=true;let Ve=A.scrollTop;Zr(Ve),M.scrollTop=Ve,requestAnimationFrame(()=>{Ho.current=false;});},oe=Ve=>{if(ne&&A){let Ot=A.parentElement?.getBoundingClientRect()?.left||0,ir=Ve.clientX-Ot,ma=200,Ra=Vn+S,jn=window.innerWidth*Q,Uo=Math.max(Ra,jn);ir>=ma&&ir<=Uo&&je(ir);}if(Gl&&M){let rr=Ve.clientX-Ts.current.x,Ot=Ve.clientY-Ts.current.y;M.scrollLeft=Ts.current.scrollLeft-rr,M.scrollTop=Ts.current.scrollTop-Ot;}},me=()=>{pe(false),wu(false);},Ge=Ve=>{if(Ve.button!==0)return;let rr=Ve.target;rr.closest("[data-task-bar]")||rr.closest("[data-dependency-line]")||rr.closest("button")||rr.closest('[role="button"]')||rr.tagName==="rect"&&rr.getAttribute("data-clickable")==="true"||(wu(true),Ts.current={x:Ve.clientX,y:Ve.clientY,scrollLeft:M.scrollLeft,scrollTop:M.scrollTop},Ve.preventDefault());};return M.addEventListener("scroll",z),A.addEventListener("scroll",Y),M.addEventListener("mousedown",Ge),document.addEventListener("mousemove",oe),document.addEventListener("mouseup",me),()=>{M.removeEventListener("scroll",z),A.removeEventListener("scroll",Y),M.removeEventListener("mousedown",Ge),document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",me);}},[ne,Gl,Vn]),Re.current={startDate:Fn,timeScale:Fe,zoom:R};let Vl=r.onTodayVisibilityChange,ku=useRef(null);useEffect(()=>{if(!Vl)return;let M=Oe.current;if(!M)return;let A=Fe==="day"?60:Fe==="week"?20:8,z=()=>{let me=(new Date().getTime()-Fn.getTime())/(1e3*60*60*24)*A*R,Ge=M.scrollLeft,Ve=Ge+M.clientWidth,rr=me>=Ge&&me<=Ve;ku.current!==rr&&(ku.current=rr,Vl(rr));};return z(),M.addEventListener("scroll",z,{passive:true}),window.addEventListener("resize",z),()=>{M.removeEventListener("scroll",z),window.removeEventListener("resize",z);}},[Vl,Fn,Fe,R]);let Cu=useRef(false),db=useRef(null);return useLayoutEffect(()=>{if(Cu.current||C.length===0||!Oe.current)return;Cu.current=true,db.current=Fn;let M=Oe.current,A=new Date,z=Fe==="day"?60:Fe==="week"?20:8,Y=(A.getTime()-Fn.getTime())/(1e3*60*60*24),oe=M.clientWidth,Ge=Y*z*R-oe/2;Y>=0&&oe>0&&(M.scrollLeft=Math.max(0,Ge));},[C.length,Fn,Fe,R]),jsx(es.Provider,{value:Kr,children:jsx(Ql.Provider,{value:st,children:jsxs("div",{ref:ie,className:"flex flex-col h-full w-full",style:{backgroundColor:Me.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Me.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Me.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx("div",{style:{position:"relative",zIndex:100},children:jsx(Ki,{theme:Me,timeScale:Fe,onTimeScaleChange:Xe,zoom:R,onZoomChange:q,currentTheme:ot,onThemeChange:Te,rowDensity:L,onRowDensityChange:ae,showThemeSelector:l,showCreateTaskButton:E&&gt?.canCreateTask!==false&&!gt?.canCreateSubtaskOnly,createTaskLabel:F,onCreateTask:k,taskFilter:kr,onTaskFilterChange:oa,hideCompleted:Ze,onHideCompletedChange:Ye,toolbarRightContent:N,wbsLevel:U,onWbsLevelChange:ws,maxWbsDepth:Rt,viewMode:et,onViewModeChange:rt,projectForecast:I,onExportPNG:i?ab:void 0,onExportPDF:i?nb:void 0,onExportExcel:i?ob:void 0,onExportCSV:i?sb:void 0,onExportJSON:i?ib:void 0,onExportMSProject:i?lb:void 0,showCriticalPath:At,onShowCriticalPathChange:da,showDependencies:jt,onShowDependenciesChange:qt,highlightWeekends:or,onHighlightWeekendsChange:gr,showBaseline:Qe,onShowBaselineChange:M=>{M&&et!=="oracle"&&rt("oracle"),!M&&et==="oracle"&&rt("execution");},onCopySnapshotLink:Ft,hasDependencies:ut})}),jsxs("div",{ref:we,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:Ce,className:"gantt-grid-scroll flex-shrink-0",style:{width:ue,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(Xi,{tasks:hr,allTasks:sr,theme:Me,rowHeight:Gr,availableUsers:p,templates:Bt,showCriticalPath:At,onTaskClick:j,onTaskDblClick:hu,onTaskContextMenu:B,onTaskToggle:Ct,scrollTop:Xt,columns:za,onToggleColumn:$t,onColumnResize:Jt,onTaskUpdate:ft,onBulkFill:Ar,onTaskIndent:ga,onTaskOutdent:xa,onTaskMove:qr,onMultiTaskDelete:Pn,onTaskDuplicate:Cs,onTaskCreate:go,onTaskRename:Qf,onCreateSubtask:Ul,onOpenTaskModal:j?M=>j(M):void 0,onDeleteRequest:(M,A)=>Z({taskIds:M,taskName:A}),onTaskReparent:pa,scrollContainerRef:Ce})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:Me.border,zIndex:15},onMouseDown:cb}),jsx("div",{ref:Oe,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Gl?"grabbing":"grab",...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(al,{tasks:hr,theme:Me,rowHeight:Gr,timeScale:Fe,startDate:Fn,endDate:Wl,zoom:R,locale:w,templates:Bt,dependencyLineStyle:r?.dependencyLineStyle,showTaskBarLabels:r?.showTaskBarLabels!==false,onTaskClick:j,onTaskDblClick:hu,onTaskContextMenu:tb,onTaskDateChange:eb,onTaskProgressDrag:Zf,onDependencyCreate:xu,onDependencyDelete:vu,showBaseline:Qe,showCriticalPath:At,showDependencies:jt,highlightWeekends:or,canEditTask:gt?.canEditTask,workingDaysConfig:r?.workingDaysConfig})})]}),it.task&&jsx(as,{isOpen:it.isOpen,x:it.x,y:it.y,theme:Me,onClose:()=>V({isOpen:false,x:0,y:0,task:null}),items:(()=>{let M=it.task;if(!M)return [];let A=Ne.findTaskById(C,M.id)||M,z=A.subtasks&&A.subtasks.length>0,Y=gt?.canCreateTask!==false,oe=gt?.canDeleteTask!==false;if(z){let Ot=[],ir=gt?.canDuplicateTask!==false;return Y&&Ot.push({id:"addSubtask",label:Kr.contextMenu?.addSubtask||"Add Subtask",icon:nr.Add,onClick:()=>{ge?ge(A):Ul(A.id);}}),ir&&Ot.push({id:"duplicate",label:Kr.contextMenu?.duplicateTask||"Duplicate Task",icon:nr.Duplicate,onClick:()=>{r.onTaskDuplicate?r.onTaskDuplicate(A):$(ma=>js(ma,[A.id]).tasks),V({isOpen:false,x:0,y:0,task:null});}}),oe&&(Ot.length>0&&Ot.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ot.push({id:"delete",label:Kr.contextMenu?.deleteTask||"Delete Task",icon:nr.Delete,onClick:()=>{Z({taskIds:[A.id],taskName:A.name});}})),Ot}let me=gt?.canUpdateTask!==false,Ge=gt?.canDuplicateTask!==false,Ve=[];return me&&Ve.push({id:"edit",label:Kr.contextMenu?.editTask||"Edit Task",icon:nr.Pencil,onClick:()=>{be?be(A):J(A);}}),Y&&Ve.push({id:"addSubtask",label:Kr.contextMenu?.addSubtask||"Add Subtask",icon:nr.Add,onClick:()=>{ge?ge(A):Ul(A.id);}}),Ve.length>0&&me&&Ve.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),me&&(Ve.push({id:"markIncomplete",label:Kr.contextMenu?.markIncomplete||"Mark Incomplete",icon:nr.MarkIncomplete,onClick:()=>{ye?ye(A):ft(A.id,{status:"todo",progress:0});},disabled:A.status==="todo"}),Ve.push({id:"setInProgress",label:Kr.contextMenu?.setInProgress||"Set In Progress",icon:nr.SetInProgress,onClick:()=>{ze?ze(A):ft(A.id,{status:"in-progress"});},disabled:A.status==="in-progress"}),Ve.push({id:"markComplete",label:Kr.contextMenu?.markComplete||"Mark Complete",icon:nr.MarkComplete,onClick:()=>{ft(A.id,{status:"completed",progress:100});},disabled:A.status==="completed"})),(Ge||me&&A.startDate&&A.endDate)&&Ve.length>0&&Ve.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Ge&&Ve.push({id:"duplicate",label:Kr.contextMenu?.duplicateTask||"Duplicate Task",icon:nr.Duplicate,onClick:()=>{r.onTaskDuplicate?r.onTaskDuplicate(A):$(Ot=>js(Ot,[A.id]).tasks),V({isOpen:false,x:0,y:0,task:null});}}),me&&A.startDate&&A.endDate&&Ve.push({id:"split",label:Kr.contextMenu?.splitTask||"Split Task",icon:nr.Split,onClick:()=>{let Ot=A.startDate.getTime(),ir=A.endDate.getTime(),ma=Ot+(ir-Ot)/2,Ra=new Date(ma);rb(A,Ra);}}),oe&&(Ve.length>0&&Ve.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Ve.push({id:"delete",label:Kr.contextMenu?.deleteTask||"Delete Task",icon:nr.Delete,onClick:()=>{Z({taskIds:[A.id],taskName:A.name});}})),Ve})()}),jsx(ko,{task:le,isOpen:!!le,onClose:()=>J(null),onTaskUpdate:M=>{le&&(ft(le.id,M),J(null));},theme:ot==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:p,availableTasks:t}),jsx(AnimatePresence,{children:O&&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:()=>Z(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:M=>M.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Me.bgSecondary,border:`1px solid ${Me.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Me.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:Me.textPrimary,fontFamily:"Inter, sans-serif"},children:[Kr.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:Me.textSecondary,fontFamily:"Inter, sans-serif"},children:w==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsx("p",{className:"text-sm leading-relaxed",style:{color:Me.textSecondary,fontFamily:"Inter, sans-serif"},children:O.taskIds.length>1?jsxs(Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar":"You are about to delete"," ",jsxs("span",{className:"font-semibold",style:{color:Me.textPrimary},children:[O.taskIds.length," ",w==="es"?"tareas":"tasks"]}),"."]}):jsxs(Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:Me.textPrimary},children:['"',O.taskName,'"']}),"."]})})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Me.bgPrimary,borderTop:`1px solid ${Me.border}`},children:[jsx("button",{onClick:()=>Z(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Me.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=Me.hoverBg;},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{Pn(O.taskIds),Z(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:M=>{M.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),v?.enabled&&jsx(sl,{tasks:C,theme:Me,config:v,onTasksUpdate:$,onTaskUpdate:ft,onTaskCreate:M=>{$(A=>[...A,M]);},onTaskDelete:M=>{Pn([M]);},onDependencyCreate:(M,A)=>{let z=Ne.findTaskById(C,M);z&&xu(z,A);},onDependencyDelete:vu})]})})})});function Pw(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),r=e%60;return r===0?`${t}h`:`${t}h ${r}m`}function Fw(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),r=t.match(/(\d+)h\s*(\d+)m/);if(r&&r[1]&&r[2]){let c=parseInt(r[1],10),l=parseInt(r[2],10);return c*60+l}let a=t.match(/(\d+)h/);if(a&&a[1])return parseInt(a[1],10)*60;let n=t.match(/(\d+)m/);if(n&&n[1])return parseInt(n[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let o=t.match(/^(\d+)$/);return o&&o[1]?parseInt(o[1],10)*60:null}var id=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],ld=[{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 eg({isOpen:e,onClose:t,task:r,availableTasks:a=[],availableUsers:n=[],onSubmit:s,isLoading:o=false,mode:c=r?"edit":"create",theme:l="dark",customStatuses:i=[],availableTags:d=[],onCreateTag:u,attachments:p=[],onUploadAttachments:m,onDeleteAttachment:f,defaultStatus:x}){let y=[...id,...i.filter(L=>!id.some(ae=>ae.id===L.id))],b=lt[l]||lt.dark,[h,v]=useState(false),[w,T]=useState(false),[E,F]=useState(false),[k,D]=useState(false),[P,N]=useState({top:0,left:0}),[K,H]=useState(null),[te,I]=useState(new Date),[_,j]=useState({top:0,left:0}),[W,B]=useState(false),[ve,We]=useState([]),[Le,be]=useState(false),[ge,ye]=useState(""),ze=useRef(null),ke=useRef(null),Ie=useRef(null),De=useRef(null),qe=useRef(null),[fe,tt]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[Be,$e]=useState({});useEffect(()=>{r?(tt({name:r.name,description:r.description||"",startDate:r.startDate,endDate:r.endDate,progress:r.progress,status:r.status||"todo",priority:r.priority||"medium",isMilestone:r.isMilestone||false,color:r.color||"#00E5CC",assignees:r.assignees||[],dependencies:r.dependencies||[],tags:r.tags||[],parentId:r.parentId||null,location:r.location||"",equipment:r.equipment||""}),(r.dependencies&&r.dependencies.length>0||r.isMilestone)&&B(true)):(tt({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),B(false),We([]));},[r,e,x]),useEffect(()=>{let L=ae=>{ze.current&&!ze.current.contains(ae.target)&&v(false),ke.current&&!ke.current.contains(ae.target)&&T(false),Ie.current&&!Ie.current.contains(ae.target)&&F(false),De.current&&!De.current.contains(ae.target)&&D(false);};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[]);let gt=()=>{let L={};return fe.name.trim()||(L.name="El nombre es requerido"),fe.startDate&&fe.endDate&&fe.startDate>fe.endDate&&(L.endDate="La fecha de fin debe ser posterior a la de inicio"),$e(L),Object.keys(L).length===0},Ft=async L=>{if(L.preventDefault(),!!gt())try{let ae=c==="create"&&ve.length>0?{...fe,pendingFiles:ve}:fe;await s(ae),We([]),t();}catch(ae){console.error("Error submitting task:",ae);}},He=(L,ae)=>{tt(R=>{let q={...R,[L]:ae};if(L==="status"){let U=ae;U==="todo"?q.progress=0:U==="in-progress"?(R.progress===0||R.progress===100)&&(q.progress=50):U==="completed"||U==="closed"?q.progress=100:(U==="in-review"||U==="review")&&(q.progress=75);}if(L==="progress"){let U=typeof ae=="number"?ae:parseInt(ae,10);U===100&&R.status!=="completed"?q.status="completed":U>0&&U<100&&R.status==="todo"?q.status="in-progress":U===0&&R.status!=="todo"&&(q.status="todo");}return q}),Be[L]&&$e(R=>{let q={...R};return delete q[L],q});},Ae=y.find(L=>L.id===fe.status)??id[0],ot=ld.find(L=>L.id===fe.priority)??ld[1],Lt=wo.find(L=>L.value===fe.color)??wo[0],Fe=l==="dark",Xe={backgroundColor:Fe?"#1d1f27":b.bgSecondary,border:`1px solid ${Fe?"rgba(65,71,84,0.1)":b.borderLight}`,color:b.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:Fe?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsx(motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":l,style:{backgroundColor:Fe?"#0a0a0a":b.bgPrimary,border:`1px solid ${Fe?"rgba(65,71,84,0.1)":b.border}`,boxShadow:Fe?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:L=>L.stopPropagation(),children:jsxs("form",{onSubmit:Ft,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsx("input",{type:"text",value:fe.name,onChange:L=>He("name",L.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:b.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:o,autoFocus:true}),Be.name&&jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Be.name]}),jsx("textarea",{value:fe.description||"",onChange:L=>He("description",L.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:b.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":b.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:o})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:ze,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&v(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...Xe,borderColor:Ae.color,backgroundColor:`${Ae.color}15`},disabled:o,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:Ae.color}}),jsx("span",{style:{color:Ae.color},children:Ae.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:Ae.color}})]}),jsx(AnimatePresence,{children:h&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:Fe?"#0a0a0a":b.bgPrimary,backdropFilter:Fe?"blur(16px)":void 0,border:`1px solid ${Fe?"#262626":b.border}`,boxShadow:Fe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:y.map(L=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:ae=>ae.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:ae=>ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{He("status",L.id),v(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:L.color}}),L.title,fe.status===L.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},L.id))})})]}),jsxs("div",{ref:ke,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&T(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Xe,disabled:o,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:ot.color}}),jsx("span",{children:ot.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:w&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:Fe?"#0a0a0a":b.bgPrimary,backdropFilter:Fe?"blur(16px)":void 0,border:`1px solid ${Fe?"#262626":b.border}`,boxShadow:Fe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:ld.map(L=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:ae=>ae.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:ae=>ae.currentTarget.style.backgroundColor="transparent",onClick:()=>{He("priority",L.id),T(false);},children:[jsx("span",{children:L.icon}),L.label,fe.priority===L.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},L.id))})})]}),n.length>0&&jsxs("div",{ref:Ie,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&F(!E),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Xe,disabled:o,children:[fe.assignees&&fe.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:fe.assignees.slice(0,3).map((L,ae)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:L.color||b.accent,borderColor:b.bgSecondary},children:L.initials},ae))}),fe.assignees.length>3&&jsxs("span",{style:{color:b.textTertiary},children:["+",fe.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:b.textTertiary}}),jsx("span",{style:{color:b.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:E&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:Fe?"#0a0a0a":b.bgPrimary,backdropFilter:Fe?"blur(16px)":void 0,border:`1px solid ${Fe?"#262626":b.border}`,boxShadow:Fe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(L=>{let ae=fe.assignees?.some(R=>R.name===L.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:R=>R.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:R=>R.currentTarget.style.backgroundColor="transparent",onClick:()=>{let R=ae?(fe.assignees||[]).filter(q=>q.name!==L.name):[...fe.assignees||[],{name:L.name,avatar:L.avatar,initials:L.name.split(" ").map(q=>q[0]).join("").toUpperCase().slice(0,2),color:b.accent}];He("assignees",R);},children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:b.accent},children:L.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:L.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:ae&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:b.accent}})})]},L.id)})})})]}),jsxs("div",{ref:De,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!o)if(k)D(false);else {if(De.current){let L=De.current.getBoundingClientRect(),ae=window.innerHeight,R=120,U=ae-L.bottom<R?L.top-R-8:L.bottom+8;N({top:U,left:L.left});}D(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Xe,disabled:o,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:fe.color}}),jsx("span",{children:Lt.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:k&&jsxs(lr,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>D(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${P.top}px`,left:`${P.left}px`,zIndex:99999,backgroundColor:Fe?"#0a0a0a":b.bgPrimary,backdropFilter:Fe?"blur(16px)":void 0,border:`1px solid ${Fe?"#262626":b.border}`,boxShadow:Fe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:L=>L.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:wo.slice(0,18).map(L=>{let ae=fe.color===L.value;return jsx("button",{type:"button",onClick:R=>{R.preventDefault(),R.stopPropagation(),He("color",L.value),D(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:L.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:L.value,outline:ae?`2px solid ${L.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},L.value)})})})})]})})]}),d.length>0||u?jsx(jo,{selectedTags:fe.tags||[],availableTags:d,onChange:L=>He("tags",L),onCreateTag:u,theme:b,disabled:o}):null]}),jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxs("div",{className:"space-y-3",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:Fe?"#191b22":b.bgSecondary,borderRadius:8,border:`1px solid ${Fe?"rgba(65,71,84,0.05)":b.borderLight}`,padding:"10px 16px"},children:[jsx(Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxs("div",{ref:qe,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!o&&!fe.isMilestone)if(K==="start")H(null);else {if(qe.current){let L=qe.current.getBoundingClientRect();j({top:L.bottom+8,left:Math.max(16,L.left-40)});}H("start"),I(fe.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Xe,opacity:fe.isMilestone?.5:1,cursor:fe.isMilestone?"not-allowed":"pointer"},disabled:o||fe.isMilestone,children:fe.startDate?fe.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:b.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!o&&!fe.isMilestone)if(K==="end")H(null);else {if(qe.current){let L=qe.current.getBoundingClientRect();j({top:L.bottom+8,left:Math.max(16,L.left-40)});}H("end"),I(fe.endDate||fe.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Xe,opacity:fe.isMilestone?.5:1,cursor:fe.isMilestone?"not-allowed":"pointer"},disabled:o||fe.isMilestone,children:fe.endDate?fe.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:K&&jsxs(lr,{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:`${_.top}px`,left:`${_.left}px`,zIndex:99999,backgroundColor:Fe?"#0a0a0a":b.bgPrimary,border:`1px solid ${Fe?"#262626":b.border}`,boxShadow:Fe?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:L=>L.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${Fe?"#262626":b.border}`},children:[(()=>{let L=new Date,ae=new Date(L);ae.setDate(L.getDate()+1);let R=new Date(L);R.setDate(L.getDate()+7);let q=new Date(L);return q.setDate(L.getDate()+14),[{label:"Hoy",date:L},{label:"Ma\xF1ana",date:ae},{label:"Pr\xF3xima semana",date:R},{label:"2 semanas",date:q}].map((X,Se)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:de=>de.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:de=>de.currentTarget.style.backgroundColor="transparent",onClick:()=>{K==="start"?(He("startDate",X.date),(!fe.endDate||X.date>fe.endDate)&&He("endDate",X.date),H("end")):(He("endDate",X.date),(!fe.startDate||X.date<fe.startDate)&&He("startDate",X.date),H(null));},children:X.label},Se))})(),jsx("div",{style:{borderTop:`1px solid ${b.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:L=>L.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",onClick:()=>{He("startDate",void 0),He("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:()=>I(new Date(te.getFullYear(),te.getMonth()-1)),className:"p-1 rounded",onMouseEnter:L=>L.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:b.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:b.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:te.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>I(new Date(te.getFullYear(),te.getMonth()+1)),className:"p-1 rounded",onMouseEnter:L=>L.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:b.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((L,ae)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:b.textTertiary},children:L},ae))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let L=te.getFullYear(),ae=te.getMonth(),R=new Date(L,ae,1).getDay(),q=new Date(L,ae+1,0).getDate(),U=new Date,X=[];for(let de=R-1;de>=0;de--)X.push({day:new Date(L,ae,-de).getDate(),date:new Date(L,ae-1,new Date(L,ae,-de).getDate()),isCurrentMonth:false});for(let de=1;de<=q;de++)X.push({day:de,date:new Date(L,ae,de),isCurrentMonth:true});let Se=42-X.length;for(let de=1;de<=Se;de++)X.push({day:de,date:new Date(L,ae+1,de),isCurrentMonth:false});return X.map((de,et)=>{let rt=de.date.toDateString()===U.toDateString(),Qe=fe.startDate?.toDateString()===de.date.toDateString(),At=fe.endDate?.toDateString()===de.date.toDateString(),kt=fe.startDate&&fe.endDate&&de.date>=fe.startDate&&de.date<=fe.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:de.isCurrentMonth?Qe||At?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:Qe?b.accent:At?"#7C3AED":kt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:rt&&!Qe&&!At?`inset 0 0 0 1px ${b.accent}`:"none"},onClick:()=>{K==="start"?(He("startDate",de.date),fe.endDate&&de.date>fe.endDate&&He("endDate",de.date),H("end")):(He("endDate",de.date),fe.startDate&&de.date<fe.startDate&&He("startDate",de.date),H(null));},children:de.day},et)})})()})]})]})]})})]}),Be.endDate&&jsx("span",{className:"text-xs text-red-400",children:Be.endDate})]})]}),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary},children:"Progreso Inicial"}),jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[fe.progress,"%"]})]}),jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Fe?"#33343c":"#E5E7EB"},onClick:L=>{if(o)return;let ae=L.currentTarget.getBoundingClientRect(),R=Math.round((L.clientX-ae.left)/ae.width*100/5)*5;He("progress",Math.max(0,Math.min(100,R)));},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${fe.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxs("div",{style:{borderTop:`1px solid ${Fe?"rgba(65,71,84,0.05)":b.borderLight}`,paddingTop:16},children:[jsxs("button",{type:"button",onClick:()=>B(!W),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:b.textPrimary},children:[jsx(ChevronDown,{className:`w-4 h-4 transition-transform ${W?"":"-rotate-90"}`,style:{color:b.textTertiary}}),jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsx(AnimatePresence,{children:W&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Horas Estimadas"})]}),jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:fe.effortMinutes?Pw(fe.effortMinutes):"",onChange:L=>{let ae=Fw(L.target.value);He("effortMinutes",ae);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`}})]}),a.length>0&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Fase Padre"})]}),jsxs("select",{value:fe.parentId||"",onChange:L=>He("parentId",L.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o,children:[jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),a.filter(L=>L.id!==r?.id).map(L=>jsx("option",{value:L.id,children:L.name},L.id))]})]}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Ubicaci\xF3n"})]}),jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:fe.location||"",onChange:L=>He("location",L.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Activo / Equipo"})]}),jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:fe.equipment||"",onChange:L=>He("equipment",L.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]})]}),(m||p.length>0||c==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:b.textTertiary},children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxs("span",{className:"text-xs",style:{color:b.textTertiary},children:["Adjuntos ",c==="create"?ve.length>0&&`(${ve.length})`:p.length>0&&`(${p.length})`]})]}),c==="create"?jsx(Yo,{cardId:"pending",attachments:ve.map((L,ae)=>({id:`pending-${ae}`,cardId:"pending",name:L.name,size:L.size,type:L.type,url:URL.createObjectURL(L),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:L=>We(ae=>[...ae,...L]),onDelete:L=>{let ae=parseInt(L.replace("pending-",""),10);We(R=>R.filter((q,U)=>U!==ae));},maxSizeMB:10,maxFiles:20}):jsx(Yo,{cardId:r?.id||"new",attachments:p,onUpload:m&&r?.id?L=>m(r.id,L):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),c==="create"&&ve.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:b.textTertiary},children:[ve.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:L=>L.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:fe.isMilestone,onChange:L=>He("isMilestone",L.target.checked),className:"w-4 h-4 rounded",style:{accentColor:b.accent},disabled:o}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:b.textPrimary},children:"Marcar como hito"})]}),a.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:b.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),fe.dependencies&&fe.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:fe.dependencies.map(L=>{let ae=a.find(R=>R.id===L);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${b.accent}20`,color:b.accent},children:[ae?.name||L.slice(0,8),jsx("button",{type:"button",onClick:()=>{let R=(fe.dependencies||[]).filter(q=>q!==L);He("dependencies",R);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:o,children:jsx(X,{className:"w-3 h-3"})})]},L)})}),jsxs("button",{type:"button",onClick:()=>{be(!Le),ye("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textSecondary},disabled:o,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:Le&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{be(false),ye("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:Fe?"#0a0a0a":b.bgPrimary,backdropFilter:Fe?"blur(16px)":void 0,border:`1px solid ${Fe?"#262626":b.border}`,boxShadow:Fe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${b.border}`},children:jsx("input",{type:"text",value:ge,onChange:L=>ye(L.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:b.bgSecondary,color:b.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[a.filter(L=>L.id!==r?.id).filter(L=>ge===""||L.name.toLowerCase().includes(ge.toLowerCase())).map(L=>{let ae=fe.dependencies?.includes(L.id);return jsxs("button",{type:"button",onClick:()=>{let R=fe.dependencies||[],q;ae?q=R.filter(U=>U!==L.id):q=[...R,L.id],He("dependencies",q);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:ae?`${b.accent}10`:"transparent"},onMouseEnter:R=>{ae||(R.currentTarget.style.backgroundColor=b.hoverBg);},onMouseLeave:R=>{R.currentTarget.style.backgroundColor=ae?`${b.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:ae?b.accent:"transparent",borderColor:ae?b.accent:b.borderLight},children:ae&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:b.textPrimary},children:L.name}),jsx("span",{className:"text-[10px]",style:{color:b.textTertiary},children:L.id.slice(0,8)})]})]},L.id)}),a.filter(L=>L.id!==r?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:b.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${Fe?"rgba(65,71,84,0.1)":b.border}`,backgroundColor:Fe?"rgba(25,27,34,0.2)":void 0},children:[jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:b.textTertiary},onMouseEnter:L=>L.currentTarget.style.color=b.textPrimary,onMouseLeave:L=>L.currentTarget.style.color=b.textTertiary,disabled:o,children:"Cancelar"}),jsx("button",{type:"submit",disabled:o,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#00E5CC",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:L=>!o&&(L.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:L=>!o&&(L.currentTarget.style.filter="brightness(1)"),children:o?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:c==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var tg=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
369
369
 
370
370
  AVAILABLE COMMANDS:
371
371
  1. move_task - Move a task to a different date
@@ -406,39 +406,39 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
406
406
 
407
407
  Always try to match task names case-insensitively and handle partial matches.
408
408
  If you can't find a task by name, search through the provided task list.
409
- If ambiguous, ask for clarification in the message field.`;function eg(e){return `CURRENT TASKS:
410
- ${tg(e).map(r=>{let n=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",o=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${n} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${o}`}).join(`
409
+ If ambiguous, ask for clarification in the message field.`;function rg(e){return `CURRENT TASKS:
410
+ ${ag(e).map(a=>{let n=a.startDate?a.startDate.toISOString().split("T")[0]:"no date",s=a.endDate?a.endDate.toISOString().split("T")[0]:"no date",o=a.dependencies?.length?`deps: [${a.dependencies.join(", ")}]`:"";return `- ${a.id}: "${a.name}" (${n} to ${s}, ${a.progress}%, ${a.status||"todo"}) ${o}`}).join(`
411
411
  `)}
412
412
 
413
- Today's date: ${new Date().toISOString().split("T")[0]}`}function tg(e){let t=[],a=r=>{for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);};return a(e),t}function Bo(e,t){let a=tg(e),r=t.toLowerCase().trim(),n=a.find(l=>l.name.toLowerCase()===r);if(n)return n;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let o=r.split(/\s+/);return a.find(l=>{let d=l.name.toLowerCase();return o.every(i=>d.includes(i))})}function rc(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 n=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(n){let g={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[n[1].toLowerCase()];if(g!==void 0){let f=new Date(r),v=f.getDay(),y=g-v;return y<=0&&(y+=7),f.setDate(f.getDate()+y),f}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let p=parseInt(s[1],10),g=s[2].toLowerCase(),f=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?f.setDate(f.getDate()+p):g==="week"||g==="semana"||g==="semanas"?f.setDate(f.getDate()+p*7):(g==="month"||g==="mes"||g==="meses")&&f.setMonth(f.getMonth()+p),f}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let p=parseInt(l[1],10),g=parseInt(l[2],10)-1,f=parseInt(l[3],10);return new Date(f,g,p)}let d={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let p=parseInt(i[1],10),g=d[i[2].toLowerCase()],f=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(f,g,p)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},m=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(m&&m[1]&&m[2]){let p=u[m[1].toLowerCase()],g=parseInt(m[2],10),f=m[3]?parseInt(m[3],10):r.getFullYear();if(p!==void 0)return new Date(f,p,g)}return null}function oc(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),n=a[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return r;if(n==="week"||n==="semana"||n==="semanas")return r*7;if(n==="month"||n==="mes"||n==="meses")return r*30}return null}function nc(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function ag(e){let t=e.toLowerCase().trim();return t.includes("todo")||t.includes("pendiente")||t.includes("por hacer")?"todo":t.includes("in progress")||t.includes("in-progress")||t.includes("en progreso")||t.includes("working")||t.includes("trabajando")?"in-progress":t.includes("done")||t.includes("complete")||t.includes("finished")||t.includes("completado")||t.includes("terminado")||t.includes("hecho")?"completed":null}function rg(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let i=r[1].trim(),u=r[2].trim(),m=Bo(t,i),p=rc(u);if(!m)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:m.id,taskName:m.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=m.startDate&&m.endDate?Math.round((m.endDate.getTime()-m.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(p);return f.setDate(f.getDate()+g),{type:"move_task",taskId:m.id,taskName:m.name,updates:{startDate:p,endDate:f},message:`Moved "${m.name}" to ${p.toLocaleDateString()}.`,success:true}}let n=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),u=n[2].trim(),m=Bo(t,i),p=oc(u);if(!m)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!m.endDate)return {type:"resize_task",taskId:m.id,taskName:m.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let g=new Date(m.endDate);return g.setDate(g.getDate()+p),{type:"resize_task",taskId:m.id,taskName:m.name,updates:{endDate:g},message:`Extended "${m.name}" by ${p} days. New end date: ${g.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),u=s[2].trim(),m=Bo(t,i),p=nc(u);return m?p===null?{type:"set_progress",taskId:m.id,taskName:m.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:m.id,taskName:m.name,updates:{progress:p},message:`Set "${m.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 o=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),u=o[2].trim(),m=Bo(t,i);return m?{type:"rename_task",taskId:m.id,taskName:m.name,updates:{name:u},message:`Renamed "${m.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),u=l[2].trim(),m=Bo(t,i),p=Bo(t,u);return m?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:m.id,dependencyTo:p.id,message:`Linked "${m.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let d=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]){let i=d[1].trim(),u=Bo(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function og(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 v2(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 w2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function rl(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let m=a.find(p=>p.id===u);return m?{name:m.name,initials:m.initials,color:m.color}:null}).filter(u=>u!==null),n=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>rl(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let o=u=>{if(u)return typeof u=="string"?new Date(u):u},l=o(e.startDate),d=o(e.endDate),i=e.metadata?.isMilestone===true||l&&d&&Math.abs(d.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:d,progress:e.progress||0,status:v2(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function ng(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:w2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function sg(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>rl(r,e,t))}var sc={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},ic={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Equipo",blockers:"Bloqueantes",weight:"Peso"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},ol={en:sc,es:ic};function lc(e){return ol[e]||ol.en}function nl(e,t){let a=lc(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 dc=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function ig(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 lg({value:e,onChange:t,isDark:a,translations:r,disabled:n=false}){let[s,o]=useState(false),l=useRef(null);useEffect(()=>{let g=f=>{l.current&&!l.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let d=ig(e),i=dc[0],u=dc.find(g=>g.value===d)??i,m=u.icon,p=g=>{switch(ig(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(m,{className:c("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:c("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),o(!s);},className:c("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(m,{className:c("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:c("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)}),jsx(ChevronDown,{className:c("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:c("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:dc.map(g=>{let f=g.icon;return jsxs("button",{onClick:v=>{v.stopPropagation(),t(g.value),o(false);},className:c("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",d===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(f,{className:c("w-4 h-4",g.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p(g.value)})]},g.value)})})]})}var cc=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#3B9EFF]",bg:"bg-[#3B9EFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function cg({value:e="none",onChange:t,isDark:a,locale:r,disabled:n=false}){let[s,o]=useState(false),l=useRef(null);useEffect(()=>{let u=m=>{l.current&&!l.current.contains(m.target)&&o(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let d=cc.find(u=>u.value===e)??cc[4],i=r==="es"?"es":"en";return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:c("w-4 h-4",d.color)}),jsx("span",{className:c("text-sm",a?"text-white/60":"text-gray-500"),children:d.label[i]})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:u=>{u.stopPropagation(),o(!s);},className:c("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:c("w-4 h-4",d.color)}),jsx("span",{className:c("text-sm",a?"text-white/60":"text-gray-500"),children:d.label[i]}),jsx(ChevronDown,{className:c("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:c("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:cc.map(u=>jsxs("button",{onClick:m=>{m.stopPropagation(),t(u.value),o(false);},className:c("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===u.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:c("w-2 h-2 rounded-full",u.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:u.label[i]})]},u.value))})]})}function js(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function uc(e){let t=["bg-[#00E5CC]","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-[#00E5CC]"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-[#00E5CC]"}function pc({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:n,disabled:s=false}){let[o,l]=useState(false),[d,i]=useState(""),u=useRef(null),m=useRef(null);useEffect(()=>{let v=y=>{u.current&&!u.current.contains(y.target)&&(l(false),i(""));};return o&&document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[o]),useEffect(()=>{o&&m.current&&m.current.focus();},[o]);let p=t.filter(v=>v.name.toLowerCase().includes(d.toLowerCase())),g=v=>e.some(y=>y.name===v),f=v=>{if(a){if(g(v.name))a(e.filter(y=>y.name!==v.name));else {let y={name:v.name,initials:js(v.name),color:v.color||uc(v.name).replace("bg-","").replace("-500",""),avatar:v.avatarUrl,id:v.id};a([...e,y]);}l(false),i("");}};return s||!a?e.length===0?jsx("span",{className:c("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((v,y)=>jsx("div",{className:c("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!v.avatar&&uc(v.name)),style:v.color&&!v.avatar?{backgroundColor:v.color}:void 0,title:v.name,children:v.avatar?jsx("img",{src:v.avatar,alt:v.name,className:"w-full h-full rounded-full object-cover"}):v.initials||js(v.name)},`${v.name}-${y}`)),e.length>3&&jsxs("div",{className:c("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:u,className:"relative",children:[jsx("button",{onClick:v=>{v.stopPropagation(),l(!o);},className:c("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:c("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:c("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((v,y)=>jsx("div",{className:c("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!v.avatar&&uc(v.name)),style:v.color&&!v.avatar?{backgroundColor:v.color}:void 0,children:v.avatar?jsx("img",{src:v.avatar,alt:v.name,className:"w-full h-full rounded-full object-cover"}):v.initials||js(v.name)},`${v.name}-${y}`)),e.length>2&&jsxs("span",{className:c("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),o&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:m,type:"text",value:d,onChange:v=>i(v.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:v=>v.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((v,y)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:v.color?`${v.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:v.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:v.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:v.avatar?jsx("img",{src:v.avatar,alt:v.name,className:"w-full h-full rounded-full object-cover"}):v.initials||js(v.name)}),v.name.split(" ")[0],jsx("button",{onClick:b=>{b.stopPropagation(),a(e.filter(h=>h.name!==v.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsx(X,{style:{width:10,height:10}})})]},`${v.name}-${y}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:p.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:n==="es"?"No se encontraron miembros":"No members found"}):p.map(v=>{let y=g(v.name);return jsxs("button",{onClick:b=>{b.stopPropagation(),f(v);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:y?r?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:b=>{y||(b.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:b=>{y||(b.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:v.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:v.avatarUrl?jsx("img",{src:v.avatarUrl,alt:v.name,className:"w-full h-full rounded-full object-cover"}):js(v.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:v.name}),y&&jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},v.id)})})]})]})}function bg({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:n="end",isDark:s,locale:o,disabled:l=false,placeholder:d}){let[i,u]=useState(false),[m,p]=useState(n),[g,f]=useState(()=>{let k=n==="start"?e:t;if(k){let K=k instanceof Date?k:new Date(k);return new Date(K.getFullYear(),K.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),v=useRef(null),y=useRef(null),b=useRef(null),[h,x]=useState(null),w=e?e instanceof Date?e:new Date(e):null,N=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let k=K=>{let H=K.target;v.current&&v.current.contains(H)||b.current&&b.current.contains(H)||u(false);};return i&&document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[i]),useLayoutEffect(()=>{if(!i){x(null);return}let k=()=>{let K=y.current?.getBoundingClientRect();if(!K)return;let H=520,ee=360,I=window.innerHeight-K.bottom,Y=I<ee&&K.top>I,q=Y?K.top-4:K.bottom+4,V=Math.min(Math.max(K.left,8),window.innerWidth-H-8);x({top:q,left:V,flipUp:Y});};return k(),window.addEventListener("scroll",k,true),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,true),window.removeEventListener("resize",k);}},[i]),useEffect(()=>{i&&p(r?n:"start");},[i,r,n]);let D=k=>k?k.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):d||"-",A=useCallback(()=>{let k=g.getFullYear(),K=g.getMonth(),H=new Date(k,K,1),I=new Date(k,K+1,0).getDate(),Y=H.getDay(),q=[],B=new Date(k,K,0).getDate();for(let Te=Y-1;Te>=0;Te--)q.push({date:new Date(k,K-1,B-Te),isCurrentMonth:false});for(let Te=1;Te<=I;Te++)q.push({date:new Date(k,K,Te),isCurrentMonth:true});let X=42-q.length;for(let Te=1;Te<=X;Te++)q.push({date:new Date(k,K+1,Te),isCurrentMonth:false});return q},[g]),T=k=>{if(r)n==="start"?a(k,N||void 0):a(w||void 0,k),u(false);else if(m==="start"){let K=N&&k>N?k:N;a(k,K||void 0),p("end");}else {let K=w&&k<w?k:w;a(K||void 0,k),u(false);}},E=()=>{let k=new Date,K=new Date(k);K.setDate(k.getDate()+1);let H=new Date(k);H.setDate(k.getDate()+((6-k.getDay()+7)%7||7));let ee=new Date(k);ee.setDate(k.getDate()+((1-k.getDay()+7)%7||7));let I=new Date(k);I.setDate(k.getDate()+(6-k.getDay()+7)%7+7);let Y=new Date(k);Y.setDate(k.getDate()+14);let q=new Date(k);return q.setDate(k.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:k,display:k.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:K,display:K.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:H,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:ee,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:I,display:I.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:Y,display:Y.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:q,display:q.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let k=r&&n==="start"?w:N;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:c("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:c("text-sm",s?"text-white/60":"text-gray-500"),children:D(k)})]})}let P=r&&n==="start"?w:N;return jsxs("div",{ref:v,className:"relative",children:[jsxs("button",{ref:y,onClick:k=>{k.stopPropagation(),u(!i);let K=n==="start"?w:N;K&&f(new Date(K.getFullYear(),K.getMonth(),1));},className:c("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Calendar,{className:c("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:c("text-sm",s?"text-white/60":"text-gray-500"),children:D(P)})]}),i&&h&&createPortal(jsxs("div",{ref:b,className:c("rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),style:{position:"fixed",top:h.flipUp?void 0:h.top,bottom:h.flipUp?window.innerHeight-h.top:void 0,left:h.left,zIndex:10001},onClick:k=>k.stopPropagation(),children:[jsxs("div",{className:c("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[E().map((k,K)=>jsxs("button",{className:c("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>T(k.date),children:[jsx("span",{children:k.label}),jsx("span",{className:c("text-xs",s?"text-white/30":"text-gray-400"),children:k.display})]},K)),jsx("div",{className:c("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?n==="start"?a(void 0,N||void 0):a(w||void 0,void 0):a(void 0,void 0),u(false);},className:c("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className:c("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:m==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:c("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>f(new Date),className:c("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>f(new Date(g.getFullYear(),g.getMonth()-1)),className:c("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:c("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>f(new Date(g.getFullYear(),g.getMonth()+1)),className:c("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:c("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(k=>jsx("div",{className:c("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:k},k))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:A().map((k,K)=>{let H=k.date.toDateString()===new Date().toDateString(),ee=w?.toDateString()===k.date.toDateString(),I=N?.toDateString()===k.date.toDateString(),Y=ee||I,q=!r&&w&&N&&k.date>=w&&k.date<=N;return jsx("button",{onClick:()=>T(new Date(k.date)),className:c("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!k.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),k.isCurrentMonth&&(s?"text-white":"text-gray-900"),H&&"ring-2 ring-[#00E5CC]",ee&&"bg-[#00E5CC] text-white",I&&!ee&&"bg-[#7C3AED] text-white",q&&!Y&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!Y&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:k.date.getDate()},K)})})]})]}),document.body)]})}function dl({value:e,onChange:t,isDark:a,locale:r,disabled:n=false,dateField:s="end",startDate:o,endDate:l}){let d=e?e instanceof Date?e:new Date(e):null;return jsx(bg,{startDate:s==="start"?d:o||null,endDate:s==="end"?d:l||null,onChange:(p,g)=>{t&&t(s==="start"?p:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:n||!t,placeholder:"-"})}function ns(e=600){let[t,a]=useState(false),r=useRef(null),n=useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:n}}function cl(e,t={}){let{enabled:a=true,duration:r=400,steps:n=8}=t,[s,o]=useState(e),[l,d]=useState(false),i=useRef(e),u=useRef([]);return useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!a||e===i.current||e===void 0){o(e),i.current=e;return}let m=i.current??0,p=e,g=p-m,f=r/n;d(true);for(let v=1;v<=n;v++){let y=setTimeout(()=>{let b=v/n,h=1-Math.pow(1-b,3),x=Math.round(m+g*h);o(x),v===n&&(d(false),o(p));},f*v);u.current.push(y);}return i.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,a,r,n]),{displayValue:s,isAnimating:l}}function hg(e,t={}){let{delay:a=1500,onCancel:r}=t,[n,s]=useState(null),[o,l]=useState(0),d=useRef(null),i=useRef(null),u=useCallback(g=>{d.current&&clearTimeout(d.current),i.current&&clearInterval(i.current),s(g),l(0);let f=Date.now();i.current=setInterval(()=>{let v=Date.now()-f,y=Math.min(v/a*100,100);l(y);},16),d.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),l(0);},a);},[a,e]),m=useCallback(()=>{d.current&&clearTimeout(d.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return useEffect(()=>()=>{d.current&&clearTimeout(d.current),i.current&&clearInterval(i.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:u,cancelChange:m}}function xg({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,l]=useState(false),[d,i]=useState(""),u=useRef(null),{isFlashing:m,triggerFlash:p}=ns(),{displayValue:g,isAnimating:f}=cl(e,{enabled:n,duration:300,steps:6}),v=w=>{if(r||!t)return;w.stopPropagation();let N=w.currentTarget.getBoundingClientRect(),D=w.clientX-N.left,A=Math.round(D/N.width*100),T=Math.max(0,Math.min(100,A));T!==e&&(t(T),s&&p());},y=useCallback(w=>{r||!t||(w.stopPropagation(),i(String(e)),l(true));},[r,t,e]);useEffect(()=>{o&&u.current&&(u.current.focus(),u.current.select());},[o]);let b=useCallback(()=>{l(false);let w=parseInt(d,10);if(!isNaN(w)&&t){let N=Math.max(0,Math.min(100,w));N!==e&&(t(N),s&&p());}},[d,t,e,s,p]),h=useCallback(w=>{w.key==="Enter"&&b(),w.key==="Escape"&&l(false);},[b]),x=g??e;return jsxs("div",{className:c("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",m&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[x>0?jsx("div",{onClick:v,className:c("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:c("h-full rounded-full transition-[width]",x===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",f&&"transition-none"),style:{width:`${x}%`}})}):jsx("div",{className:"flex-1"}),o?jsxs("div",{className:"flex items-center gap-0.5",onClick:w=>w.stopPropagation(),children:[jsx("input",{ref:u,value:d,onChange:w=>i(w.target.value.replace(/[^0-9]/g,"")),onBlur:b,onKeyDown:h,maxLength:3,className:c("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-[#00E5CC]":"bg-white border-gray-300 text-gray-900 focus:border-[#00E5CC]")}),jsx("span",{className:c("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:y,className:c("text-xs w-8 text-right tabular-nums font-mono rounded px-1",x===0?a?"text-[#6B7280]":"text-gray-400":a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",f&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[x,"%"]})]})}function kg({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:n=false}){let[s,o]=useState(false),[l,d]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{d(e);},[e]);let u=()=>{l!==e&&t?.(l),o(false);},m=p=>{p.key==="Enter"?u():p.key==="Escape"&&(d(e),o(false));};return n||!t?jsx("span",{className:c("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:l,onChange:p=>d(p.target.value),onBlur:u,onKeyDown:m,onClick:p=>p.stopPropagation(),className:c("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:p=>{p.stopPropagation(),o(true);},className:c("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function Ng({value:e,onChange:t,isDark:a,placeholder:r="-",min:n,max:s,disabled:o=false,enableSlotMachine:l=true,enableSaveFlash:d=true}){let[i,u]=useState(false),[m,p]=useState(e?.toString()||""),g=useRef(null),{isFlashing:f,triggerFlash:v}=ns(),{displayValue:y,isAnimating:b}=cl(e,{enabled:l&&!i});useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),useEffect(()=>{p(e?.toString()||"");},[e]);let h=()=>{let w=parseFloat(m);if(!isNaN(w)){let N=w;n!==void 0&&(N=Math.max(n,N)),s!==void 0&&(N=Math.min(s,N)),N!==e&&(t?.(N),d&&v());}u(false);},x=w=>{w.key==="Enter"?h():w.key==="Escape"&&(p(e?.toString()||""),u(false));};return o||!t?jsx("span",{className:c("text-sm font-mono",a?"text-white/60":"text-gray-500",b&&"font-medium"),children:y!==void 0?y:r}):i?jsx("input",{ref:g,type:"number",value:m,onChange:w=>p(w.target.value),onBlur:h,onKeyDown:x,onClick:w=>w.stopPropagation(),min:n,max:s,className:c("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:w=>{w.stopPropagation(),u(true);},className:c("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",y===void 0&&(a?"text-white/30":"text-gray-400"),f&&(a?"bg-green-500/30":"bg-green-500/20"),b&&"font-medium scale-105"),children:y!==void 0?y:r})}function Dg({value:e,options:t=[],onChange:a,isDark:r,placeholder:n="-",disabled:s=false}){let[o,l]=useState(false),d=useRef(null);return useEffect(()=>{let i=u=>{d.current&&!d.current.contains(u.target)&&l(false);};return o&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[o]),s||!a?jsx("span",{className:c("text-sm",r?"text-white/60":"text-gray-500"),children:e||n}):jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),l(!o);},className:c("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:c("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||n}),jsx(ChevronDown,{className:c("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),o&&jsx("div",{className:c("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:c("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:u=>{u.stopPropagation(),a(i),l(false);},className:c("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},i))})]})}function Eg({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:l,progress:d,startChange:i,cancelChange:u}=hg(t,{delay:s}),m=g=>{g.stopPropagation(),!r&&t&&(n?l?u():i(!e):t(!e));},p=l?o:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:m,disabled:r||!t,className:c("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",p?"bg-[#00E5CC] border-[#00E5CC]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&p&&"ring-green-500/50",l&&!p&&"ring-red-500/50",l&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[l&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${d/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsx("button",{onClick:g=>{g.stopPropagation(),u();},className:c("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 Fg({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:c("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),n=e.length-a;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),n>0&&jsxs("span",{className:c("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",n]})]})}function n1(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 s1(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),d=parseInt(a[2],10);return l*60+d}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),d=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+d}let n=t.match(/^(\d+\.?\d*)\s*h$/);if(n&&n[1])return Math.round(parseFloat(n[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function Br({value:e,onChange:t,isDark:a,locale:r="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:l=false,lens:d="hours",hourlyRate:i=0,financialOverride:u}){let[m,p]=useState(false),[g,f]=useState(""),v=useRef(null),{isFlashing:y,triggerFlash:b}=ns(),h=d==="financial"&&(i>0||u!=null),x=u??(e?e/60*i:0),w=h&&(u!=null?u>0:e)?`$${Math.round(x).toLocaleString("en-US")}`:n1(e,r);useEffect(()=>{m&&v.current&&(v.current.focus(),v.current.select());},[m]),useEffect(()=>{if(e){let T=Math.floor(e/60),E=e%60;T>0&&E>0?f(`${T}h ${E}m`):T>0?f(`${T}h`):f(`${E}m`);}else f("");},[e,m]);let N=()=>{let T=s1(g);T!==e&&(t?.(T),o&&b()),p(false);},D=T=>{T.key==="Enter"?N():T.key==="Escape"&&p(false);};if(l)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:c("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:c("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let A=h?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsx(A,{className:c("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:c("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:w})]}):m?jsx("input",{ref:v,type:"text",value:g,onChange:T=>f(T.target.value),onBlur:N,onKeyDown:D,onClick:T=>T.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:c("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:T=>{T.stopPropagation(),p(true);},className:c("flex items-center justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",y&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(A,{className:c("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:w})]})}function Bg({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:c("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let o=d=>d.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),l=()=>{if(a==null)return null;let d=n==="es";return a===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:d?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:d?"Tiempo no asignado":"No time allocated"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",d?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[a,"d ",d?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:c("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),l()]})}function Og({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:l="hours",hourlyRate:d=0}){let i=a==="es",u=l==="financial"&&d>0,m=q=>u?`$${Math.round(q*d).toLocaleString("en-US")}`:`${q}h`,[p,g]=useState(false),[f,v]=useState(false),[y,b]=useState(null),h=useRef(null),x=e.timeLoggedMinutes||0,w=e.effortMinutes||0,N=e.soldEffortMinutes||0,D=Math.round(x/60*10)/10,A=Math.round(w/60*10)/10,T=w>0?x/w*100:0,E=T>100?Math.round((x-w)/60*10)/10:0,P=T>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!f&&!y)return;let q=V=>{h.current&&!h.current.contains(V.target)&&(v(false),b(null));};return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[f,y]);let k=q=>{if(q.stopPropagation(),r&&!n&&!s){b("log");return}if(r||n||s){v(V=>!V),b(null);return}o&&o(e);},K=q=>{v(false),b(q);},H=async(q,V)=>{y==="log"&&r&&q?r(e,q,V):y==="estimate"&&n?n(e,q):y==="quoted"&&s&&s(e,q),b(null);},ee=r||n||s||o,I=[{mode:"log",icon:Clock,label:i?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:i?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(q=>q.show),Y=y==="estimate"?w:y==="quoted"?N:void 0;return w===0&&x===0&&N===0?jsxs("div",{ref:h,className:"relative flex items-center gap-2",onClick:q=>q.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsx("span",{className:c("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),p&&ee&&jsx("button",{onClick:k,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:q=>{q.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",q.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:q=>{q.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",q.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:I.map(q=>jsxs("button",{onClick:V=>{V.stopPropagation(),K(q.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:V=>{V.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:V=>{V.target.style.background="transparent";},children:[jsx(q.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),q.label]},q.mode))})}),jsx(AnimatePresence,{children:y&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(bo,{mode:y,locale:a,isDark:t,currentValue:Y||void 0,onSave:H,onClose:()=>b(null)})})})})]}):jsxs("div",{ref:h,className:"relative flex items-center gap-2 w-full",onClick:q=>q.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[(()=>{let q=x===0,B=(w>0?x/w:0)>1.1;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:q?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:m(D)}),w>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(A)]}),E>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:B?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:B?"rgba(239,68,68,0.15)":"transparent"},children:["+",m(E)," ",i?"Excedido":"Over"]})]})})(),w>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(T,100)}%`,backgroundColor:P,borderRadius:2,transition:"width 0.3s"}})})]}),ee&&jsx("button",{onClick:k,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:p?1:0,pointerEvents:p?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:q=>{q.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",q.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:q=>{q.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",q.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:I.map(q=>jsxs("button",{onClick:V=>{V.stopPropagation(),K(q.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:V=>{V.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:V=>{V.target.style.background="transparent";},children:[jsx(q.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),q.label]},q.mode))})}),jsx(AnimatePresence,{children:y&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(bo,{mode:y,locale:a,isDark:t,currentValue:Y||void 0,onSave:H,onClose:()=>b(null)})})})})]})}function m1(e){let t=new Map;function a(r){if(r.assignees)for(let n of r.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(r.subtasks)for(let n of r.subtasks)a(n);}return a(e),Array.from(t.values())}function g1(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function $g({assignee:e,size:t=28,isDark:a}){let r=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",n=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:c(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsx("div",{className:c(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function Hg({task:e,isDark:t,locale:a="en"}){let r=a==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let u=m1(e);if(u.length===0)return null;let m=u.slice(0,3),p=u.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:m.map((g,f)=>jsx($g,{assignee:g,size:24,isDark:t},g.name+f))}),p>0&&jsxs("span",{className:c("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:u.slice(3).map(g=>g.name).join(", "),children:["+",p]})]})}if(!s)return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:c("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsx(User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsx("span",{className:c("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let l=o?.percentage??0,d=!!o&&l>0,i=d?g1(l):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx($g,{assignee:s,size:28,isDark:t}),jsx("span",{className:c("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),d&&i&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[l,"% LOAD"]})]})}var f1={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function Ug({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:c("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,n)=>jsxs("span",{className:c("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",f1[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${n}`))})}function P1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function F1(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 qg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:l,onColumnHide:d,onColumnSort:i,availableUsers:u=[],onOpenTimeLog:m,onReportBlocker:p,onCopyTaskLink:g,onTaskMove:f,onTaskIndent:v,onTaskOutdent:y}){let b=useRef(null),h=r==="es"?Gg.es:Gg.en,[x,w]=useState({left:e.x,top:e.y});if(useLayoutEffect(()=>{w({left:e.x,top:e.y});let E=b.current;if(!E)return;let P=E.getBoundingClientRect(),k=8,K=e.x,H=e.y;e.y+P.height>window.innerHeight-k&&(H=Math.max(k,e.y-P.height)),e.x+P.width>window.innerWidth-k&&(K=Math.max(k,window.innerWidth-P.width-k)),(K!==e.x||H!==e.y)&&w({left:K,top:H});},[e.x,e.y,e.isOpen]),useEffect(()=>{let E=k=>{b.current&&!b.current.contains(k.target)&&t();},P=k=>{k.key==="Escape"&&t();};return document.addEventListener("mousedown",E),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",E),document.removeEventListener("keydown",P);}},[t]),!e.isOpen)return null;let N=()=>{if(!e.task)return [];let E=[];return n&&E.push({id:"edit",label:h.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),E.push({id:"sep1",label:"",icon:null,separator:true}),l&&(E.push({id:"status",label:h.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:h.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:h.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-[#00E5CC]"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:h.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),E.push({id:"priority",label:h.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:h.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:h.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:h.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:h.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),u.length>0&&E.push({id:"assign",label:h.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(P=>({id:`assign-${P.id}`,label:P.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:P.name.charAt(0).toUpperCase()}),onClick:()=>{let k=e.task.assignees||[],H=k.some(ee=>ee.name===P.name)?k.filter(ee=>ee.name!==P.name):[...k,{name:P.name,initials:P1(P.name),color:P.color||F1(P.name),avatar:P.avatarUrl}];l({...e.task,assignees:H}),t();}}))})),m&&E.push({id:"log-time",label:h.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),p&&E.push({id:"report-blocker",label:h.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),g&&E.push({id:"copy-link",label:h.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),E.push({id:"sep2",label:"",icon:null,separator:true}),s&&E.push({id:"duplicate",label:h.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||v||y)&&(E.push({id:"sep3",label:"",icon:null,separator:true}),f&&(E.push({id:"move-up",label:h.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),E.push({id:"move-down",label:h.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),v&&E.push({id:"indent",label:h.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{v(e.task.id),t();}}),y&&E.push({id:"outdent",label:h.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{y(e.task.id),t();}})),o&&E.push({id:"delete",label:h.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),E},D=()=>{if(!e.columnId)return [];let E=[];return i&&(E.push({id:"sort-asc",label:h.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),E.push({id:"sort-desc",label:h.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),d&&e.columnId!=="name"&&(E.push({id:"sep-hide",label:"",icon:null,separator:true}),E.push({id:"hide",label:h.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{d(e.columnId),t();}})),E},A=e.type==="task"?N():D(),T={position:"fixed",left:x.left,top:x.top,zIndex:9999};return jsx("div",{ref:b,style:T,className:c("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:A.map(E=>E.separator?jsx("div",{className:c("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},E.id):E.submenu?jsx(A1,{item:E,isDark:a},E.id):jsxs("button",{onClick:E.onClick,className:c("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",E.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:c(E.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:E.icon}),E.label]},E.id))})}function A1({item:e,isDark:t}){let[a,r]=useState(false),n=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),r(true);},onMouseLeave:()=>{n.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:c("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:c("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:c("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxs("button",{onClick:l.onClick,className:c("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var Gg={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var a0={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),scheduleVariance:jsx(CalendarClock,{className:"w-4 h-4"}),hoursBar:jsx(BarChart3,{className:"w-4 h-4"}),teamLoad:jsx(Users,{className:"w-4 h-4"}),blockers:jsx(AlertTriangle,{className:"w-4 h-4"}),weight:jsx(BarChart,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"})},Y1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function o0({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:n,onCreateCustomField:s,isDark:o,locale:l}){let[d,i]=useState(""),[u,m]=useState(null),[p,g]=useState(null),f=useRef(null),v=l==="es"?r0.es:r0.en;useLayoutEffect(()=>{if(!e||!f.current)return;let A=()=>{if(!f.current)return;let T=f.current.parentElement;if(T){let K=T.getBoundingClientRect();g({top:K.bottom+4,right:window.innerWidth-K.right});}let E=f.current.getBoundingClientRect(),k=window.innerHeight-E.top-20;m(Math.max(300,k));};return requestAnimationFrame(A),window.addEventListener("resize",A),()=>window.removeEventListener("resize",A)},[e]),useEffect(()=>{if(!e)return;let A=setTimeout(()=>{let T=P=>{f.current&&!f.current.contains(P.target)&&t();},E=P=>{P.key==="Escape"&&t();};document.addEventListener("mousedown",T),document.addEventListener("keydown",E),f._cleanup=()=>{document.removeEventListener("mousedown",T),document.removeEventListener("keydown",E);};},100);return ()=>{clearTimeout(A),f._cleanup&&f._cleanup();}},[e,t]);let y=useMemo(()=>{let A=new Set([...Y1]);return a.forEach(T=>{T.type&&T.type!=="assignees"&&A.add(T.type);}),Array.from(A)},[a]);if(!e)return null;let b=A=>{let T=v.columns[A];if(T)return T;let E=a.find(P=>P.type===A);return E?.label?E.label:A},h=A=>{if(A==="name")return;let T=a.map(E=>E.id===A?{...E,visible:!E.visible}:E);n(T);},x=(A,T)=>{let E=a.find(k=>k.type===A&&(!T||k.customFieldId===T));if(E){h(E.id);return}let P={id:T||A,type:A,label:T?r.find(k=>k.id===T)?.name||A:b(A),width:120,visible:true,sortable:true,resizable:true,customFieldId:T};n([...a,P]);},w=y.filter(A=>A!=="assignees"&&b(A).toLowerCase().includes(d.toLowerCase())),N=r.filter(A=>A.name.toLowerCase().includes(d.toLowerCase())),D=o?"#00E5FF":"#00E5CC";return jsxs("div",{ref:f,style:{...u?{maxHeight:`${u}px`}:{},...p?{top:p.top,right:p.right}:{},background:o?"#111114":"#FFFFFF",border:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:o?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)",zIndex:99999},className:"fixed w-64 rounded-xl flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:o?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:v.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:A=>{A.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",A.currentTarget.style.color=o?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:A=>{A.currentTarget.style.backgroundColor="transparent",A.currentTarget.style.color=o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"px-3 py-2",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:o?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:d,onChange:A=>i(A.target.value),placeholder:v.searchPlaceholder,style:{fontSize:12,background:o?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:o?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:A=>{A&&A.style.setProperty("--focus-border",D);},onFocus:A=>{A.currentTarget.style.borderColor=D,A.currentTarget.style.background=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:A=>{A.currentTarget.style.borderColor=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",A.currentTarget.style.background=o?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:A=>A.stopPropagation(),children:[jsxs("div",{className:"mb-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:o?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:v.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:w.map(A=>{let T=a.find(k=>k.type===A&&!k.customFieldId),E=T?.visible??false,P=A==="name";return jsxs("button",{onClick:()=>{P||(T?h(T.id):x(A));},disabled:P,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:P?.4:1,cursor:P?"not-allowed":"pointer"},onMouseEnter:k=>{P||(k.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:k=>{k.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:E?D:"transparent",border:E?`1.5px solid ${D}`:`1.5px solid ${o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:E?`0 0 6px ${D}40`:"none"},children:E&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:E?D:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:a0[A]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:E?500:400,color:E?o?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":o?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:b(A),children:b(A)})]},A)})})]}),N.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:o?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:v.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:N.map(A=>{let E=a.find(P=>P.customFieldId===A.id)?.visible??false;return jsxs("button",{onClick:()=>x(A.type,A.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:P=>{P.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:E?D:"transparent",border:E?`1.5px solid ${D}`:`1.5px solid ${o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:E?`0 0 6px ${D}40`:"none"},children:E&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:E?D:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:a0[A.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:E?500:400,color:E?o?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":o?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:A.name})]},A.id)})})]})]})]})}var r0={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var ow=[{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 i0({isOpen:e,onClose:t,onSave:a,isDark:r,locale:n}){let[s,o]=useState(""),[l,d]=useState("text"),[i,u]=useState([""]),m=n==="es"?s0.es:s0.en;useEffect(()=>{e&&(o(""),d("text"),u([""]));},[e]),useEffect(()=>{let y=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,t]);let p=()=>{if(!s.trim())return;let y={name:s.trim(),type:l};l==="dropdown"&&(y.options=i.filter(b=>b.trim())),a(y),t();},g=()=>{u([...i,""]);},f=(y,b)=>{let h=[...i];h[y]=b,u(h);},v=y=>{i.length>1&&u(i.filter((b,h)=>h!==y));};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:c("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:c("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:c("text-lg font-semibold",r?"text-white":"text-gray-900"),children:m.title}),jsx("button",{onClick:t,className:c("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:c("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:c("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:m.fieldName}),jsx("input",{type:"text",value:s,onChange:y=>o(y.target.value),placeholder:m.fieldNamePlaceholder,className:c("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:c("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:m.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:ow.map(y=>jsxs("button",{onClick:()=>d(y.type),className:c("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===y.type?"border-[#00E5CC] bg-[#00E5CC]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:l===y.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-400",children:y.icon}),jsx("span",{className:c("text-xs",l===y.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-500"),children:m.types[y.type]})]},y.type))})]}),l==="dropdown"&&jsxs("div",{children:[jsx("label",{className:c("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:m.options}),jsxs("div",{className:"space-y-2",children:[i.map((y,b)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:y,onChange:h=>f(b,h.target.value),placeholder:`${m.option} ${b+1}`,className:c("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsx("button",{onClick:()=>v(b),className:c("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},b)),jsxs("button",{onClick:g,className:c("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),m.addOption]})]})]})]}),jsxs("div",{className:c("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:c("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:m.cancel}),jsx("button",{onClick:p,disabled:!s.trim(),className:c("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#00E5CC] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:m.create})]})]})]}):null}var s0={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 c0={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 u0({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:n,locale:s}){let[o,l]=useState(false),d=useRef(null),i=useRef(0),u=s==="es"?c0.es:c0.en;useEffect(()=>{if(!o)return;let g=v=>{Date.now()-i.current<100||d.current&&!d.current.contains(v.target)&&l(false);},f=v=>{v.key==="Escape"&&l(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",f);}},[o]);let m=[{value:"all",label:u.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:u.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:u.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:u.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),o||(i.current=Date.now()),l(f=>!f);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",n?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(n?"bg-[#00E5CC]/20 border-[#00E5CC]/50 text-[#00E5CC]":"bg-[#00E5CC]/15 border-[#00E5CC]/15 text-[#00C4AE]"),o&&(n?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),u.filters,p&&jsx("span",{className:c("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),o&&jsxs("div",{className:c("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:c("px-4 py-3 border-b",n?"border-[#222]":"border-gray-200"),children:jsx("span",{className:c("text-xs font-medium uppercase tracking-wider",n?"text-white/30":"text-gray-400"),children:u.filterByStatus})}),jsx("div",{className:"py-2",children:m.map(g=>{let f=e===g.value&&!t,v=()=>g.value==="all"?f?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxs("button",{onClick:()=>{a(g.value),r(false),l(false);},className:c("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",f&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:c(f?g.color:"text-gray-400","flex-shrink-0"),children:v()}),jsx("span",{className:c("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:g.label}),f&&jsx(Check,{className:c("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},g.value)})}),jsx("div",{className:c("my-2 mx-4 h-px",n?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),l(false);},className:c("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:c("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":n?"text-white/30":"text-gray-400")}),jsx("span",{className:c("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:u.hideCompleted}),t&&jsx(Check,{className:c("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function p0(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Nn(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function m0({data:e,isDark:t,locale:a="en",onClose:r,lens:n="hours",onUnassignedTaskClick:s}){let o=a==="es",l=n==="financial";return jsxs("div",{className:c("w-[260px] xl:w-[320px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:c("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:c("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:l?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsx("button",{onClick:r,className:c("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),l&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let d=e.totalOffered??0,i=e.totalEstimated??0,u=e.totalExecuted??0,m=d-u,p=d>0?Math.round(m/d*100):0,g=d>0?Math.min(Math.round(u/d*100),120):0,f=u>d&&d>0,v=f?"#F87171":"#00E5CC";return jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:c("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"PRESUPUESTO":"BUDGET"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsx("span",{className:c("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Nn(d)})]}),(()=>{let y=e.totalEstimatedLabor??0,b=e.totalEstimatedEquipment??0,h=e.totalEstimatedTravel??0,x=b>0||h>0,w=(N,D)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:c("text-[10px]",t?"text-white/40":"text-gray-400"),children:N}),jsx("span",{className:c("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:Nn(D)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Estimado":"Estimated"}),jsx("span",{className:c("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Nn(i)})]}),x&&jsxs(Fragment,{children:[w(o?"Mano de obra":"Labor",y),b>0&&w(o?"Activos":"Equipment",b),h>0&&w(o?"Vi\xE1ticos":"Travel",h)]})]})})(),u>0&&(()=>{let y=e.totalExecutedLabor??0,b=e.totalExecutedEquipment??0,h=e.totalExecutedTravel??0,x=b>0||h>0,w=(N,D)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:c("text-[10px]",t?"text-white/40":"text-gray-400"),children:N}),jsx("span",{className:c("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:Nn(D)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsx("span",{className:c("text-[11px] font-mono font-bold",f?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Nn(u)})]}),x&&jsxs(Fragment,{children:[w(o?"Mano de obra":"Labor",y),b>0&&w(o?"Activos":"Equipment",b),h>0&&w(o?"Vi\xE1ticos":"Travel",h)]})]})})(),d>0&&jsx("div",{className:c("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(g,100)}%`,backgroundColor:v}})}),jsxs("div",{className:c("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",m>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[m>=0?`+${Nn(m)} ${o?"Disp.":"Avail."}`:`${Nn(Math.abs(m))} ${o?"P\xE9rdida":"Loss"}`,d>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",p,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let d=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,u=i>0?Math.min(Math.round(d/i*100),100):0,g=(i>0?d/i:0)>1.1?"#F87171":u>=90?"#FFD60A":"#3BF06E";return jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:c("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:c("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:p0(d)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:c("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:p0(i)})]}),i>0&&jsx("div",{className:c("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${u}%`,backgroundColor:g}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:c("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:c("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#F87171]/15 text-[#F87171]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:c("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.unassignedCount!=null&&e.unassignedCount>0&&jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:c("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsx("div",{className:c("flex items-center justify-center w-10 h-10 rounded-lg font-mono text-lg font-bold",e.unassignedCount>=10?"bg-[#F87171]/15 text-[#F87171]":"bg-[#FFD60A]/15 text-[#FFD60A]"),children:e.unassignedCount}),jsxs("div",{children:[jsx("p",{className:c("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?o?"tarea pendiente":"pending task":o?"tareas pendientes":"pending tasks"}),jsx("p",{className:c("text-[10px]",t?"text-white/40":"text-gray-400"),children:o?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsx("div",{className:c("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(d=>jsxs("button",{onClick:()=>s?.(d.id),className:c("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[11px] w-full text-left transition-colors",t?"bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white":"bg-gray-50 text-gray-600 hover:bg-gray-100 hover:text-gray-900",s&&"cursor-pointer"),children:[jsx("span",{className:c("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsx("span",{className:"truncate",children:d.name})]},d.id))})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:c("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let d=e.scheduleVarianceDays??0,i=d>0,u=d<0,m=e.scheduleVarianceLabel||(i?`+${d} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:u?`${d} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:c("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",u&&"bg-[#F87171]/15 text-[#F87171]",!i&&!u&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:c("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((d,i)=>{let u=d.utilizationPercent>=100?"#F87171":d.utilizationPercent>=80?"#FFD60A":d.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:d.name}),jsxs("span",{className:c("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[d.utilizationPercent,"%"]})]}),jsx("div",{className:c("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(d.utilizationPercent,100)}%`,backgroundColor:u}})})]},`${d.name}-${i}`)})})]})]})}var vw=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function w0(e,t=0,a=[]){let r=[];for(let n of e){let s=[...a,n.id];r.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&r.push(...w0(n.subtasks,t+1,s));}return r}function ww(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,n=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),d=s.endDate.getTime()-o;if(d<=0)continue;let u=Math.max(0,Math.min(a.getTime()-o,d))/d*100;if(u<=0)continue;let m=(s.progress||0)/u;r+=m,n++;}return n>0?r/n:null}function us(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=us(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:n.effortMinutes??0,r+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,a+=n.effortMinutes??0,r+=n.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function cs(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function kw({value:e,onChange:t,isDark:a}){let[r,n]=useState(false),[s,o]=useState(String(e||""));return r?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:l=>l.stopPropagation(),onChange:l=>o(l.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let l=parseFloat(s);!isNaN(l)&&l>=0&&l<=100?t(l):s===""&&t(0),n(false);},onKeyDown:l=>{l.key==="Enter"&&l.target.blur(),l.key==="Escape"&&(o(String(e||"")),n(false));},className:c("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:l=>{l.stopPropagation(),o(String(e||"")),n(true);},className:c("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function x0(e){if(e.length===0)return 0;let t=0,a=0,r=0;for(let l of e){let d=l.weight||0;d>0&&(t+=(l.progress||0)*d,a+=d,r+=1);}let n=r/e.length;if(a>=99&&n>=.95)return Math.round(t/a*10)/10;if(e.reduce((l,d)=>l+(d.effort_minutes||0),0)>0){let l=0,d=0;for(let i of e){let u=i.effort_minutes||60;l+=(i.progress||0)*u,d+=u;}return Math.round(l/d*10)/10}let o=e.reduce((l,d)=>l+(d.progress||0),0);return Math.round(o/e.length*10)/10}function Mc(e,t=[]){for(let a of e)a.subtasks&&a.subtasks.length>0?Mc(a.subtasks,t):t.push({progress:a.progress||0,weight:a.weight||0,effort_minutes:a.effort_minutes??a.effortMinutes});return t}function k0({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:n,className:s,style:o,availableUsers:l=[],customFields:d=[],toolbarRightContent:i,onColumnHeaderClick:u,columnsWithFilter:m,filterDotColor:p="#00E5CC"}){let{theme:g="dark",locale:f="en",customTranslations:v,showSearch:y=true,showHierarchy:b=true,tableColumns:h,allowColumnCustomization:x=true,allowColumnResize:w=true,enableContextMenu:N=true,showCreateTaskButton:D=false,onCreateTask:A,persistFilter:T=false,financialBlur:E,healthSidebar:P,lens:k="hours",hourlyRate:K=0,rateMap:H,aggregateParentHours:ee=false,showProjectTotals:I=false,totalsDollarOverride:Y}=t,q=nl(f,v),V=g==="dark",B=S=>{if(!H||!S.assignees||S.assignees.length===0)return K;let re=0,ye=0;for(let Fe of S.assignees){let Ye=Fe.id?H[Fe.id]:void 0;if(Ye==null||Ye<=0)continue;let me=typeof Fe.estimatedMinutes=="number"?Fe.estimatedMinutes:0;me>0&&(re+=Ye*me,ye+=me);}if(ye>0)return re/ye;let Se=S.assignees.map(Fe=>Fe.id?H[Fe.id]:void 0).filter(Fe=>Fe!=null&&Fe>0);return Se.length===0?K:Se.reduce((Fe,Ye)=>Fe+Ye,0)/Se.length},X=S=>{let re=0,ye=0,Se=0,Fe=Ye=>{for(let me of Ye)if(me.subtasks&&me.subtasks.length>0){let _e={s:re,a:ye,q:Se};if(Fe(me.subtasks),re-_e.s+(ye-_e.a)+(Se-_e.q)===0){let yt=B(me);re+=(me.timeLoggedMinutes??0)/60*yt,ye+=(me.effortMinutes??0)/60*yt,Se+=(me.soldEffortMinutes??0)/60*yt;}}else {let _e=B(me);re+=(me.timeLoggedMinutes??0)/60*_e,ye+=(me.effortMinutes??0)/60*_e,Se+=(me.soldEffortMinutes??0)/60*_e;}};return S.subtasks&&Fe(S.subtasks),{dollarSpent:re,dollarAllocated:ye,dollarQuoted:Se}},Te=useCallback(()=>{if(!T||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let S=localStorage.getItem(T);if(S){let re=JSON.parse(S);return {statusFilter:re.statusFilter||"all",hideCompleted:re.hideCompleted||!1}}}catch(S){console.error("Error loading persisted filter:",S);}return {statusFilter:"all",hideCompleted:false}},[T]),He=useMemo(()=>{function S(re){let ye=0,Se=0,Fe=0,Ye=0,me=0,_e=0;for(let Oe of re)if(Oe.subtasks&&Oe.subtasks.length>0){let yt=S(Oe.subtasks);if(yt.spent+yt.allocated+yt.quoted>0)ye+=yt.spent,Se+=yt.allocated,Fe+=yt.quoted,Ye+=yt.dollarSpent,me+=yt.dollarAllocated,_e+=yt.dollarQuoted;else {let Nt=Oe.timeLoggedMinutes??0,Dt=Oe.effortMinutes??0,wa=Oe.soldEffortMinutes??0;ye+=Nt,Se+=Dt,Fe+=wa;let Ea=B(Oe);Ye+=Nt/60*Ea,me+=Dt/60*Ea,_e+=wa/60*Ea;}}else {let yt=Oe.timeLoggedMinutes??0,ea=Oe.effortMinutes??0,Nt=Oe.soldEffortMinutes??0;ye+=yt,Se+=ea,Fe+=Nt;let Dt=B(Oe);Ye+=yt/60*Dt,me+=ea/60*Dt,_e+=Nt/60*Dt;}return {spent:ye,allocated:Se,quoted:Fe,dollarSpent:Ye,dollarAllocated:me,dollarQuoted:_e}}return S(e)},[e]),z=useMemo(()=>{let S=new Map;function re(ye){let Se=0;for(let Fe of ye)if(Fe.subtasks&&Fe.subtasks.length>0){let Ye=re(Fe.subtasks);S.set(Fe.id,Ye),Se+=Ye;}else Se+=Fe.weight||0;return Se}return re(e),S},[e]),te=useMemo(()=>!P?.enabled||!P.data?P:{...P,data:{...P.data,totalHoursSpentMinutes:He.spent,totalHoursAllocatedMinutes:He.allocated}},[P,He]),[xe,je]=useState(true),[Ne,ze]=useState(null),[Me,at]=useState("position"),[be,pt]=useState("asc"),[Ke,Ue]=useState(""),[kt,Ht]=useState(()=>Te().statusFilter),[qe,We]=useState(()=>Te().hideCompleted),[ot,zt]=useState(h||vw),[Ee,nt]=useState(false),[F,le]=useState(false),[R,J]=useState({isOpen:false,x:0,y:0,type:"task"}),[O,Z]=useState(null),[Ve,ke]=useState(false),[Re,Ae]=useState(null),[Pe,ct]=useState(null),[Qe,st]=useState(null),mt=useRef(0),jt=useRef(false),St=!!(a.onTaskMove||a.onTaskReparent),[Ut,gt]=useState(null),[Mt,Bt]=useState(null),_t=S=>S==="assignees"||S==="teamLoad"?"assignees":S==="startDate"?"startDate":S==="endDate"?"endDate":null,Wt=useRef([]),rt=useCallback((S,re)=>{St&&(re.preventDefault(),mt.current=re.clientY,Z(S),jt.current=false,ke(false),st({x:re.clientX,y:re.clientY}));},[St]),da=useCallback(S=>{if(!O||(Math.abs(S.clientY-mt.current)>5&&!jt.current&&(jt.current=true,ke(true)),st({x:S.clientX,y:S.clientY}),!jt.current))return;let ye=document.querySelectorAll("[data-listview-row]"),Se=null,Fe=null;ye.forEach(Ye=>{let me=Ye.getBoundingClientRect(),_e=Ye.getAttribute("data-listview-row");if(_e&&_e!==O&&S.clientY>=me.top&&S.clientY<=me.bottom){Se=_e;let Oe=S.clientY-me.top,yt=me.height;Fe=Oe<yt*.25?"above":Oe>yt*.75?"below":"child";}}),Ae(Se),ct(Fe);},[O]),ha=useCallback(()=>{if(jt.current&&O&&Re&&Pe){if(Pe==="child"&&a.onTaskReparent)a.onTaskReparent(O,Re);else if(Pe==="above"||Pe==="below"){let S=(Se,Fe,Ye=null)=>{for(let me of Se){if(me.id===Fe)return Ye;if(me.subtasks){let _e=S(me.subtasks,Fe,me.id);if(_e!==void 0)return _e}}},re=S(e,O,null),ye=S(e,Re,null);if(a.onTaskReparent){let Se=(yt,ea)=>{if(ea===null)return yt;for(let Nt of yt){if(Nt.id===ea)return Nt.subtasks||[];if(Nt.subtasks){let Dt=Se(Nt.subtasks,ea);if(Dt.length>0||Nt.subtasks.some(wa=>wa.id===ea))return Dt}}return []},Fe=Se(e,ye??null),Ye=Fe.findIndex(yt=>yt.id===Re),me=re===ye,_e=me?Fe.findIndex(yt=>yt.id===O):-1,Oe=Pe==="below"?Ye+1:Ye;me&&_e!==-1&&_e<Ye&&(Oe-=1),a.onTaskReparent(O,ye??null,Math.max(0,Oe));}}}Z(null),Ae(null),ct(null),st(null),jt.current=false,ke(false);},[O,Re,Pe,e,a]),W=(S,re)=>re==="assignees"?S.assignees:re==="startDate"?S.startDate:S.endDate,ne=(S,re,ye,Se)=>{S.preventDefault(),S.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let Fe=Array.from(document.querySelectorAll("[data-listview-row]")),Ye=Fe.map(Vt=>Vt.getAttribute("data-listview-row")||""),me=Math.max(0,Ye.indexOf(re)),_e=Vt=>Ye.slice(me,Vt+1);Bt({sourceTaskId:re,column:ye,sourceIndex:Se,targetIndex:Se,rangeIds:new Set([re])});let yt=(Vt=>{let Ft=Vt?.parentElement??null;for(;Ft;){let kr=window.getComputedStyle(Ft).overflowY;if((kr==="auto"||kr==="scroll")&&Ft.scrollHeight>Ft.clientHeight)return Ft;Ft=Ft.parentElement;}let Ua=document.scrollingElement;return Ua&&Ua.scrollHeight>Ua.clientHeight?Ua:null})(S.currentTarget),ea=Vt=>{let Ft=me,Ua=false;Fe.forEach((kr,fr)=>{let tr=kr.getBoundingClientRect();Vt>=tr.top&&Vt<=tr.bottom&&(Ft=fr,Ua=true);});let hr=Fe[Fe.length-1];if(!Ua&&hr){let kr=hr.getBoundingClientRect();Vt>kr.bottom&&(Ft=Fe.length-1);}return Ft<me&&(Ft=me),Ft},Nt=S.clientY,Dt=null,wa=()=>{Dt!==null&&(cancelAnimationFrame(Dt),Dt=null);},Ea=()=>{let Vt=ea(Nt),Ft=new Set(_e(Vt));Bt(Ua=>Ua&&{...Ua,targetIndex:Vt,rangeIds:Ft});},Xa=()=>{if(wa(),!yt)return;let Vt=yt,Ua=Vt===document.scrollingElement?{top:0,bottom:window.innerHeight}:Vt.getBoundingClientRect(),hr=60,kr=12,fr=Nt-Ua.top,tr=Ua.bottom-Nt,No=Vt.scrollHeight-Vt.clientHeight;if(tr<hr&&Vt.scrollTop<No){let bs=Math.max(1,Math.round(kr*(1-Math.max(0,tr)/hr))),ln=()=>{Vt.scrollTop+=bs,Ea(),Vt.scrollTop<Vt.scrollHeight-Vt.clientHeight&&(Dt=requestAnimationFrame(ln));};Dt=requestAnimationFrame(ln);}else if(fr<hr&&Vt.scrollTop>0){let bs=Math.max(1,Math.round(kr*(1-Math.max(0,fr)/hr))),ln=()=>{Vt.scrollTop-=bs,Ea(),Vt.scrollTop>0&&(Dt=requestAnimationFrame(ln));};Dt=requestAnimationFrame(ln);}},ta=Vt=>{Nt=Vt.clientY,Ea(),Xa();},ma=Vt=>{window.removeEventListener("mousemove",ta),window.removeEventListener("mouseup",ma),wa(),document.body.style.cursor="",document.body.style.userSelect="",Bt(null);let Ft=ea(Vt.clientY),Ua=new Map(Wt.current.map(tr=>[tr.id,tr])),hr=Ua.get(re);if(!hr)return;let kr=W(hr,ye),fr=[];for(let tr of _e(Ft)){if(tr===re)continue;let No=Ua.get(tr);No&&(No.subtasks&&No.subtasks.length>0||fr.push(tr));}fr.length>0&&a.onBulkFill?.(fr,ye,kr);};window.addEventListener("mousemove",ta),window.addEventListener("mouseup",ma);},ft=S=>Mt?Mt.rangeIds.has(S):false;useEffect(()=>{if(O)return document.addEventListener("mousemove",da),document.addEventListener("mouseup",ha),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",da),document.removeEventListener("mouseup",ha),document.body.style.cursor="",document.body.style.userSelect="";}},[O,da,ha]);let[Tt,pa]=useState("all"),[ce,ve]=useState(false),Et=useRef(null),it=useRef(null),wt=useMemo(()=>{let S=0;function re(ye,Se){for(let Fe of ye)Se>S&&(S=Se),Fe.subtasks?.length&&re(Fe.subtasks,Se+1);}return re(e,1),S},[e]);useEffect(()=>{if(!ce)return;let S=re=>{Et.current?.contains(re.target)||it.current?.contains(re.target)||ve(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[ce]),useEffect(()=>{if(Tt==="all"){let ye=function(Se){for(let Fe of Se)Fe.subtasks?.length&&(Fe.isExpanded===false&&a.onTaskToggleExpand?.(Fe.id),ye(Fe.subtasks));};ye(e);}else {let ye=function(Se,Fe){for(let Ye of Se)if(Ye.subtasks?.length){let me=Fe<Tt,_e=Ye.isExpanded!==false;me!==_e&&a.onTaskToggleExpand?.(Ye.id),ye(Ye.subtasks,Fe+1);}};ye(e,1);}},[Tt]);let[_,ge]=useState(null),[ae,U]=useState(0),[oe,Le]=useState(0),C=useRef(null),[$,fe]=useState(null),[De,se]=useState(null);useEffect(()=>{h&&zt(S=>{if(S.length===h.length){let re=true;for(let ye=0;ye<S.length;ye++){let Se=S[ye],Fe=h[ye];if(!Se||!Fe||Se.id!==Fe.id||Se.visible!==Fe.visible||Se.width!==Fe.width||Se.label!==Fe.label){re=false;break}}if(re)return S}return h});},[h]),useEffect(()=>{if(!(!T||typeof window>"u"))try{localStorage.setItem(T,JSON.stringify({statusFilter:kt,hideCompleted:qe}));}catch(S){console.error("Error persisting filter state:",S);}},[T,kt,qe]);let ut=useMemo(()=>{let S=new Set;function re(ye){for(let Se of ye)Se.subtasks?.length&&(Se.isExpanded!==false&&S.add(Se.id),re(Se.subtasks));}return re(e),S},[e]),lt=useMemo(()=>ot.filter(S=>S.visible),[ot]),Zt=useCallback(S=>{a.onTaskToggleExpand?.(S);},[a]),Yt=useCallback(S=>{Me===S?pt(re=>re==="asc"?"desc":"asc"):(at(S),pt("asc")),a.onSortChange?.({column:S,direction:be==="asc"?"desc":"asc"});},[Me,be,a]),Kt=useCallback(S=>{zt(S),a.onColumnsChange?.(S);},[a]),La=useCallback(S=>{let re=ot.map(ye=>ye.id===S?{...ye,visible:false}:ye);Kt(re);},[ot,Kt]),Rr=useCallback((S,re)=>{at(S),pt(re);},[]),na=useCallback((S,re,ye)=>{N&&(S.preventDefault(),J({isOpen:true,x:S.clientX,y:S.clientY,type:re?"task":"header",task:re,columnId:ye}));},[N]),Fn=useCallback(()=>{J(S=>({...S,isOpen:false}));},[]),po=useCallback((S,re)=>{if(!w)return;S.preventDefault(),S.stopPropagation();let ye=ot.find(Se=>Se.id===re);ye&&(ge(re),U(S.clientX),Le(ye.width));},[ot,w]);useEffect(()=>{if(!_)return;let S=ot,re=Se=>{let Fe=Se.clientX-ae,Ye=Math.max(50,oe+Fe);S=S.map(me=>me.id===_?{...me,width:Ye}:me),zt(S);},ye=()=>{a.onColumnsChange?.(S),ge(null);};return document.addEventListener("mousemove",re),document.addEventListener("mouseup",ye),()=>{document.removeEventListener("mousemove",re),document.removeEventListener("mouseup",ye);}},[_,ae,oe,a]);let gs=useCallback((S,re)=>{if(re==="name"){S.preventDefault();return}fe(re),S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",re),S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="0.5");},[]),mo=useCallback(S=>{S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="1"),fe(null),se(null);},[]),ii=useCallback((S,re)=>{S.preventDefault(),re!=="name"&&(S.dataTransfer.dropEffect="move",se(re));},[]),er=useCallback(()=>{se(null);},[]),fs=useCallback((S,re)=>{if(S.preventDefault(),!$||$===re||re==="name")return;let ye=[...ot],Se=ye.findIndex(me=>me.id===$),Fe=ye.findIndex(me=>me.id===re);if(Se===-1||Fe===-1)return;let Ye=ye.splice(Se,1);Ye[0]&&(ye.splice(Fe,0,Ye[0]),Kt(ye),fe(null),se(null));},[$,ot,Kt]),Vr=useCallback(async S=>{if(a.onCreateCustomField){let re={...S,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(re);}le(false);},[a]),Gr=useCallback(S=>S.progress===100||S.status==="completed"?"completed":S.progress&&S.progress>0||S.status==="in-progress"?"in-progress":"todo",[]),Or=useMemo(()=>{let S=w0(e);if(Ke.trim()){let re=Ke.toLowerCase();S=S.filter(ye=>ye.name.toLowerCase().includes(re));}if(kt!=="all"){let re=new Set(S.filter(ye=>Gr(ye)===kt).flatMap(ye=>ye.parentPath));S=S.filter(ye=>re.has(ye.id));}if(qe){let re=new Set(S.filter(ye=>Gr(ye)!=="completed").flatMap(ye=>ye.parentPath));S=S.filter(ye=>re.has(ye.id));}return S.sort((re,ye)=>{let Se,Fe;switch(Me){case "name":Se=re.name.toLowerCase(),Fe=ye.name.toLowerCase();break;case "startDate":Se=re.startDate?.getTime()||0,Fe=ye.startDate?.getTime()||0;break;case "endDate":Se=re.endDate?.getTime()||0,Fe=ye.endDate?.getTime()||0;break;case "progress":Se=re.progress||0,Fe=ye.progress||0;break;case "status":Se=re.status||"todo",Fe=ye.status||"todo";break;case "priority":let Ye={urgent:0,high:1,medium:2,low:3,none:4};Se=Ye[re.priority]??4,Fe=Ye[ye.priority]??4;break;case "position":return 0;default:return 0}return Se<Fe?be==="asc"?-1:1:Se>Fe?be==="asc"?1:-1:0}),S},[e,Ke,kt,qe,Me,be,Gr]);Wt.current=Or;let An=useCallback((S,re)=>{let ye=Ye=>{a.onTaskUpdate?.({...S,...Ye});},Se=Ye=>Ye?S.customFields?.find(_e=>_e.fieldId===Ye)?.value:void 0,Fe=(Ye,me)=>{if(!Ye)return;let Oe=[...S.customFields||[]],yt=Oe.findIndex(ea=>ea.fieldId===Ye);yt>=0?Oe[yt]={fieldId:Ye,value:me}:Oe.push({fieldId:Ye,value:me}),ye({customFields:Oe});};switch(re.type){case "name":return null;case "status":return jsx(lg,{value:S.status||(S.progress===100?"completed":S.progress&&S.progress>0?"in-progress":"todo"),onChange:me=>{ye({status:me,progress:me==="completed"?100:me==="in-progress"?50:0});},isDark:V,locale:f,translations:q.status});case "priority":return jsx(cg,{value:S.priority,onChange:me=>ye({priority:me}),isDark:V,locale:f});case "assignees":{let me=S.hasChildren,_e=S.assignees||[];if(me&&S.subtasks?.length){let Oe=new Map,yt=ea=>{(ea||[]).forEach(Nt=>{(Nt.assignees||[]).forEach(Dt=>{Oe.has(Dt.name)||Oe.set(Dt.name,Dt);}),Nt.subtasks?.length&&yt(Nt.subtasks);});};yt(S.subtasks),_e=Array.from(Oe.values());}else me&&(_e=[]);return jsx(pc,{value:_e,availableUsers:l,onChange:Oe=>ye({assignees:Oe}),isDark:V,locale:f,disabled:me})}case "startDate":return jsx(dl,{value:S.startDate,onChange:me=>ye({startDate:me}),isDark:V,locale:f,dateField:"start",startDate:S.startDate,endDate:S.endDate});case "endDate":return jsx(dl,{value:S.endDate,onChange:me=>ye({endDate:me}),isDark:V,locale:f,dateField:"end",startDate:S.startDate,endDate:S.endDate});case "progress":{let me=!!(S.subtasks&&S.subtasks.length>0),_e=me?x0(Mc(S.subtasks||[])):S.progress||0;return jsx(xg,{value:_e,onChange:me?void 0:Oe=>{let yt=Oe===100?"completed":Oe>0?"in-progress":"todo";ye({progress:Oe,status:yt});},isDark:V,disabled:me})}case "tags":return jsx(Fg,{value:S.tags||[],isDark:V});case "text":return jsx(kg,{value:Se(re.customFieldId)||"",onChange:me=>Fe(re.customFieldId,me),isDark:V});case "number":return jsx(Ng,{value:Se(re.customFieldId)||0,onChange:me=>Fe(re.customFieldId,me),isDark:V});case "date":let Ye=Se(re.customFieldId);return jsx(dl,{value:Ye?new Date(Ye):void 0,onChange:me=>Fe(re.customFieldId,me),isDark:V,locale:f});case "dropdown":return jsx(Dg,{value:Se(re.customFieldId)||"",options:re.options||[],onChange:me=>Fe(re.customFieldId,me),isDark:V});case "checkbox":return jsx(Eg,{value:Se(re.customFieldId)||false,onChange:me=>Fe(re.customFieldId,me),isDark:V});case "estimatedTime":{let me=S.status==="completed"||S.progress===100;return jsx(Br,{value:S.estimatedTime,onChange:_e=>ye({estimatedTime:_e}),isDark:V,locale:f,disabled:me,lens:k,hourlyRate:B(S)})}case "quotedTime":{let me=S.status==="completed"||S.progress===100,_e=E?.enabled&&(!E.columns||E.columns.includes("quotedTime"));return jsx(Br,{value:S.quotedTime,onChange:Oe=>ye({quotedTime:Oe}),isDark:V,locale:f,disabled:me,isBlurred:_e,lens:k,hourlyRate:B(S)})}case "elapsedTime":{let me=S.status==="completed"||S.progress===100,_e=S.executedDollarsCanonical;return jsx(Br,{value:S.elapsedTime,onChange:Oe=>ye({elapsedTime:Oe}),isDark:V,locale:f,disabled:me,lens:k,hourlyRate:B(S),financialOverride:_e})}case "effortMinutes":{if(ee&&S.subtasks&&S.subtasks.length>0){let{allocated:ea}=us(S);if(k==="financial"){let Nt=X(S),Dt=Math.round(Nt.dollarAllocated),wa=Math.round(Nt.dollarQuoted),Ea=wa-Dt;return jsxs("div",{className:"flex flex-col",children:[Dt>0?jsxs("span",{className:c("text-sm font-mono",V?"text-white/60":"text-gray-500"),children:["$",Dt.toLocaleString("es-CO")]}):null,Ea!==0&&Dt>0&&wa>0&&jsxs("span",{className:c("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ea>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ea>0?"+":"",Math.abs(Ea)>=1e3?`$${(Ea/1e3).toFixed(1)}K`:`$${Ea}`]})]})}return jsx(Br,{value:ea>0?ea:void 0,isDark:V,locale:f,disabled:true,lens:k,hourlyRate:K})}let me=S.status==="completed"||S.progress===100,_e=S.effortMinutes||0,Oe=S.soldEffortMinutes||0,yt=B(S);if(k==="financial"&&yt&&_e>0&&Oe>0){let ea=Math.round(_e/60*yt),Dt=Math.round(Oe/60*yt)-ea;return jsxs("div",{className:"flex flex-col",children:[jsx(Br,{value:_e,onChange:wa=>ye({effortMinutes:wa}),isDark:V,locale:f,disabled:me,lens:k,hourlyRate:B(S)}),Dt!==0&&jsxs("span",{className:c("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Dt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Dt>0?"+":"",Math.abs(Dt)>=1e3?`$${(Dt/1e3).toFixed(1)}K`:`$${Dt}`]})]})}return jsx(Br,{value:_e,onChange:ea=>ye({effortMinutes:ea}),isDark:V,locale:f,disabled:me,lens:k,hourlyRate:B(S)})}case "timeLoggedMinutes":{let me=S.executedDollarsCanonical;if(ee&&S.subtasks&&S.subtasks.length>0){let{spent:Oe}=us(S);return jsx(Br,{value:Oe>0?Oe:void 0,isDark:V,locale:f,disabled:true,lens:k,hourlyRate:B(S),financialOverride:me})}let _e=S.status==="completed"||S.progress===100;return jsx(Br,{value:S.timeLoggedMinutes,onChange:a.onLogTime?Oe=>{a.onLogTime?.(S,Oe);}:void 0,isDark:V,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:_e,lens:k,hourlyRate:B(S),financialOverride:me})}case "soldEffortMinutes":{if(ee&&S.subtasks&&S.subtasks.length>0){let{quoted:Oe}=us(S),yt=E?.enabled&&(!E.columns||E.columns.includes("soldEffortMinutes"));return jsx(Br,{value:Oe>0?Oe:void 0,isDark:V,locale:f,disabled:true,isBlurred:yt,lens:k,hourlyRate:B(S)})}let me=S.status==="completed"||S.progress===100,_e=E?.enabled&&(!E.columns||E.columns.includes("soldEffortMinutes"));return jsx(Br,{value:S.soldEffortMinutes,onChange:Oe=>ye({soldEffortMinutes:Oe}),isDark:V,locale:f,disabled:me,isBlurred:_e,lens:k,hourlyRate:B(S)})}case "scheduleVariance":{let me=S.effortMinutes||0,_e=S.soldEffortMinutes||0,Oe=S.timeLoggedMinutes||0,yt=me>0||_e>0||Oe>0;return jsx(Bg,{startDate:S.startDate,endDate:S.endDate,scheduleVariance:S.scheduleVariance,isDark:V,locale:f,hasTimeAllocated:yt})}case "hoursBar":{if(ee&&S.hasChildren){let{spent:me,allocated:_e,quoted:Oe}=us(S),yt=me>_e&&_e>0;return jsxs("span",{className:c("text-[11px] font-mono flex items-center gap-1.5",V?"text-white/50":"text-gray-500"),children:[jsx("span",{className:c("font-bold",yt?"text-[#FF453A]":V?"text-white/80":"text-gray-800"),children:cs(me)}),_e>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:V?"text-white/60":"text-gray-600",children:cs(_e)})]}),Oe>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:V?"text-amber-400/70":"text-amber-600",children:cs(Oe)})]})]})}return jsx(Og,{task:S,isDark:V,locale:f,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:k,hourlyRate:B(S)})}case "teamLoad":return S.hasChildren||S.subtasks&&S.subtasks.length>0?jsx(Hg,{task:S,isDark:V,locale:f}):jsx(pc,{value:S.assignees||[],availableUsers:l,onChange:_e=>{a.onTaskUpdate?.({...S,assignees:_e});},isDark:V,locale:f});case "blockers":return jsx(Ug,{blockers:S.blockers,isDark:V,locale:f});case "weight":{let me=z.get(S.id);if(me!==void 0)return jsx("span",{className:c("text-xs font-mono",me>0?V?"text-white/50":"text-gray-400":V?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:me>0?`${Number(me.toFixed(2))}%`:"\u2014"});let _e=S.weight||0;return jsx(kw,{value:_e,onChange:Oe=>ye({weight:Oe}),isDark:V})}default:return jsx("span",{className:c("text-sm",V?"text-white/60":"text-gray-500"),children:"-"})}},[a,V,f,l,q,ee,z]),Oo=useCallback(S=>{let ye={name:q.columns.name,status:q.columns.status,priority:q.columns.priority,assignees:q.columns.assignees,startDate:q.columns.startDate,endDate:q.columns.endDate,progress:q.columns.progress,tags:q.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:q.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:q.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:q.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:q.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:q.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:q.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:q.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:q.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:q.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:q.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:q.columns.weight||(f==="es"?"Peso":"Weight")}[S.type]||S.label;return typeof ye=="string"?ye:String(ye||S.type)},[q,f]),sn=useMemo(()=>{let ye=lt.reduce((Fe,Ye)=>Fe+Ye.width,0)+(x?48:0),Se={};for(let Fe of lt)Se[Fe.id]=`${Fe.width/ye*100}%`;return Se},[lt,x]);return r?jsx("div",{className:c("flex-1 flex items-center justify-center",V?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#00E5CC]"}),jsxs("p",{className:c("text-sm",V?"text-white/60":"text-gray-600"),children:[q.empty.noTasks,"..."]})]})}):n?jsx("div",{className:c("flex-1 flex items-center justify-center",V?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:c("text-lg font-semibold mb-2",V?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:c("text-sm",V?"text-white/60":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsx("div",{className:c("flex-1 flex items-center justify-center",V?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#00E5CC]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#00E5CC]"})}),jsx("h3",{className:c("text-lg font-semibold mb-2",V?"text-white":"text-gray-900"),children:q.empty.noTasks}),jsx("p",{className:c("text-sm",V?"text-white/60":"text-gray-600"),children:q.empty.addFirstTask})]})}):jsxs("div",{ref:C,className:c(V?"bg-[#0D0D0D]":"bg-white",_&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[jsx("div",{className:c("flex-shrink-0 px-6 py-4 border-b",V?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:c("text-sm",V?"text-white/60":"text-gray-600"),children:[Or.length," ",q.pagination.tasks]}),y&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:c("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",V?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:Ke,onChange:S=>Ue(S.target.value),placeholder:q.toolbar.searchPlaceholder,className:c("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",V?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),i&&jsx("div",{className:"flex items-center gap-2",children:i}),b&&wt>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:Et,onClick:()=>ve(!ce),className:c("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",V?ce?"bg-[#00E5CC]/10 border-[#00E5CC]/40 text-[#00E5CC]":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":ce?"bg-[#00E5CC]/15 border-[#00E5CC] text-[#00C4AE]":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsx(Layers,{className:"w-3.5 h-3.5"}),Tt==="all"?f==="es"?"Todos":"All":`L${Tt}`]}),ce&&jsx("div",{ref:it,className:c("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",V?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(wt,5)},(S,re)=>({value:re+1,label:`L${re+1}`}))].map(S=>jsxs("button",{onClick:()=>{pa(S.value),ve(false);},className:c("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",V?Tt===S.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":Tt===S.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:S.label}),Tt===S.value&&jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(S.value)))})]}),jsx(u0,{value:kt,hideCompleted:qe,onChange:Ht,onHideCompletedChange:We,isDark:V,locale:f}),te?.enabled&&te.data&&!xe&&jsx("button",{onClick:()=>je(true),className:c("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",V?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:f==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,D&&A&&jsxs(motion.button,{onClick:A,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #00E5CC 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:q.toolbar.newTask})]})]})}),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:c("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",V?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[St&&jsx("div",{className:"w-5 flex-shrink-0"}),lt.map(S=>{let re=S.id!=="name",ye=De===S.id&&$!==S.id;return jsxs("div",{className:c("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",V?"text-white/60":"text-gray-500",re&&"cursor-grab",S.type!=="name"&&"justify-center",$===S.id&&"opacity-50",ye&&(V?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:sn[S.id],minWidth:S.minWidth},draggable:re,onDragStart:re?Se=>gs(Se,S.id):void 0,onDragEnd:re?mo:void 0,onDragOver:re?Se=>ii(Se,S.id):void 0,onDragLeave:re?er:void 0,onDrop:re?Se=>fs(Se,S.id):void 0,onContextMenu:Se=>na(Se,void 0,S.id),children:[re&&jsx(GripVertical,{className:c("w-3 h-3 flex-shrink-0 transition-opacity",V?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),u?jsxs("button",{draggable:false,onClick:Se=>{let Fe=Se.currentTarget.getBoundingClientRect();u(S.id,Fe);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[Oo(S),m?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:p,display:"inline-block",flexShrink:0}}),Me===S.id&&jsx(ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):S.sortable?jsxs("button",{draggable:false,onClick:()=>Yt(S.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[Oo(S),m?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:p,display:"inline-block",flexShrink:0}}),jsx(ArrowUpDown,{className:c("w-3 h-3",Me===S.id&&"text-[#00E5CC]")})]}):jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[Oo(S),m?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:p,display:"inline-block",flexShrink:0}})]}),w&&S.resizable&&jsx("div",{className:c("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#00E5CC]",_===S.id&&"bg-[#00E5CC]"),onMouseDown:Se=>po(Se,S.id)})]},S.id)}),x&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:S=>{S.stopPropagation(),nt(re=>!re);},className:c("p-0.5 rounded transition-colors",V?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",Ee&&(V?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(o0,{isOpen:Ee,onClose:()=>nt(false),columns:ot,customFields:d,onColumnsChange:Kt,onCreateCustomField:()=>{nt(false),le(true);},isDark:V,locale:f})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Or.map((S,re)=>{let ye=ut.has(S.id),Se=Math.min(re*.01,.2),Fe=S.hasChildren&&S.level===0,Ye=S.subtasks?.length||0;if(Fe){let{spent:Nt,allocated:Dt,quoted:wa}=us(S),Ea=ww(S);return jsxs(motion.div,{"data-task-id":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Se},className:c("flex items-center border-y cursor-pointer transition-colors duration-500",V?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",Ne===S.id&&(V?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(S),children:[St&&jsx("div",{className:"w-5 flex-shrink-0"}),lt.map(Xa=>jsx("div",{className:c("flex items-center px-4 py-3 min-h-[56px]",Xa.type!=="name"&&"justify-center"),style:{width:sn[Xa.id],minWidth:Xa.minWidth},children:Xa.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{onClick:ta=>{ta.stopPropagation(),Zt(S.id);},className:c("p-0.5 rounded flex-shrink-0 mt-0.5",V?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ye?jsx(ChevronDown,{className:c("w-4 h-4",V?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:c("w-4 h-4",V?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:ta=>{ta.stopPropagation(),Zt(S.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:ye?jsx(FolderOpen,{className:"w-4 h-4",style:{color:V?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:V?"#FFD60A":"#B45309"}})}),S.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:V?"#FFD60A":"#B45309"},children:S.wbsCode}),jsxs("div",{className:"flex flex-col min-w-0",children:[jsx("span",{className:c("text-[13px] font-bold uppercase tracking-wide",V?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:S.name}),jsxs("span",{className:c("text-[10px] font-mono",V?"text-white/30":"text-gray-500"),children:["(",Ye," ",f==="es"?Ye===1?"Tarea":"Tareas":Ye===1?"Item":"Items",")"]}),Ea!==null&&jsxs("span",{className:c("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",Ea>=1?"text-[#32D74B] bg-[#32D74B]/10":Ea>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",Ea.toFixed(2)]})]})]}):Xa.type==="timeLoggedMinutes"?k==="financial"?(()=>{let ta=S.executedDollarsCanonical,ma=ta!=null?Math.round(ta):Math.round(X(S).dollarSpent);return ma>0?jsxs("span",{className:c("text-sm font-mono",V?"text-white/60":"text-gray-500"),children:["$",ma.toLocaleString("en-US")]}):null})():jsx(Br,{value:Nt>0?Nt:void 0,isDark:V,locale:f,disabled:true,lens:k,hourlyRate:B(S)}):Xa.type==="soldEffortMinutes"?k==="financial"?(()=>{let ta=X(S),ma=Math.round(ta.dollarQuoted);return ma>0?jsxs("span",{className:c("text-sm font-mono",V?"text-white/60":"text-gray-500"),children:["$",ma.toLocaleString("en-US")]}):null})():jsx(Br,{value:wa>0?wa:void 0,isDark:V,locale:f,disabled:true,lens:k,hourlyRate:B(S)}):Xa.type==="effortMinutes"?k==="financial"?(()=>{let ta=X(S),ma=Math.round(ta.dollarAllocated),Vt=Math.round(ta.dollarQuoted),Ft=Vt-ma;return jsxs("div",{className:"flex flex-col",children:[ma>0?jsxs("span",{className:c("text-sm font-mono",V?"text-white/60":"text-gray-500"),children:["$",ma.toLocaleString("es-CO")]}):null,Ft!==0&&ma>0&&Vt>0&&jsxs("span",{className:c("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ft>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ft>0?"+":"",Math.abs(Ft)>=1e3?`$${(Ft/1e3).toFixed(1)}K`:`$${Ft}`]})]})})():jsx(Br,{value:Dt>0?Dt:void 0,isDark:V,locale:f,disabled:true,lens:k,hourlyRate:B(S)}):An(S,Xa)},Xa.id)),x&&jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)}let me=O===S.id,_e=Re===S.id,Oe=_e&&Pe==="above",yt=_e&&Pe==="below",ea=_e&&Pe==="child";return jsxs(motion.div,{"data-task-id":S.id,"data-listview-row":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Se},className:c("flex items-center border-b transition-colors relative group",V?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",Ne===S.id&&(V?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:me?.4:1,backgroundColor:ea?V?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:ea?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>a.onTaskClick?.(S),onDoubleClick:()=>a.onTaskDoubleClick?.(S),onContextMenu:Nt=>na(Nt,S),onMouseEnter:()=>gt(S.id),onMouseLeave:()=>gt(Nt=>Nt===S.id?null:Nt),children:[Oe&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),yt&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),St&&jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:Nt=>rt(S.id,Nt),style:{color:V?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),lt.map(Nt=>{let Dt=!!(S.subtasks&&S.subtasks.length>0),wa=_t(Nt.type),Xa=!!wa&&!Dt&&Ut===S.id&&!Mt,ta=!!Mt&&!!wa&&Mt.column===wa&&ft(S.id);return jsxs("div",{className:c("flex items-center px-4 py-3 min-h-[56px]",Nt.type!=="name"&&"justify-center"),style:{width:sn[Nt.id],minWidth:Nt.minWidth,position:"relative",backgroundColor:ta?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:ta?"inset 0 0 0 1px rgba(0, 229, 204, 0.45)":void 0},children:[Nt.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&S.level>0&&jsx("div",{style:{width:`${S.level*24}px`},className:"flex-shrink-0"}),b&&S.hasChildren&&jsx("button",{onClick:ma=>{ma.stopPropagation(),Zt(S.id);},className:c("p-0.5 rounded flex-shrink-0",V?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ye?jsx(ChevronDown,{className:c("w-4 h-4",V?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:c("w-4 h-4",V?"text-white/60":"text-gray-400")})}),b&&!S.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(S.wbsCode||S.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[S.wbsCode&&jsx("span",{className:c("text-[10px] font-mono",V?"text-[#00E5CC]":"text-[#00C4AE]"),children:S.wbsCode}),S.taskCode&&jsx("span",{className:c("text-[10px] font-mono",V?"text-white/40":"text-gray-400"),children:S.taskCode})]}),jsx("span",{className:c("truncate",S.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",S.progress===100?V?"line-through text-white/50":"line-through text-gray-400":S.hasChildren?V?"text-white":"text-gray-900":V?"text-[#D1D5DB]":"text-gray-600"),children:S.name}),S.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${S.tags[0].color}20`,color:S.tags[0].color},children:S.tags[0].name})]})]}):An(S,Nt),Xa&&wa&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:ma=>ne(ma,S.id,wa,re),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:"#00E5CC",border:"1px solid rgba(0,0,0,0.3)",cursor:"crosshair",zIndex:5}})]},Nt.id)}),x&&jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)})}),I&&Or.length>0&&(()=>{let{spent:S,allocated:re,quoted:ye}=He,Se=re-S,Fe=Se<0,Ye=Fe?`+${cs(Math.abs(Se))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${cs(Se)} ${f==="es"?"AHORRADO":"SAVED"}`,me=k==="financial"&&K>0,_e=Y?.breakdown,Oe=!!_e&&((_e.equipment??0)>0||(_e.travel??0)>0),yt=_e?.laborSpent!=null?_e.laborSpent:Y?.spent!=null?Y.spent:He.dollarSpent,ea=_e?.laborAllocated!=null?_e.laborAllocated:Y?.allocated!=null?Y.allocated:He.dollarAllocated,Nt=Y?.quoted!=null?Y.quoted:He.dollarQuoted,Dt=(ta,ma)=>{if(me){let Vt=ma??ta/60*K;return `$${Math.round(Vt).toLocaleString("es-CO")}`}return cs(ta)},wa=me?Math.abs(ea-yt):0,Ea=me?`+$${wa.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Fe?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:Ye,Xa=me&&Oe?f==="es"?"solo mano de obra":"labor only":void 0;return jsxs("div",{className:c("flex items-center sticky bottom-0 z-[5]",V?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:V?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[St&&jsx("div",{className:"w-5 flex-shrink-0"}),lt.map(ta=>jsx("div",{className:c("flex items-center px-4 py-3",ta.type!=="name"&&"justify-center"),style:{width:sn[ta.id],minWidth:ta.minWidth},children:ta.type==="name"?jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:c("text-[11px] font-black uppercase tracking-widest",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),Xa&&jsxs("span",{className:c("text-[9px] font-mono mt-0.5 flex items-center gap-1",V?"text-white/35":"text-gray-400"),children:[jsx(Info,{className:"w-2.5 h-2.5"}),Xa]})]}):ta.type==="hoursBar"?jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:c("text-[12px] font-bold",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Dt(S,me?yt:void 0)}),jsx("span",{className:c("text-[11px]",V?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:c("text-[11px]",V?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:Dt(re,me?ea:void 0)})]}),re>0&&jsx("span",{className:c("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Fe?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:me?Ea:Ye})]}):ta.type==="soldEffortMinutes"?jsx("span",{className:c("text-[12px] font-bold",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ye>0?Dt(ye,me?Nt:void 0):"\u2013"}):ta.type==="effortMinutes"?(()=>{if(me&&ye>0&&re>0){let ma=Math.round(Nt),Vt=Math.round(ea),Ft=ma-Vt,Ua=ma>0?Math.round(Ft/ma*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:c("text-[12px] font-bold",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Dt(re,ea)}),jsxs("span",{className:c("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ft>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ft>=0?"+":"",Math.abs(Ft)>=1e3?`$${(Ft/1e3).toFixed(1)}K`:`$${Ft}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Ua,"%)"]})]})]})}return jsx("span",{className:c("text-[12px] font-bold",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:re>0?Dt(re,me?ea:void 0):"\u2013"})})():ta.type==="timeLoggedMinutes"?jsx("span",{className:c("text-[12px] font-bold",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:S>0?Dt(S,me?yt:void 0):"\u2013"}):ta.type==="progress"?(()=>{let ma=x0(Mc(e||[]));return jsxs("span",{className:c("text-[12px] font-bold font-mono",V?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[ma,"%"]})})():ta.type==="weight"?(()=>{let ma=e||[],Vt=[],Ft=fr=>{for(let tr of fr)Vt.push(tr),tr.subtasks?.length&&Ft(tr.subtasks);};Ft(ma);let hr=Vt.filter(fr=>!fr.subtasks?.length||fr.subtasks.length===0).reduce((fr,tr)=>fr+(tr.weight||0),0),kr=Math.abs(hr-100)<.1;return jsxs("span",{className:c("text-[12px] font-bold font-mono",kr?V?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(hr.toFixed(1)),"%"]})})():jsx("span",{className:c("text-[11px]",V?"text-white/30":"text-gray-300"),children:"\u2013"})},ta.id)),x&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Or.length===0&&Ke&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:c("w-12 h-12 mx-auto mb-4",V?"text-white/30":"text-gray-400")}),jsx("p",{className:c(V?"text-white/60":"text-gray-600"),children:q.empty.noResults})]})})]})}),te?.enabled&&te.data&&xe&&jsx(m0,{data:te.data,isDark:V,locale:f,onClose:()=>je(false),lens:t?.lens,onUnassignedTaskClick:S=>{let re=document.querySelector(`[data-task-id="${S}"]`);re&&(re.scrollIntoView({behavior:"smooth",block:"center"}),ze(S),setTimeout(()=>ze(null),2e3));}})]}),jsx(qg,{state:R,onClose:Fn,isDark:V,locale:f,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:La,onColumnSort:Rr,availableUsers:l,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),Ve&&Qe&&O&&createPortal(jsx("div",{style:{position:"fixed",left:Qe.x+12,top:Qe.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let re=Ie.flattenTasks(e).find(ye=>ye.id===O);return re?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:V?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${V?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsx(GripVertical,{className:"w-3 h-3",style:{color:"#00E5CC"}}),jsx("span",{className:"text-xs font-medium",style:{color:V?"#e6edf3":"#111827"},children:re.name})]}):null})()}),document.body),jsx(i0,{isOpen:F,onClose:()=>le(false),onSave:Vr,isDark:V,locale:f})]})}var C0=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],T0=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"},{type:"effortMinutes",labelKey:"columns.effortMinutes",icon:"Clock"},{type:"timeLoggedMinutes",labelKey:"columns.timeLoggedMinutes",icon:"Timer"},{type:"soldEffortMinutes",labelKey:"columns.soldEffortMinutes",icon:"FileText"},{type:"scheduleVariance",labelKey:"columns.scheduleVariance",icon:"CalendarClock"},{type:"hoursBar",labelKey:"columns.hoursBar",icon:"BarChart3"},{type:"teamLoad",labelKey:"columns.teamLoad",icon:"Users"},{type:"blockers",labelKey:"columns.blockers",icon:"AlertTriangle"},{type:"weight",labelKey:"columns.weight",icon:"Scale"}],N0=[{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 Pc={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#00E5CC",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#00E5CC",statusCompleted:"#34D399",focusRing:"#00E5CC",checkboxBg:"#1A1A1A",checkboxChecked:"#00E5CC",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},Fc={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#00E5CC"},Ac={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},hl={dark:Pc,light:Fc,neutral:Ac};function D0(e){return hl[e]||hl.dark}var Lc={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Ic={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},yl={en:Lc,es:Ic};function Xs(e){return yl[e]||yl.en}function xl(e,t){let a=Xs(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 S0(e){let t=Xs(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 E0(e,t=0,a=true){let r=Xs(e),n=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 [...n.slice(t),...n.slice(0,t)]}function Qs(e){let t=[];function a(r){for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);}return a(e),t}function Rc(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()),n=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=n}function F0({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsx(Circle,{className:c("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var I0=26,Pw=22,Fw=10;function A0(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function Oc(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let n=Math.round(e/60*a);return n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function B0(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let n=r<0,s;if(t==="financial"&&a>0){let o=Math.round(Math.abs(r/60)*a);s=o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`;}else {let o=Math.round(Math.abs(r)/60);s=o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`;}return {text:`${n?"-":"+"}${s}`,isNegative:n}}function L0(e,t="hours",a=0){if(t==="financial"&&a>0){let n=Math.round(Math.abs(e/60)*a);return n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function Aw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:n,t:s,lens:o="hours",hourlyRate:l=0}){let{task:d,spanCols:i,lane:u,isStart:m,isEnd:p}=e,g=d.progress===100||d.status==="completed",f=d.isCriticalPath,v=m&&p?"rounded":m?"rounded-l":p?"rounded-r":"",y=p?Oc(d.effortMinutes,o,l):null,b=p?B0(d,o,l):null,h=p?d.blockers?.find(x=>x.severity==="critical"):null;return jsxs(motion.button,{onClick:x=>{x.stopPropagation(),a();},whileHover:{scale:1.005},className:c("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",v,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":f?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-[#00E5CC]"),style:{top:`${u*I0}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${Pw}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:f?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:m?"3px":void 0,borderLeftColor:m?f?"#EF4444":g?"#10B981":"#1264FF":void 0,...n?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(0, 229, 204, 0.7), 0 0 12px rgba(0, 229, 204, 0.2)",zIndex:20}:{}},children:[f&&m&&jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsx("span",{className:"truncate flex-1 text-left font-medium",children:d.name}),p&&(y||b)&&jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[y&&jsxs("span",{children:[s.labels.estimate,": ",y]}),b&&jsxs(Fragment,{children:[jsx("span",{className:"text-white/15",children:"|"}),jsx("span",{className:c(b.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:b.text})]})]}),h&&jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",h.type]}),d.progress>0&&d.progress<100&&jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${d.progress}%`}})]})}function R0({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:n=false,error:s,className:o,style:l,availableTags:d=[],onCreateTag:i,attachmentsByTask:u,comments:m,onAddComment:p,currentUser:g,mentionableUsers:f,onUploadCommentAttachments:v,onTaskOpen:y,enableTimeTracking:b,timeTrackingSummary:h,timeEntries:x,timerState:w,onLogTime:N,onUpdateEstimate:D,onUpdateSoldEffort:A,onStartTimer:T,onStopTimer:E,onDiscardTimer:P,blurFinancials:k=false,suppressDetailModal:K=false,lens:H="hours",hourlyRate:ee=0}){let{theme:I="dark",locale:Y="en",customTranslations:q,showBacklog:V=true}=t,B=xl(Y,q),X$1=I==="dark"||I==="neutral",[Te,He]=useState(r||new Date),[z,te]=useState(null),[xe,je]=useState(null),[Ne,ze]=useState(null),[Me,at]=useState({}),be=3,pt=3,Ke=useCallback(O=>{je(O.id),K||te(O),y?.(O.id);},[K,y]),[Ue,kt]=useState(null),Ht=useCallback(()=>{He(new Date(Te.getFullYear(),Te.getMonth()-1,1));},[Te]),qe=useCallback(()=>{He(new Date(Te.getFullYear(),Te.getMonth()+1,1));},[Te]),We=useCallback(()=>{He(new Date);},[]),ot=useMemo(()=>{let O=Te.getFullYear(),Z=Te.getMonth(),Ve=new Date(O,Z,1),ke=new Date(O,Z+1,0),Re=Ve.getDay(),Ae=ke.getDate(),Pe=Qs(e),ct=new Date;ct.setHours(0,0,0,0);let Qe=[],st=Re,mt=new Date(O,Z,0).getDate();for(let St=st-1;St>=0;St--){let Ut=new Date(O,Z-1,mt-St);Qe.push({date:Ut,isCurrentMonth:false,isToday:false,isWeekend:Ut.getDay()===0||Ut.getDay()===6,events:Pe.filter(gt=>Rc(Ut,gt)).map(gt=>({id:gt.id,title:gt.name,start:gt.startDate,end:gt.endDate,task:gt}))});}for(let St=1;St<=Ae;St++){let Ut=new Date(O,Z,St),gt=Ut.getTime()===ct.getTime();Qe.push({date:Ut,isCurrentMonth:true,isToday:gt,isWeekend:Ut.getDay()===0||Ut.getDay()===6,events:Pe.filter(Mt=>Rc(Ut,Mt)).map(Mt=>({id:Mt.id,title:Mt.name,start:Mt.startDate,end:Mt.endDate,task:Mt}))});}let jt=42-Qe.length;for(let St=1;St<=jt;St++){let Ut=new Date(O,Z+1,St);Qe.push({date:Ut,isCurrentMonth:false,isToday:false,isWeekend:Ut.getDay()===0||Ut.getDay()===6,events:Pe.filter(gt=>Rc(Ut,gt)).map(gt=>({id:gt.id,title:gt.name,start:gt.startDate,end:gt.endDate,task:gt}))});}return Qe},[Te,e]),zt=useMemo(()=>Qs(e).filter(O=>!O.startDate||!O.endDate),[e]),Ee=useMemo(()=>{let O=Qs(e),Z=0,Ve=0,ke=0,Re=0,Ae=0;O.forEach(mt=>{mt.effortMinutes&&(Z+=mt.effortMinutes),mt.soldEffortMinutes&&(Ve+=mt.soldEffortMinutes),mt.scheduleVariance!=null&&(ke+=mt.scheduleVariance,Re++),mt.soldEffortMinutes&&mt.effortMinutes&&(Ae+=mt.soldEffortMinutes-mt.effortMinutes);});let Pe=Ve>0?Math.min(100,Math.round(Z/Ve*100)):0,ct=Re>0?Math.round(ke/Re):0,st=`${Ae<0?"-":"+"}${L0(Ae,H,ee)}`;return {budgetUtil:Pe,avgVariance:ct,costDisplay:st,hasCostData:Ve>0}},[e,H,ee]),nt=useMemo(()=>{let O=[0,0,0,0,0,0];return ot.forEach((Z,Ve)=>{let ke=Math.floor(Ve/7);Z.events.forEach(Re=>{if(Re.task.startDate&&Re.task.soldEffortMinutes){let Ae=new Date(Re.task.startDate),Pe=Z.date;Ae.getFullYear()===Pe.getFullYear()&&Ae.getMonth()===Pe.getMonth()&&Ae.getDate()===Pe.getDate()&&ke<O.length&&(O[ke]-=Re.task.soldEffortMinutes);}});}),O},[ot]),F=useMemo(()=>{let O=Qs(e),Z=new Map,Ve=new Set,ke=[0,0,0,0,0,0];if(ot.length===0)return {segmentsByCell:Z,multiDayTaskIds:Ve,maxLanesPerRow:ke};let Re=st=>new Date(st.getFullYear(),st.getMonth(),st.getDate()),Ae=Re(ot[0].date),Pe=Re(ot[ot.length-1].date),ct=[];for(let st of O){if(!st.startDate||!st.endDate)continue;let mt=Re(st.startDate),jt=Re(st.endDate);if(mt.getTime()===jt.getTime()||jt<Ae||mt>Pe)continue;let St=mt<Ae?Ae:mt,Ut=jt>Pe?Pe:jt,gt=A0(St,Ae),Mt=A0(Ut,Ae);gt<0||gt>41||Mt<0||Mt>41||gt!==Mt&&(Ve.add(st.id),ct.push({task:st,startIdx:gt,endIdx:Mt}));}ct.sort((st,mt)=>st.startIdx!==mt.startIdx?st.startIdx-mt.startIdx:mt.endIdx-mt.startIdx-(st.endIdx-st.startIdx));let Qe=[[],[],[],[],[],[]];for(let{task:st,startIdx:mt,endIdx:jt}of ct){let St=Math.floor(mt/7),Ut=Math.floor(jt/7),gt=Re(st.startDate),Mt=Re(st.endDate),Bt=false;for(let _t=St;_t<=Ut;_t++){let Wt=_t===St?mt%7:0,rt=_t===Ut?jt%7:6,da=rt-Wt+1,ha=0,W=Qe[_t]??[];for(Qe[_t]||(Qe[_t]=W);ha<W.length&&(W[ha]??-1)>=Wt;)ha++;if(ha>=Fw){Bt=true;break}ha>=W.length?W.push(rt):W[ha]=rt,ke[_t]=Math.max(ke[_t]??0,ha+1);let ne=_t===St&&gt>=Ae,ft=_t===Ut&&Mt<=Pe,Tt=_t*7+Wt,pa={taskId:st.id,task:st,rowIndex:_t,startCol:Wt,endCol:rt,spanCols:da,lane:ha,isStart:ne,isEnd:ft};Z.has(Tt)||Z.set(Tt,[]),Z.get(Tt).push(pa);}Bt&&(Ve.delete(st.id),Z.forEach((_t,Wt)=>{let rt=_t.filter(da=>da.taskId!==st.id);rt.length===0?Z.delete(Wt):Z.set(Wt,rt);}));}return {segmentsByCell:Z,multiDayTaskIds:Ve,maxLanesPerRow:ke}},[ot,e]),le=Y==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],R=Te.toLocaleDateString(Y==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),J=R.charAt(0).toUpperCase()+R.slice(1);return n?jsx("div",{className:c("flex-1 flex items-center justify-center",X$1?"bg-[#050505]":"bg-white",o),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#007FFF]"}),jsxs("p",{className:c("text-sm font-mono",X$1?"text-white/30":"text-gray-600"),children:[B.labels.noEvents,"..."]})]})}):s?jsx("div",{className:c("flex-1 flex items-center justify-center",X$1?"bg-[#050505]":"bg-white",o),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:c("w-12 h-12 rounded-full flex items-center justify-center",X$1?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:c("text-lg font-semibold mb-2",X$1?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:c("text-sm",X$1?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:c("flex-1 flex items-center justify-center",X$1?"bg-[#050505]":"bg-white",o),style:l,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:c("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",X$1?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-[#00E5CC]/10"),children:jsx(Calendar,{className:c("w-8 h-8",X$1?"text-[#007FFF]":"text-[#00E5CC]")})}),jsx("h3",{className:c("text-lg font-semibold mb-2",X$1?"text-white/90":"text-gray-900"),children:B.labels.noEvents}),jsx("p",{className:c("text-sm",X$1?"text-white/30":"text-gray-600"),children:B.labels.newTask})]})}):jsxs("div",{className:c("flex-1 flex flex-col w-full h-full overflow-hidden",X$1?"bg-[#050505]":"bg-white",o),style:l,children:[jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxs("div",{className:c("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",X$1?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxs("div",{className:c("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",X$1?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsx(Calendar,{className:c("w-3.5 h-3.5",X$1?"text-[#007FFF]":"text-[#00E5CC]")}),jsx("span",{className:c("font-medium",X$1?"text-white":"text-gray-900"),children:Y==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:c("h-4 w-px",X$1?"bg-white/10":"bg-gray-200")}),jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsx("button",{onClick:Ht,className:c("w-6 h-6 flex items-center justify-center rounded transition-colors",X$1?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("span",{className:c("text-sm font-semibold tracking-tight min-w-[150px] text-center",X$1?"text-white":"text-gray-900"),children:J}),jsx("button",{onClick:qe,className:c("w-6 h-6 flex items-center justify-center rounded transition-colors",X$1?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxs(Fragment,{children:[t.toolbarRightContent,jsx("div",{className:c("h-4 w-px",X$1?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:We,className:c("px-2.5 py-1 text-xs rounded-md transition-all font-medium",X$1?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:B.navigation.today})]})]}),jsx("div",{className:c("grid grid-cols-7 sticky top-0 z-10",X$1?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:le.map(O=>jsx("div",{className:c("py-2 text-center text-[10px] font-bold uppercase tracking-widest",X$1?"text-white/60 font-mono":"text-gray-500"),children:O},O))}),jsx("div",{className:"flex-1 overflow-y-auto",children:jsx("div",{className:c("grid grid-cols-7 min-h-[800px]",X$1?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>je(null),children:ot.map((O,Z)=>{let Ve=Z%7===6,ke=Z>=35;return jsxs("div",{className:c("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Ve&&(X$1?"border-r border-[#222]":"border-r border-gray-200"),!ke&&(X$1?"border-b border-[#222]":"border-b border-gray-200"),X$1?O.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":O.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",O.isToday&&X$1&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",O.isToday&&!X$1&&"ring-2 ring-[#00E5CC] ring-inset"),children:[jsx("span",{className:c("text-xs font-mono select-none relative z-20",O.isToday?X$1?"text-[#007FFF] font-bold":"text-[#00C4AE] font-bold":O.isCurrentMonth?X$1?"text-white/60":"text-gray-900":X$1?"text-white/20":"text-gray-400"),children:String(O.date.getDate()).padStart(2,"0")}),(()=>{let Re=Math.floor(Z/7),Ae=(F.maxLanesPerRow[Re]??0)*I0,Pe=F.segmentsByCell.get(Z);return Ae===0&&!Pe?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Ae}px`,zIndex:5},children:Pe?.map(ct=>jsx(Aw,{segment:ct,isDark:X$1,blurFinancials:k,isSelected:xe===ct.taskId,t:B,lens:H,hourlyRate:ee,onClick:()=>{Ke(ct.task),a.onEventClick?.({id:ct.task.id,title:ct.task.name,start:ct.task.startDate,end:ct.task.endDate,task:ct.task});}},ct.taskId))})})(),(()=>{let Re=O.events.filter(Ae=>Ae.task.isMilestone&&!F.multiDayTaskIds.has(Ae.id));return Re.length===0?null:jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[Re.slice(0,4).map(Ae=>jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Ae.title,onClick:Pe=>{Pe.stopPropagation(),Ke(Ae.task);}},Ae.id)),Re.length>4&&jsxs("span",{className:c("text-[8px] font-mono",X$1?"text-white/30":"text-gray-400"),children:["+",Re.length-4]})]})})(),(()=>{let Re=[];O.events.forEach(Pe=>{Pe.task.blockers?.forEach(ct=>{(ct.severity==="warning"||ct.severity==="critical")&&Re.push({taskId:Pe.id,type:ct.type,severity:ct.severity,variance:Pe.task.scheduleVariance});});});let Ae=Re[0];return Ae?jsx("div",{className:"mt-0.5 px-0.5",children:jsxs("div",{className:c("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Ae.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsx("span",{children:"\u26A0"}),jsxs("span",{className:"truncate",children:[B.labels.risk,": ",Ae.type,Ae.variance?` (+${Math.abs(Ae.variance)}d ${B.labels.delay})`:""]})]})}):null})(),(()=>{let Re=O.events.filter(Qe=>!F.multiDayTaskIds.has(Qe.id)),Ae=Me[Z]||be,Pe=Re.slice(0,Ae),ct=Re.length-Ae;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Pe.map(Qe=>jsxs(motion.button,{onClick:()=>{Ke(Qe.task),a.onEventClick?.(Qe);},whileHover:{scale:1.01},className:c("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",Qe.task.progress===100||Qe.task.status==="completed"?X$1?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":X$1?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-[#00E5CC]"),style:X$1?Qe.task.progress===100||Qe.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:Qe.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsx("span",{className:c("flex-shrink-0 text-[9px]",Qe.task.isMilestone?X$1?"text-amber-400":"text-amber-600":Qe.task.isCriticalPath?"text-red-400":X$1?"text-[#1264FF]":"text-gray-400"),children:Qe.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:Qe.title})]},Qe.id)),ct>0&&jsxs("button",{onClick:Qe=>{Qe.stopPropagation(),at(st=>({...st,[Z]:Ae+pt}));},className:c("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",X$1?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",ct," ",Y==="es"?"m\xE1s":"more"]}),Ae>be&&Re.length>be&&jsx("button",{onClick:Qe=>{Qe.stopPropagation(),at(st=>({...st,[Z]:be}));},className:c("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",X$1?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:Y==="es"?"menos":"less"})]})})(),O.isCurrentMonth&&a.onTaskCreate&&jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let Re=Z>=28,Ae=Z%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:Pe=>{Pe.stopPropagation(),kt(Ue===Z?null:Z);},className:c("w-5 h-5 rounded flex items-center justify-center transition-all",Ue===Z?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",X$1?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-[#00E5CC] text-gray-400 hover:text-white"),children:jsx(Plus,{className:c("w-3.5 h-3.5 transition-transform",Ue===Z&&"rotate-45")})}),jsx(AnimatePresence,{children:Ue===Z&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>kt(null)}),jsx(motion.div,{initial:{opacity:0,y:Re?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Re?-5:5,scale:.95},transition:{duration:.12},className:c("absolute w-[320px] rounded-lg shadow-2xl z-50",Re?"bottom-full mb-1":"top-full mt-1",Ae?"right-0":"left-0",X$1?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(bn,{onSubmit:Pe=>{a.onTaskCreate?.({name:Pe.name,startDate:Pe.startDate||O.date,endDate:Pe.endDate||O.date,priority:Pe.priority,assignees:Pe.assignee?[Pe.assignee]:void 0}),kt(null);},onCancel:()=>kt(null),availableUsers:t.availableUsers,isDark:X$1,locale:Y==="es"?"es":"en",defaultDate:O.date,dropdownDirection:Re?"up":"down"})})]})})]})})()}),Z%7===6&&(()=>{let Re=Math.floor(Z/7),Ae=nt[Re];if(!Ae||Ae===0)return null;let Pe=L0(Ae,H,ee);return jsxs("div",{className:c("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Ae<0?"text-red-400":"text-emerald-400",k&&"blur-sm select-none"),children:[B.labels.cashOut,": ",Ae<0?"-":"+",Pe]})})()]},Z)})})})]}),V&&jsxs("aside",{className:c("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",X$1?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxs("div",{className:c("flex-shrink-0 h-14 flex items-center justify-between px-4",X$1?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsx("span",{className:c("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",X$1?"text-white/40":"text-gray-500"),children:B.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:c("text-[10px] font-mono tabular-nums",X$1?"text-white/20":"text-gray-400"),children:zt.length})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:zt.length===0?jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:c("w-10 h-10 rounded-xl flex items-center justify-center mb-3",X$1?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:c("w-5 h-5",X$1?"text-white/20":"text-gray-400")})}),jsx("p",{className:c("text-xs font-mono",X$1?"text-white/20":"text-gray-400"),children:Y==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):zt.map(O=>jsxs("button",{onClick:()=>{Ke(O);},className:c("w-full text-left rounded-md p-3 transition-all group/card",X$1?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsx("div",{className:c("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",X$1?"bg-white/20":"bg-gray-300")}),jsx("span",{className:c("text-sm font-medium leading-snug line-clamp-2",X$1?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:O.name})]}),O.tags&&O.tags.length>0&&jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[O.tags.slice(0,3).map(Z=>jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${Z.color}15`,color:Z.color,border:`1px solid ${Z.color}30`},children:Z.name},Z.id)),O.tags.length>3&&jsxs("span",{className:c("text-[9px] font-mono px-1 py-0.5",X$1?"text-white/20":"text-gray-400"),children:["+",O.tags.length-3]})]}),(O.effortMinutes||O.soldEffortMinutes)&&jsxs("div",{className:c("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",X$1?"text-white/25":"text-gray-400",k&&"blur-sm select-none"),children:[Oc(O.effortMinutes,H,ee)&&jsxs("span",{children:[B.labels.estimate,": ",Oc(O.effortMinutes,H,ee)]}),(()=>{let Z=B0(O,H,ee);return Z?jsx("span",{className:Z.isNegative?"text-red-400":"text-emerald-400",children:Z.text}):null})()]}),jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[O.priority&&jsx(Flag,{className:c("w-3 h-3",O.priority==="urgent"||O.priority==="high"?"text-red-400":O.priority==="medium"?"text-yellow-400":"text-green-400")}),jsx(F0,{task:O,isDark:X$1})]}),O.assignees&&O.assignees.length>0&&jsx("div",{className:"flex -space-x-1",children:O.assignees.slice(0,2).map((Z,Ve)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:Z.color||"#007FFF"},title:Z.name,children:Z.initials||Z.name?.slice(0,2).toUpperCase()},Ve))})]})]},O.id))}),a.onTaskCreate&&jsx("div",{className:c("flex-shrink-0 px-3 py-2.5 border-t",X$1?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsx("input",{type:"text",placeholder:B.labels.typeToAdd,className:c("w-full text-[11px] font-mono bg-transparent outline-none",X$1?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:O=>{O.key==="Enter"&&O.target.value.trim()&&(a.onTaskCreate?.({name:O.target.value.trim()}),O.target.value="");}})}),Ee.hasCostData&&jsxs("div",{className:c("flex-shrink-0 px-4 py-3 border-t space-y-2.5",X$1?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:c("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",X$1?"text-white/40":"text-gray-500"),children:["\u25C8 ",B.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:c("text-[10px] font-mono",X$1?"text-white/40":"text-gray-500"),children:B.labels.budgetUtil}),jsxs("span",{className:c("text-[10px] font-mono font-bold tabular-nums",X$1?"text-white/60":"text-gray-700",k&&"blur-sm select-none"),children:[Ee.budgetUtil,"%"]})]}),jsx("div",{className:c("h-1.5 rounded-full overflow-hidden",X$1?"bg-white/5":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Ee.budgetUtil}%`,background:Ee.budgetUtil>90?"#EF4444":Ee.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #00E5CC, #8B5CF6)"}})})]}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("div",{className:c("rounded-md px-2 py-1.5 text-center",X$1?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:c("text-[8px] font-mono uppercase tracking-wider mb-0.5",X$1?"text-white/25":"text-gray-400"),children:B.labels.variance}),jsxs("div",{className:c("text-[11px] font-mono font-bold tabular-nums",Ee.avgVariance>0?"text-emerald-400":Ee.avgVariance<0?"text-red-400":X$1?"text-white/50":"text-gray-600"),children:[Ee.avgVariance>0?"+":"",Ee.avgVariance," ",B.labels.days]})]}),jsxs("div",{className:c("rounded-md px-2 py-1.5 text-center",X$1?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:c("text-[8px] font-mono uppercase tracking-wider mb-0.5",X$1?"text-white/25":"text-gray-400"),children:B.labels.cost}),jsx("div",{className:c("text-[11px] font-mono font-bold tabular-nums",Ee.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",k&&"blur-sm select-none"),children:Ee.costDisplay})]})]})]})]})]}),!K&&jsx(Mo,{task:z,isOpen:!!z,onClose:()=>te(null),onTaskUpdate:O=>{a.onTaskUpdate?.(O),te(O);},theme:I==="dark"?"dark":"light",locale:Y,availableUsers:t.availableUsers?.map(O=>({id:O.id,name:O.name,avatar:O.avatar,initials:O.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:d,onCreateTag:i,attachments:z?u?.get(z.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:Qs(e).filter(O=>O.id!==z?.id),comments:m?.filter(O=>O.taskId===z?.id).map(O=>({...O,createdAt:O.createdAt instanceof Date?O.createdAt:new Date(O.createdAt),updatedAt:O.updatedAt instanceof Date?O.updatedAt:O.updatedAt?new Date(O.updatedAt):void 0})),onAddComment:p,currentUser:g,mentionableUsers:f,onUploadCommentAttachments:v,enableTimeTracking:b,timeTrackingSummary:h,timeEntries:x,isTimerRunning:w?.isRunning,timerElapsedSeconds:w?.elapsedSeconds,onTimeLog:N,onEstimateUpdate:D,onSoldEffortUpdate:A,onTimerStart:T,onTimerStop:E,onTimerDiscard:P,blurFinancials:k}),jsx(AnimatePresence,{children:Ne&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>ze(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:c("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",X$1?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxs("div",{className:c("px-4 py-3 border-b flex items-center justify-between",X$1?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsx("span",{className:c("font-medium text-sm",X$1?"text-white/90":"text-gray-900"),children:Ne.date.toLocaleDateString(Y==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>ze(null),className:c("p-1 rounded",X$1?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}),jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-1.5",children:Ne.events.map(O=>jsxs("button",{onClick:()=>{ze(null),Ke(O.task);},className:c("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",X$1?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsx(F0,{task:O.task,isDark:X$1}),jsx("span",{className:c("text-sm truncate flex-1",X$1?"text-white/80":"text-gray-900"),children:O.title}),(O.task.priority==="high"||O.task.priority==="urgent")&&jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"})]},O.id))})]})]})})]})}var $c={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 229, 204, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 229, 204, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 229, 204, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},Hc={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 229, 204, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},zc={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},kl={dark:$c,light:Hc,neutral:zc};function O0(e){return kl[e]||kl.dark}function Iw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:l}){let[d,i]=useState(false),u=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),m=useMemo(()=>{let g=u.length,f=new Set(u.flatMap(b=>b.assignedUserIds||[])).size,v=u.map(b=>b.priority).filter(Boolean),y=new Set(u.flatMap(b=>b.labels||[])).size;return {totalCards:g,uniqueAssignees:f,priorities:v,labels:y}},[u]),p=()=>{n?.(e.id);};return jsxs("div",{className:c("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:c("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:m.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),d&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),o?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[m.uniqueAssignees," assignees"]})]}),m.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[m.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:u.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:u.map(g=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsx("h4",{children:g.title}),g.description&&jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,g.id);},"aria-label":"Remove from stack",children:jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},g.id))})})]})}var H0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function ei(e){switch(e.type){case "created":return "Created card";case "status_changed":return `Changed status from "${e.changes.status?.from}" to "${e.changes.status?.to}"`;case "assignee_changed":return "Changed assignee";case "priority_changed":return `Changed priority from ${e.changes.priority?.from} to ${e.changes.priority?.to}`;case "moved":return `Moved from ${e.metadata?.fromColumn||"unknown"} to ${e.metadata?.toColumn||"unknown"}`;case "title_updated":return "Updated title";case "description_updated":return "Updated description";case "dates_changed":return "Changed dates";case "labels_changed":return "Updated labels";case "dependency_added":return "Added dependency";case "dependency_removed":return "Removed dependency";case "comment_added":return "Added comment";case "archived":return "Archived card";case "restored":return "Restored card";default:return "Updated card"}}function ti(e){return {created:"\u2728",status_changed:"\u{1F504}",assignee_changed:"\u{1F464}",priority_changed:"\u{1F3AF}",moved:"\u27A1\uFE0F",title_updated:"\u270F\uFE0F",description_updated:"\u{1F4DD}",dates_changed:"\u{1F4C5}",labels_changed:"\u{1F3F7}\uFE0F",dependency_added:"\u{1F517}",dependency_removed:"\u26D3\uFE0F\u200D\u{1F4A5}",comment_added:"\u{1F4AC}",archived:"\u{1F4E6}",restored:"\u267B\uFE0F"}[e]||"\u{1F4CC}"}function z0(e){return {created:"#10b981",status_changed:"#00E5CC",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#00E5CC",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#00E5CC",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function U0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:n,selectedEventId:s,config:o,className:l}){let d=useMemo(()=>({...H0,...o}),[o]),[i,u]=useState(new Set),m=useRef(null),p=useMemo(()=>{if(!d.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(x=>{let w=x.timestamp.toISOString().split("T")[0],N=h.get(w);N?N.push(x):h.set(w,[x]);}),Array.from(h.entries()).sort((x,w)=>w[0].localeCompare(x[0])).map(([x,w])=>({date:new Date(x),events:w.sort((N,D)=>D.timestamp.getTime()-N.timestamp.getTime())}))},[e,d.groupByDay]),{uniqueUsers:g,uniqueTypes:f}=useMemo(()=>{let h=new Set,x=new Set;return e.forEach(w=>{h.add(w.userId),x.add(w.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(x)}},[e]),v=h=>{u(x=>{let w=new Set(x);return w.has(h)?w.delete(h):w.add(h),w});},y=h=>{let w=new Date().getTime()-h.getTime(),N=Math.floor(w/6e4),D=Math.floor(w/36e5),A=Math.floor(w/864e5);return N<1?"just now":N<60?`${N}m ago`:D<24?`${D}h ago`:A<7?`${A}d ago`:h.toLocaleDateString()},b=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&&m.current){let h=m.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:c("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:c("history-timeline",d.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 x=h.target.value;a({...t,types:x?[x]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),f.map(h=>jsxs("option",{value:h,children:[ti(h)," ",h.replace("_"," ")]},h))]}),g.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let x=h.target.value;a({...t,users:x?[x]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),g.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})})]}),b>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",b,")"]})]}),jsx("div",{className:"history-timeline-container",ref:m,children:p.map(h=>jsxs("div",{className:"history-timeline-group",children:[d.groupByDay&&h.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:h.events.map((x,w)=>{let N=i.has(x.id),D=s===x.id,A=z0(x.type);return jsxs("div",{"data-event-id":x.id,className:c("history-timeline-event",N&&"expanded",D&&"selected"),onClick:()=>n?.(x),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:A},children:d.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:ti(x.type)})}),w<h.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:A}})]}),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:[d.showAvatars&&x.userAvatar&&jsx("img",{src:x.userAvatar,alt:x.userName||x.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:x.userName||x.userId}),jsx("span",{className:"history-timeline-event-action",children:ei(x)})]})]}),jsx("div",{className:"history-timeline-event-time",children:d.useRelativeTime?y(x.timestamp):x.timestamp.toLocaleString()})]}),Object.keys(x.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),v(x.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(x.changes).map(([T,E])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(E.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(E.to)})]})]},T)),x.metadata&&Object.keys(x.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(x.metadata).map(([T,E])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(E)})]},T))]})]})]})]},x.id)})})]},h.date?.toISOString()||"all"))})]})}function V0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:l,onSpeedChange:d,className:i}){let u=[.5,1,1.5,2,3],m=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:c("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:c("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:m&&ti(m.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:m&&ei(m)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:m&&m.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:g=>l(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,f)=>jsx("div",{className:c("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>l(f),title:ei(g)},g.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:n,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:o,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:u.map(g=>jsxs("button",{className:c("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>d(g),children:[g,"x"]},g))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:m&&m.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(g=>jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxs("div",{className:c("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 Uc(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#00E5CC",child_of:"#00C4AE",similar_to:"#10b981"}[e]||"#6b7280"}function Wc(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 G0(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 j0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function zw(e,t,a,r,n,s=100){let o=e.map(d=>({...d,x:d.x??a/2+Math.random()*100-50,y:d.y??r/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(o.map(d=>[d.id,d]));for(let d=0;d<s;d++){let i=1-d/s;o.forEach(u=>{let m=a/2,p=r/2;u.vx+=(m-u.x)*n.centerForce*i,u.vy+=(p-u.y)*n.centerForce*i,o.forEach(g=>{if(u.id===g.id)return;let f=u.x-g.x,v=u.y-g.y,y=Math.sqrt(f*f+v*v)||1,b=n.chargeStrength*i/(y*y);u.vx+=f/y*b,u.vy+=v/y*b;});}),t.forEach(u=>{let m=l.get(typeof u.source=="string"?u.source:u.source.id),p=l.get(typeof u.target=="string"?u.target:u.target.id);if(!m||!p)return;let g=p.x-m.x,f=p.y-m.y,v=Math.sqrt(g*g+f*f)||1,y=(v-n.linkDistance)/v*n.forceStrength*i;m.vx+=g*y,m.vy+=f*y,p.vx-=g*y,p.vy-=f*y;}),o.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(n.nodeSize,Math.min(a-n.nodeSize,u.x)),u.y=Math.max(n.nodeSize,Math.min(r-n.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return o}function _0({nodes:e,edges:t,config:a,filter:r,onFilterChange:n,criticalPath:s,stats:o,onInteraction:l,className:d}){let i=useRef(null),[u,m]=useState([]),[p,g]=useState(null),[f,v]=useState(null),[y,b]=useState(null),[h,x]=useState(1),[w,N]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let H=zw(e,t,a.width,a.height,a,150);m(H);},[e,t,a]);let D=useCallback((H,ee)=>{a.enableDragging&&(ee.stopPropagation(),g(H));},[a.enableDragging]),A=useCallback(H=>{if(!p||!i.current)return;let I=i.current.getBoundingClientRect(),Y=(H.clientX-I.left-w.x)/h,q=(H.clientY-I.top-w.y)/h;m(V=>V.map(B=>B.id===p?{...B,x:Y,y:q,fx:Y,fy:q}:B));},[p,h,w]),T=useCallback(()=>{g(null);},[]),E=useCallback((H,ee)=>{ee.stopPropagation(),l?.({type:"node-click",node:H,position:{x:ee.clientX,y:ee.clientY}});},[l]),P=useCallback((H,ee)=>{ee.stopPropagation(),l?.({type:"edge-click",edge:H,position:{x:ee.clientX,y:ee.clientY}});},[l]),k=useCallback(H=>{let ee=u.find(I=>I.id===H);return ee?{x:ee.x,y:ee.y}:{x:0,y:0}},[u]),K=useCallback(H=>{if(H.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return H.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let ee=H.card.priority;return ee==="URGENT"?"#ef4444":ee==="HIGH"?"#f59e0b":ee==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return H.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:c("relationships-graph-empty",d),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:c("relationships-graph",d),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:o.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:o.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x(H=>Math.min(H+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x(H=>Math.max(H-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{x(1),N({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(H=>H.type))).map(H=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Uc(H)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[G0(H)," ",Wc(H)]})]},H))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:A,onMouseUp:T,onMouseLeave:T,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${h})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(H=>{let ee=k(typeof H.source=="string"?H.source:H.source.id),I=k(typeof H.target=="string"?H.target:H.target.id),Y=j0(H.type),q=y===H.id,V=H.onCriticalPath;return jsxs("g",{className:c("relationships-graph-edge",q&&"hovered",V&&"critical"),onMouseEnter:()=>b(H.id),onMouseLeave:()=>b(null),onClick:B=>P(H,B),children:[jsx("line",{x1:ee.x,y1:ee.y,x2:I.x,y2:I.y,stroke:Uc(H.type),strokeWidth:V?a.edgeWidth*2:a.edgeWidth,strokeOpacity:q?1:.6,markerEnd:Y?"url(#arrowhead)":void 0}),a.showEdgeLabels&&q&&jsx("text",{x:(ee.x+I.x)/2,y:(ee.y+I.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Wc(H.type)})]},H.id)})}),jsx("g",{className:"relationships-graph-nodes",children:u.map(H=>{let ee=f===H.id,I=H.onCriticalPath;return jsxs("g",{className:c("relationships-graph-node",ee&&"hovered",I&&"critical"),transform:`translate(${H.x}, ${H.y})`,onMouseDown:Y=>D(H.id,Y),onMouseEnter:()=>v(H.id),onMouseLeave:()=>v(null),onClick:Y=>E(H,Y),children:[jsx("circle",{r:I?a.nodeSize*1.2:a.nodeSize,fill:K(H),stroke:I?"#fbbf24":"#ffffff",strokeWidth:I?3:2,opacity:ee?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:H.card.title.length>20?H.card.title.substring(0,20)+"...":H.card.title})]},H.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 Y0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:n}){let[s,o]=useState(""),[l,d]=useState(false),[i,u]=useState(null),[m,p]=useState(null),g=useRef(null),f=l||n;useEffect(()=>{e&&g.current&&g.current.focus();},[e]),useEffect(()=>{let h=x=>{x.key==="Escape"&&!f&&v();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,f]);let v=()=>{f||(o(""),u(null),p(null),t());},y=async()=>{if(!(!s.trim()||f)){d(true),u(null),p(null);try{let h=await r(s.trim());p(h);}catch(h){u(h instanceof Error?h.message:"Failed to generate plan");}finally{d(false);}}},b=()=>{m&&(a(m),v());};return e?jsxs(ra,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:v}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:v,disabled:f,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:m?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),m.explanation&&jsx("div",{className:"p-4 rounded-lg bg-[#00E5CC]/10 border border-[#00E5CC]/30",children:jsx("p",{className:"text-sm text-white/90",children:m.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",m.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:m.columns.map((h,x)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},x))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",m.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[m.cards.slice(0,10).map((h,x)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:h.priority})]})},x)),m.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",m.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:g,value:s,onChange:h=>o(h.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled:f}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),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,x)=>jsx("button",{onClick:()=>o(h),disabled:f,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},x))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:f&&jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:v,disabled:f,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),m?jsx("button",{onClick:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:y,disabled:!s.trim()||f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:f?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Vc={"gpt-4-turbo":{provider:"openai",name:"GPT-4 Turbo",contextWindow:128e3,costPer1kInput:.01,costPer1kOutput:.03,supportsVision:true,supportsJSON:true},"gpt-4":{provider:"openai",name:"GPT-4",contextWindow:8192,costPer1kInput:.03,costPer1kOutput:.06,supportsVision:false,supportsJSON:true},"gpt-3.5-turbo":{provider:"openai",name:"GPT-3.5 Turbo",contextWindow:16385,costPer1kInput:5e-4,costPer1kOutput:.0015,supportsVision:false,supportsJSON:true},"claude-3-5-sonnet-20241022":{provider:"anthropic",name:"Claude 3.5 Sonnet",contextWindow:2e5,costPer1kInput:.003,costPer1kOutput:.015,supportsVision:true,supportsJSON:true},"claude-3-opus-20240229":{provider:"anthropic",name:"Claude 3 Opus",contextWindow:2e5,costPer1kInput:.015,costPer1kOutput:.075,supportsVision:true,supportsJSON:true},"claude-3-haiku-20240307":{provider:"anthropic",name:"Claude 3 Haiku",contextWindow:2e5,costPer1kInput:25e-5,costPer1kOutput:.00125,supportsVision:true,supportsJSON:true}};var Ww={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Vw={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 Gw(e,t,a){let r=Vc[e];if(!r)throw new Error(`Unknown model: ${e}`);let n=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return n+s}function ai(e){return `$${e.toFixed(4)}`}var Gc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Gw(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(n=>n(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(m=>m.timestamp>=t.start&&m.timestamp<=t.end));let r=a.length,n=a.reduce((m,p)=>m+p.cost,0),s=a.reduce((m,p)=>m+p.inputTokens,0),o=a.reduce((m,p)=>m+p.outputTokens,0),l=a.filter(m=>m.success),d=a.reduce((m,p)=>m+p.duration,0),i={},u={};return a.forEach(m=>{i[m.feature]=(i[m.feature]||0)+1,u[m.feature]=(u[m.feature]||0)+m.cost;}),{totalOperations:r,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?d/r:0,successRate:r>0?l.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,o=new Date;a==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let l=this.operations.filter(u=>u.timestamp>=o).length,d=Math.max(0,n-l),i=l/n*100;return {used:l,limit:n,remaining:d,percentUsed:i,isExceeded:l>=n}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Sn=new Gc;function Q0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,n]=useState(Sn.getStats()),[s,o]=useState(Sn.checkLimit(a));if(useEffect(()=>{if(!e)return;let d=setInterval(()=>{n(Sn.getStats()),o(Sn.checkLimit(a));},1e3);return ()=>clearInterval(d)},[e,a]),useEffect(()=>{let d=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,t]),!e)return null;let l=Sn.getRecentOperations(5);return jsxs(ra,{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:d=>d.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ai(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-[#00E5CC] mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([d,i])=>{let u=r.costsByFeature[d]||0,m=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:d.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:ai(u)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${m}%`}})})]},d)})})]}),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(d=>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:d.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(d.timestamp).toLocaleTimeString()," \u2022"," ",d.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[d.inputTokens+d.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ai(d.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${d.success?"bg-green-400":"bg-red-400"}`})]})]},d.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 tf({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:n,projectName:s}){let[o,l]=useState(""),[d,i]=useState(""),[u,m]=useState(""),[p,g]=useState(false),[f,v]=useState(null),[y,b]=useState(null),[h,x]=useState(null),w=useRef(null),N=p||n;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let P=k=>{k.key==="Escape"&&!N&&D();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,N]);let D=()=>{N||(l(""),i(""),m(""),v(null),b(null),x(null),t());},A=async()=>{if(!(!o.trim()||N)){g(true),v(null),b(null),x(null);try{let P=await r({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:d||void 0,endDate:u||void 0});b(P.tasks.tasks),x({from_cache:P.from_cache,tokens_used:P.tokens_used,mock_mode:P.mock_mode,similarity:P.similarity,tokens_saved:P.tokens_saved});}catch(P){v(P instanceof Error?P.message:"Failed to generate tasks");}finally{g(false);}}},T=()=>{y&&(a(y),D());};if(!e)return null;let E=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxs(ra,{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:P=>P.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick: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:y?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-[#00E5CC]/20 text-[#00E5CC] border border-[#00E5CC]/30",children:["From Cache (",E,"% similar)"]}):jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[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:[y.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:y.map((P,k)=>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:["#",k+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:P.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),P.start," \u2192 ",P.end]}),jsxs("span",{children:[P.duration," days"]}),P.dependencies.length>0&&jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",P.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${P.priority==="high"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:P.priority})]})},P.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:w,value:o,onChange:P=>l(P.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled: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:d,onChange:P=>i(P.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled: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:u,onChange:P=>m(P.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled:N})]})]}),f&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:f}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((P,k)=>jsx("button",{onClick:()=>l(P),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:P},k))})]})]})}),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-[#00E5CC] text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick: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"}),y?jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:A,disabled:!o.trim()||N,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function Nl({initialBoard:e,onPersist:t}){let[a,r]=useState(e),n=useCallback(y=>{t&&mi(()=>Promise.resolve(t(y)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,h,x)=>{console.warn(`Retry attempt ${h} after ${x}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=useCallback(async(y,b,h)=>{r(x=>{let w=x.cards.find(P=>P.id===y);if(!w)return x;let N=w.columnId,D={...w,columnId:b,position:h},A=x.cards.map(P=>P.id===y?D:P),T=x.columns.map(P=>{if(P.id===N)return {...P,cardIds:P.cardIds.filter(k=>k!==y)};if(P.id===b){let k=A.filter(K=>K.columnId===b).sort((K,H)=>K.position-H.position);return {...P,cardIds:k.map(K=>K.id)}}return P}),E={...x,cards:A,columns:T};return n(E),E});},[n]),o=useCallback(async(y,b)=>{r(h=>{let x=h.cards.map(N=>N.id===y?{...N,...b}:N),w={...h,cards:x};return n(w),w});},[n]),l=useCallback(async y=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let x={...y,id:b},w=h.columns.map(D=>D.id===y.columnId?{...D,cardIds:[...D.cardIds,b]}:D),N={...h,cards:[...h.cards,x],columns:w};return n(N),N});},[n]),d=useCallback(async y=>{r(b=>{let h=b.cards.find(D=>D.id===y);if(!h)return b;let x=b.cards.filter(D=>D.id!==y),w=b.columns.map(D=>D.id===h.columnId?{...D,cardIds:D.cardIds.filter(A=>A!==y)}:D),N={...b,cards:x,columns:w};return n(N),N});},[n]),i=useCallback(async y=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let x={...y,id:b,cardIds:[]},w={...h,columns:[...h.columns,x]};return n(w),w});},[n]),u=useCallback(async(y,b)=>{r(h=>{let x=h.columns.map(N=>N.id===y?{...N,...b}:N),w={...h,columns:x};return n(w),w});},[n]),m=useCallback(async y=>{r(b=>{let h=b.cards.filter(N=>N.columnId!==y),x=b.columns.filter(N=>N.id!==y),w={...b,cards:h,columns:x};return n(w),w});},[n]),p=useCallback(y=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(y),b},[l]),g=useCallback(y=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(y),b},[i]),f=useCallback(()=>{r(y=>{let b={...y,cards:[],columns:[]};return n(b),b});},[n]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:l,onCardDelete:d,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:m},setBoard:r,helpers:{addCard:p,addColumn:g,deleteCard:d,deleteColumn:m,clearBoard:f}}}function rf({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:n,helpers:s}=Nl({initialBoard:e,onPersist:a}),o=useMemo(()=>({addCard:(d,i,u={})=>{s.addCard({title:i,columnId:d,position:r.cards.filter(m=>m.columnId===d).length,...u});},addColumn:(d,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(m=>m.position)):0;s.addColumn({title:d,position:i??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:n,availableUsers:t}),[r,n,t]),board:r,callbacks:n,utils:o}}var ri={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},nf={by:"none",order:"asc"};function sf({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,n]=useState({...ri,...e}),[s,o]=useState({...nf,...t}),l=useCallback(v=>{n(y=>({...y,...v}));},[]),d=useCallback(v=>{o(y=>({...y,...v}));},[]),i=useCallback(()=>{n(ri),o(nf);},[]),u=useCallback(()=>{a&&n({...ri,assignees:[a]});},[a]),m=useCallback(()=>{n({...ri,dateFilter:"overdue"});},[]),p=useCallback(()=>{n({...ri,priorities:["HIGH","URGENT"]});},[]),g=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),f=useCallback(v=>{let y=[...v];if(r.search){let b=r.search.toLowerCase();y=y.filter(h=>h.title.toLowerCase().includes(b)||h.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,h=b.getFullYear(),x=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),N=`${h}-${x}-${w}`;y=y.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let A=D.endDate||D.dueDate;if(!A)return false;let T;if(typeof A=="string")T=A.split("T")[0]||A;else {let E=A.getUTCFullYear(),P=String(A.getUTCMonth()+1).padStart(2,"0"),k=String(A.getUTCDate()).padStart(2,"0");T=`${E}-${P}-${k}`;}switch(r.dateFilter){case "overdue":return T<N;case "today":return T===N;case "this-week":let E=new Date(N+"T00:00:00"),P=new Date(T+"T00:00:00"),k=new Date(E);return k.setDate(k.getDate()+7),P>=E&&P<=k;case "custom":if(r.dateRange){let K=typeof A=="string"?new Date(A):A;return K>=r.dateRange.start&&K<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(y=y.filter(b=>b.priority&&r.priorities.includes(b.priority))),r.assignees.length>0&&(y=y.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(x=>r.assignees.includes(x)))),r.labels.length>0&&(y=y.filter(b=>b.labels&&b.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(y=y.filter(b=>r.columns.includes(b.columnId))),s.by!=="none"&&y.sort((b,h)=>{let x=0;switch(s.by){case "created":let w=b.createdAt?new Date(b.createdAt).getTime():0,N=h.createdAt?new Date(h.createdAt).getTime():0;x=w-N;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},A=D[b.priority||"LOW"],T=D[h.priority||"LOW"];x=A-T;break;case "dueDate":let E=b.endDate||b.dueDate,P=h.endDate||h.dueDate;if(!E)return 1;if(!P)return -1;let k=typeof E=="string"?new Date(E).getTime():E.getTime(),K=typeof P=="string"?new Date(P).getTime():P.getTime();x=k-K;break;case "title":x=b.title.localeCompare(h.title);break;case "estimate":let H=b.estimatedTime||0,ee=h.estimatedTime||0;x=H-ee;break;default:x=0;}return s.order==="asc"?x:-x}),y},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:d,resetFilters:i,filterMyTasks:u,filterOverdue:m,filterHighPriority:p,applyFilters:f,hasActiveFilters:g}}var df,cf;if(typeof window<"u")try{let e=ci("ai");df=e.generateObject,cf=e.generateText;}catch{}function uf(e={}){let[t,a]=useState(false),[r,n]=useState(null),s=!!(df&&cf&&e.apiKey),o=useCallback(async m=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),n(null);try{return console.log("Generating plan for:",m),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${m}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let g=p instanceof Error?p:new Error("Failed to generate plan");throw n(g),g}finally{a(false);}},[s]),l=useCallback(async m=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Suggesting assignee for:",m.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let g=p instanceof Error?p:new Error("Failed to suggest assignee");throw n(g),g}finally{a(false);}},[s]),d=useCallback(async m=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(p){let g=p instanceof Error?p:new Error("Failed to predict risks");throw n(g),g}finally{a(false);}},[s]),i=useCallback(async m=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Generating subtasks for:",m.title),[{title:`Subtask 1 for: ${m.title}`,position:m.position+.1,columnId:m.columnId},{title:`Subtask 2 for: ${m.title}`,position:m.position+.2,columnId:m.columnId}]}catch(p){let g=p instanceof Error?p:new Error("Failed to generate subtasks");throw n(g),g}finally{a(false);}},[s]),u=useCallback(async m=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Estimating effort for:",m.title),{hours:8,confidence:.75}}catch(p){let g=p instanceof Error?p:new Error("Failed to estimate effort");throw n(g),g}finally{a(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:l,onPredictRisks:d,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function _c(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(n=>{t(n);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function pf(e){let{cards:t}=e,[a,r]=_c(),n=useCallback(m=>a.selectedCardIds.includes(m),[a.selectedCardIds]),s=useCallback((m,p)=>{if(!p){r({selectedCardIds:[m],lastSelectedCardId:m});return}let g=p.ctrlKey||p.metaKey,f=p.shiftKey;if(g)a.selectedCardIds.includes(m)?r({selectedCardIds:a.selectedCardIds.filter(v=>v!==m),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,m],lastSelectedCardId:m});else if(f&&a.lastSelectedCardId){let v=t.find(b=>b.id===m),y=t.find(b=>b.id===a.lastSelectedCardId);if(v&&y&&v.columnId===y.columnId){let b=t.filter(T=>T.columnId===v.columnId).sort((T,E)=>T.position-E.position),h=b.findIndex(T=>T.id===a.lastSelectedCardId),x=b.findIndex(T=>T.id===m),[w,N]=h<x?[h,x]:[x,h],D=b.slice(w,N+1).map(T=>T.id),A=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:A,lastSelectedCardId:m});}else r({selectedCardIds:[m],lastSelectedCardId:m});}else r({selectedCardIds:[m],lastSelectedCardId:m});},[t,a,r]),o=useCallback(m=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==m),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),d=useCallback(()=>{r({selectedCardIds:t.map(m=>m.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(m=>{a.selectedCardIds.includes(m)?o(m):r({selectedCardIds:[...a.selectedCardIds,m],lastSelectedCardId:m});},[a,o,r]),u=useCallback(()=>t.filter(m=>a.selectedCardIds.includes(m.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:l,selectAll:d,toggleCard:i,getSelectedCards:u}}var mf={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function gf(e){let{cards:t,config:a,aiService:r}=e,n=useMemo(()=>({...mf,...a}),[a]),[s,o]=useState([]),l=useCallback((v,y,b,h,x)=>{if(y.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:v,cardIds:y,columnId:b,strategy:h,color:x,isExpanded:true,position:s.filter(N=>N.columnId===b).length,createdAt:new Date};o(N=>[...N,w]);},[n.minCardsPerStack,s]),d=useCallback(v=>{o(y=>y.filter(b=>b.id!==v));},[]),i=useCallback(v=>{o(y=>y.map(b=>b.id===v?{...b,isExpanded:!b.isExpanded}:b));},[]),u=useCallback((v,y)=>{o(b=>b.map(h=>h.id===v&&!h.cardIds.includes(y)?{...h,cardIds:[...h.cardIds,y]}:h));},[]),m=useCallback((v,y)=>{o(b=>b.map(h=>{if(h.id===v){let x=h.cardIds.filter(w=>w!==y);return x.length<n.minCardsPerStack?null:{...h,cardIds:x}}return h}).filter(h=>h!==null));},[n.minCardsPerStack]),p=useCallback(v=>s.filter(y=>y.columnId===v).sort((y,b)=>y.position-b.position),[s]),g=useCallback(async v=>{let y=t.filter(N=>N.columnId===v);if(y.length<n.minCardsPerStack*2)return [];let b=[],h=new Map;y.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>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:N.map(A=>A.id),columnId:v,strategy:"labels",color:"#00E5CC"},reason:`${N.length} cards with label "${D}"`,confidence:.85});});let x=new Map;y.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(D=>{x.has(D)||x.set(D,[]),x.get(D).push(N);});}),x.forEach((N,D)=>{N.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:N.map(A=>A.id),columnId:v,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(y.forEach(N=>{N.priority&&(w.has(N.priority)||w.set(N.priority,[]),w.get(N.priority).push(N));}),w.forEach((N,D)=>{if(N.length>=n.minCardsPerStack){let A={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";b.push({stack:{title:`${A} ${D} Priority`,cardIds:N.map(T=>T.id),columnId:v,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${D} priority`,confidence:.75});}}),r&&n.enableAutoStacking)for(let N of y){let A=(await r.findSimilar(N,y)).filter(T=>T.similarity>=n.autoStackConfidenceThreshold);if(A.length>=n.minCardsPerStack-1){let T=[N.id,...A.map(P=>P.card.id)],E=A.reduce((P,k)=>P+k.similarity,0)/A.length;b.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:T,columnId:v,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${A.length+1} similar tasks`,confidence:E});}}return b.filter(N=>N.confidence>=n.autoStackConfidenceThreshold).sort((N,D)=>D.confidence-N.confidence).slice(0,5)},[t,n,r]),f=useCallback(v=>{l(v.stack.title,v.stack.cardIds,v.stack.columnId,v.stack.strategy,v.stack.color);},[l]);return useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(y=>y.columnId)).forEach(async y=>{let b=await g(y),h=b[0];b.length>0&&h&&h.confidence>=.9&&f(h);});},[]),{stacks:s,createStack:l,deleteStack:d,toggleStack:i,addToStack:u,removeFromStack:m,getStacksForColumn:p,getSuggestions:g,applySuggestion:f,config:n}}var ff=createContext(null);function bf({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,o=new Map;t?.columns?.forEach(d=>{let{Column:i}=ci("@libxai/core");s.set(d.id,new i(d));}),t?.cards?.forEach(d=>{let{Card:i}=ci("@libxai/core");o.set(d.id,new i(d));});let l=null;if(t?.board){let{Board:d}=ci("@libxai/core");l=new d(t.board);}r.current=new BoardStore({board:l,columns:s,cards:o});}let n=r.current;return useEffect(()=>{if(a)return n.subscribeAll(s=>{a(n.getState());})},[n,a]),jsx(ff.Provider,{value:{store:n},children:e})}function Dl(){let e=useContext(ff);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function ni(){let e=Dl(),[t,a]=useState(e.getBoard()),[r,n]=useState(e.getAllColumns()),[s,o]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let l=useCallback(h=>{e.updateBoard(h);},[e]),d=useCallback(h=>{e.addColumn(h);},[e]),i=useCallback((h,x)=>{e.updateColumn(h,x);},[e]),u=useCallback(h=>{e.deleteColumn(h);},[e]),m=useCallback(h=>e.getColumn(h),[e]),p=useCallback(h=>{e.addCard(h);},[e]),g=useCallback((h,x)=>{e.updateCard(h,x);},[e]),f=useCallback(h=>{e.deleteCard(h);},[e]),v=useCallback((h,x,w)=>{e.moveCard(h,x,w);},[e]),y=useCallback(h=>e.getCard(h),[e]),b=useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:d,updateColumn:i,deleteColumn:u,getColumn:m,addCard:p,updateCard:g,deleteCard:f,moveCard:v,getCard:y,getCardsByColumn:b}}function yf(e){let{cards:t}=ni();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),n=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!n&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>a.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>a.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function xf(e="position",t="asc"){let{cards:a}=ni();return useMemo(()=>[...a].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},d=n.priority?l[n.priority]:0,i=s.priority?l[s.priority]:0;o=d-i;break}case "createdAt":o=n.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":o=n.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":o=n.position-s.position;break}return t==="asc"?o:-o}),[a,e,t])}var Sl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Su.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let n=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let l=await Promise.resolve(o.apply(s,a));l!==void 0&&(n=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,a){let r=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(n,a)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(r);}},i5=new Sl;function wf({items:e,height:t,estimateSize:a,renderItem:r,className:n="",overscan:s=5,horizontal:o=false,gap:l=0,getItemKey:d}){let i=useRef(null),u=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:o,gap:l}),m=u.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=o?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:p,className:n,children:jsx("div",{style:g,children:m.map(f=>{let v=e[f.index];if(!v)return null;let y=d?d(v,f.index):f.index,b={position:"absolute",top:o?0:f.start,left:o?f.start:0,width:o?f.size:"100%",height:o?"100%":f.size};return jsx("div",{style:b,"data-index":f.index,children:r(v,f.index)},y)})})})}function kf(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 Tf({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:n,className:s="",overscan:o=3,gap:l=16,getItemKey:d,horizontal:i=true}){let u=useRef(null),m=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:o,gap:l}),p=m.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},f={width:`${m.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:u,style:g,className:s,children:jsx("div",{style:f,children:p.map(v=>{let y=e[v.index];if(!y)return null;let b=d?d(y,v.index):v.index,h={position:"absolute",top:0,left:v.start,width:v.size,height:"100%"};return jsx("div",{style:h,"data-index":v.index,children:n(y,v.index)},b)})})})}function Nf(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 Df(e,t=10){return e>t}var Xc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Jc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Qc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Zc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},eu={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},tu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},au={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},ru={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)"},ou={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)"},nu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},su={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}},iu={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}},El={spacing:Xc,borderRadius:Jc,fontSize:Qc,fontWeight:Zc,lineHeight:eu,zIndex:tu,duration:au,easing:ru,shadows:ou,opacity:nu,kanban:su,gantt:iu};function Sf(e,t,a){return e[t]??a}function lu(e,t="",a={}){for(let[r,n]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof n=="object"&&n!==null&&!Array.isArray(n)?lu(n,s,a):(typeof n=="string"||typeof n=="number")&&(a[s]=n);}return a}function c5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function du(e="asakaa"){let t=lu(El),a=[];for(let[r,n]of Object.entries(t)){let s=`--${e}-${r}`,o=c5(n);a.push(` ${s}: ${o};`);}return `:root {
414
- ${a.join(`
413
+ Today's date: ${new Date().toISOString().split("T")[0]}`}function ag(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function Hn(e,t){let r=ag(e),a=t.toLowerCase().trim(),n=r.find(c=>c.name.toLowerCase()===a);if(n)return n;let s=r.find(c=>c.name.toLowerCase().includes(a));if(s)return s;let o=a.split(/\s+/);return r.find(c=>{let l=c.name.toLowerCase();return o.every(i=>l.includes(i))})}function cd(e,t=new Date){let r=e.toLowerCase().trim(),a=new Date(t);if(a.setHours(0,0,0,0),r==="today"||r==="hoy")return a;if(r==="tomorrow"||r==="ma\xF1ana"){let p=new Date(a);return p.setDate(p.getDate()+1),p}if(r==="yesterday"||r==="ayer"){let p=new Date(a);return p.setDate(p.getDate()-1),p}if(r==="next week"||r==="la pr\xF3xima semana"){let p=new Date(a);return p.setDate(p.getDate()+7),p}let n=r.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(n){let m={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[n[1].toLowerCase()];if(m!==void 0){let f=new Date(a),x=f.getDay(),y=m-x;return y<=0&&(y+=7),f.setDate(f.getDate()+y),f}}let s=r.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let p=parseInt(s[1],10),m=s[2].toLowerCase(),f=new Date(a);return m==="day"||m==="d\xEDa"||m==="dias"?f.setDate(f.getDate()+p):m==="week"||m==="semana"||m==="semanas"?f.setDate(f.getDate()+p*7):(m==="month"||m==="mes"||m==="meses")&&f.setMonth(f.getMonth()+p),f}if(r.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(r);let c=r.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let p=parseInt(c[1],10),m=parseInt(c[2],10)-1,f=parseInt(c[3],10);return new Date(f,m,p)}let l={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=r.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(i&&i[1]&&i[2]){let p=parseInt(i[1],10),m=l[i[2].toLowerCase()],f=i[3]?parseInt(i[3],10):a.getFullYear();if(m!==void 0)return new Date(f,m,p)}let d={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},u=r.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(u&&u[1]&&u[2]){let p=d[u[1].toLowerCase()],m=parseInt(u[2],10),f=u[3]?parseInt(u[3],10):a.getFullYear();if(p!==void 0)return new Date(f,p,m)}return null}function dd(e){let r=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(r&&r[1]&&r[2]){let a=parseInt(r[1],10),n=r[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return a;if(n==="week"||n==="semana"||n==="semanas")return a*7;if(n==="month"||n==="mes"||n==="meses")return a*30}return null}function ud(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let r=parseInt(t[1],10);return Math.max(0,Math.min(100,r))}return null}function ng(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 og(e,t){let r=e.toLowerCase().trim(),a=r.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(a&&a[1]&&a[2]){let i=a[1].trim(),d=a[2].trim(),u=Hn(t,i),p=cd(d);if(!u)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:u.id,taskName:u.name,message:`Could not parse the date "${d}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let m=u.startDate&&u.endDate?Math.round((u.endDate.getTime()-u.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(p);return f.setDate(f.getDate()+m),{type:"move_task",taskId:u.id,taskName:u.name,updates:{startDate:p,endDate:f},message:`Moved "${u.name}" to ${p.toLocaleDateString()}.`,success:true}}let n=r.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),d=n[2].trim(),u=Hn(t,i),p=dd(d);if(!u)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!u.endDate)return {type:"resize_task",taskId:u.id,taskName:u.name,message:`Could not parse the duration "${d}".`,success:false,error:"Invalid duration"};let m=new Date(u.endDate);return m.setDate(m.getDate()+p),{type:"resize_task",taskId:u.id,taskName:u.name,updates:{endDate:m},message:`Extended "${u.name}" by ${p} days. New end date: ${m.toLocaleDateString()}.`,success:true}}let s=r.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let i=s[1].trim(),d=s[2].trim(),u=Hn(t,i),p=ud(d);return u?p===null?{type:"set_progress",taskId:u.id,taskName:u.name,message:`Could not parse the progress value "${d}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:u.id,taskName:u.name,updates:{progress:p},message:`Set "${u.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 o=r.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),d=o[2].trim(),u=Hn(t,i);return u?{type:"rename_task",taskId:u.id,taskName:u.name,updates:{name:d},message:`Renamed "${u.name}" to "${d}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let c=r.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let i=c[1].trim(),d=c[2].trim(),u=Hn(t,i),p=Hn(t,d);return u?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:u.id,dependencyTo:p.id,message:`Linked "${u.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:d,message:`Could not find a task named "${d}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let l=r.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]){let i=l[1].trim(),d=Hn(t,i);return d?{type:"delete_task",taskId:d.id,taskName:d.name,message:`Deleted "${d.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function sg(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 Lw(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 Aw(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function cl(e,t=[],r=[]){let a=e.assignedUserIds?.map(d=>{let u=r.find(p=>p.id===d);return u?{name:u.name,initials:u.initials,color:u.color}:null}).filter(d=>d!==null),n=t.filter(d=>d.metadata?.parentCardId===e.id).map(d=>cl(d,t,r)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(d=>d.type==="finish-to-start").map(d=>d.taskId));let o=d=>{if(d)return typeof d=="string"?new Date(d):d},c=o(e.startDate),l=o(e.endDate),i=e.metadata?.isMilestone===true||c&&l&&Math.abs(l.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:l,progress:e.progress||0,status:Lw(e.metadata?.status),assignees:a?.length?a:void 0,dependencies:s?.length?s:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function ig(e,t=[]){let r;return e.assignees&&e.assignees.length>0&&(r=e.assignees.map(a=>t.find(s=>s.name===a.name||s.initials===a.initials)?.id).filter(a=>a!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:r?.length?r:void 0,metadata:{status:Aw(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function lg(e,t=[]){return e.filter(a=>!a.metadata?.parentCardId).map(a=>cl(a,e,t))}var pd={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},md={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Equipo",blockers:"Bloqueantes",weight:"Peso"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},dl={en:pd,es:md};function gd(e){return dl[e]||dl.en}function ul(e,t){let r=gd(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},filters:{...r.filters,...t.filters},status:{...r.status,...t.status},actions:{...r.actions,...t.actions},empty:{...r.empty,...t.empty},pagination:{...r.pagination,...t.pagination},bulk:{...r.bulk,...t.bulk}}:r}var fd=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function cg(e){let t=e?.toLowerCase()||"todo";return t==="inprogress"||t==="in-progress"||t==="in_progress"?"in-progress":t==="completed"||t==="done"||t==="complete"?"completed":"todo"}function dg({value:e,onChange:t,isDark:r,translations:a,disabled:n=false}){let[s,o]=useState(false),c=useRef(null);useEffect(()=>{let m=f=>{c.current&&!c.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let l=cg(e),i=fd[0],d=fd.find(m=>m.value===l)??i,u=d.icon,p=m=>{switch(cg(m)){case "completed":return a.completed;case "in-progress":return a.inProgress;default:return a.todo}};return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(u,{className:g("w-4 h-4 flex-shrink-0",d.color)}),jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:p(e)})]}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:m=>{m.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(u,{className:g("w-4 h-4 flex-shrink-0",d.color)}),jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:p(e)}),jsx(ChevronDown,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:fd.map(m=>{let f=m.icon;return jsxs("button",{onClick:x=>{x.stopPropagation(),t(m.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",l===m.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(f,{className:g("w-4 h-4",m.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:p(m.value)})]},m.value)})})]})}var bd=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#3B9EFF]",bg:"bg-[#3B9EFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function pg({value:e="none",onChange:t,isDark:r,locale:a,disabled:n=false}){let[s,o]=useState(false),c=useRef(null);useEffect(()=>{let d=u=>{c.current&&!c.current.contains(u.target)&&o(false);};return s&&document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[s]);let l=bd.find(d=>d.value===e)??bd[4],i=a==="es"?"es":"en";return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:g("w-4 h-4",l.color)}),jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:l.label[i]})]}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:d=>{d.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:g("w-4 h-4",l.color)}),jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:l.label[i]}),jsx(ChevronDown,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:bd.map(d=>jsxs("button",{onClick:u=>{u.stopPropagation(),t(d.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===d.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:g("w-2 h-2 rounded-full",d.bg)}),jsx("span",{className:r?"text-white":"text-gray-900",children:d.label[i]})]},d.value))})]})}function Qs(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function hd(e){let t=["bg-[#00E5CC]","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-[#00E5CC]"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"bg-[#00E5CC]"}function yd({value:e=[],availableUsers:t=[],onChange:r,isDark:a,locale:n,disabled:s=false}){let[o,c]=useState(false),[l,i]=useState(""),d=useRef(null),u=useRef(null);useEffect(()=>{let x=y=>{d.current&&!d.current.contains(y.target)&&(c(false),i(""));};return o&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]),useEffect(()=>{o&&u.current&&u.current.focus();},[o]);let p=t.filter(x=>x.name.toLowerCase().includes(l.toLowerCase())),m=x=>e.some(y=>y.name===x),f=x=>{if(r){if(m(x.name))r(e.filter(y=>y.name!==x.name));else {let y={name:x.name,initials:Qs(x.name),color:x.color||hd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};r([...e,y]);}c(false),i("");}};return s||!r?e.length===0?jsx("span",{className:g("text-sm",a?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,y)=>jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",a?"border-[#0D0D0D]":"border-white",!x.avatar&&hd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Qs(x.name)},`${x.name}-${y}`)),e.length>3&&jsxs("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",a?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:d,className:"relative",children:[jsx("button",{onClick:x=>{x.stopPropagation(),c(!o);},className:g("flex items-center gap-1 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:g("w-4 h-4",a?"text-white/30":"text-gray-400")}),jsx(Plus,{className:g("w-3 h-3",a?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,y)=>jsx("div",{className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",a?"border-[#0D0D0D]":"border-white",!x.avatar&&hd(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Qs(x.name)},`${x.name}-${y}`)),e.length>2&&jsxs("span",{className:g("text-xs ml-1",a?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),o&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:a?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${a?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:a?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:a?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:u,type:"text",value:l,onChange:x=>i(x.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:a?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,y)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(a?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Qs(x.name)}),x.name.split(" ")[0],jsx("button",{onClick:b=>{b.stopPropagation(),r(e.filter(h=>h.name!==x.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsx(X,{style:{width:10,height:10}})})]},`${x.name}-${y}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:p.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:a?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:n==="es"?"No se encontraron miembros":"No members found"}):p.map(x=>{let y=m(x.name);return jsxs("button",{onClick:b=>{b.stopPropagation(),f(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:y?a?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:a?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:b=>{y||(b.currentTarget.style.backgroundColor=a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:b=>{y||(b.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):Qs(x.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),y&&jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function yg({startDate:e,endDate:t,onChange:r,singleDateMode:a=false,singleDateField:n="end",isDark:s,locale:o,disabled:c=false,placeholder:l}){let[i,d]=useState(false),[u,p]=useState(n),[m,f]=useState(()=>{let N=n==="start"?e:t;if(N){let K=N instanceof Date?N:new Date(N);return new Date(K.getFullYear(),K.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=useRef(null),y=useRef(null),b=useRef(null),[h,v]=useState(null),w=e?e instanceof Date?e:new Date(e):null,T=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let N=K=>{let H=K.target;x.current&&x.current.contains(H)||b.current&&b.current.contains(H)||d(false);};return i&&document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[i]),useLayoutEffect(()=>{if(!i){v(null);return}let N=()=>{let K=y.current?.getBoundingClientRect();if(!K)return;let H=520,te=360,I=window.innerHeight-K.bottom,_=I<te&&K.top>I,j=_?K.top-4:K.bottom+4,W=Math.min(Math.max(K.left,8),window.innerWidth-H-8);v({top:j,left:W,flipUp:_});};return N(),window.addEventListener("scroll",N,true),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,true),window.removeEventListener("resize",N);}},[i]),useEffect(()=>{i&&p(a?n:"start");},[i,a,n]);let E=N=>N?N.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):l||"-",F=useCallback(()=>{let N=m.getFullYear(),K=m.getMonth(),H=new Date(N,K,1),I=new Date(N,K+1,0).getDate(),_=H.getDay(),j=[],B=new Date(N,K,0).getDate();for(let We=_-1;We>=0;We--)j.push({date:new Date(N,K-1,B-We),isCurrentMonth:false});for(let We=1;We<=I;We++)j.push({date:new Date(N,K,We),isCurrentMonth:true});let ve=42-j.length;for(let We=1;We<=ve;We++)j.push({date:new Date(N,K+1,We),isCurrentMonth:false});return j},[m]),k=N=>{if(a)n==="start"?r(N,T||void 0):r(w||void 0,N),d(false);else if(u==="start"){let K=T&&N>T?N:T;r(N,K||void 0),p("end");}else {let K=w&&N<w?N:w;r(K||void 0,N),d(false);}},D=()=>{let N=new Date,K=new Date(N);K.setDate(N.getDate()+1);let H=new Date(N);H.setDate(N.getDate()+((6-N.getDay()+7)%7||7));let te=new Date(N);te.setDate(N.getDate()+((1-N.getDay()+7)%7||7));let I=new Date(N);I.setDate(N.getDate()+(6-N.getDay()+7)%7+7);let _=new Date(N);_.setDate(N.getDate()+14);let j=new Date(N);return j.setDate(N.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:N,display:N.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:K,display:K.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:H,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:te,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:I,display:I.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:_,display:_.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:j,display:j.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(c){let N=a&&n==="start"?w:T;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:E(N)})]})}let P=a&&n==="start"?w:T;return jsxs("div",{ref:x,className:"relative",children:[jsxs("button",{ref:y,onClick:N=>{N.stopPropagation(),d(!i);let K=n==="start"?w:T;K&&f(new Date(K.getFullYear(),K.getMonth(),1));},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:E(P)})]}),i&&h&&createPortal(jsxs("div",{ref:b,className:g("rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),style:{position:"fixed",top:h.flipUp?void 0:h.top,bottom:h.flipUp?window.innerHeight-h.top:void 0,left:h.left,zIndex:10001},onClick:N=>N.stopPropagation(),children:[jsxs("div",{className:g("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[D().map((N,K)=>jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>k(N.date),children:[jsx("span",{children:N.label}),jsx("span",{className:g("text-xs",s?"text-white/30":"text-gray-400"),children:N.display})]},K)),jsx("div",{className:g("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{a?n==="start"?r(void 0,T||void 0):r(w||void 0,void 0):r(void 0,void 0),d(false);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!a&&jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:u==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:g("font-medium",s?"text-white":"text-gray-900"),children:m.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>f(new Date),className:g("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>f(new Date(m.getFullYear(),m.getMonth()-1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>f(new Date(m.getFullYear(),m.getMonth()+1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(N=>jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:N},N))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:F().map((N,K)=>{let H=N.date.toDateString()===new Date().toDateString(),te=w?.toDateString()===N.date.toDateString(),I=T?.toDateString()===N.date.toDateString(),_=te||I,j=!a&&w&&T&&N.date>=w&&N.date<=T;return jsx("button",{onClick:()=>k(new Date(N.date)),className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!N.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),N.isCurrentMonth&&(s?"text-white":"text-gray-900"),H&&"ring-2 ring-[#00E5CC]",te&&"bg-[#00E5CC] text-white",I&&!te&&"bg-[#7C3AED] text-white",j&&!_&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!_&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:N.date.getDate()},K)})})]})]}),document.body)]})}function fl({value:e,onChange:t,isDark:r,locale:a,disabled:n=false,dateField:s="end",startDate:o,endDate:c}){let l=e?e instanceof Date?e:new Date(e):null;return jsx(yg,{startDate:s==="start"?l:o||null,endDate:s==="end"?l:c||null,onChange:(p,m)=>{t&&t(s==="start"?p:m);},singleDateMode:true,singleDateField:s,isDark:r,locale:a,disabled:n||!t,placeholder:"-"})}function us(e=600){let[t,r]=useState(false),a=useRef(null),n=useCallback(()=>{a.current&&clearTimeout(a.current),r(true),a.current=setTimeout(()=>{r(false);},e);},[e]);return useEffect(()=>()=>{a.current&&clearTimeout(a.current);},[]),{isFlashing:t,triggerFlash:n}}function bl(e,t={}){let{enabled:r=true,duration:a=400,steps:n=8}=t,[s,o]=useState(e),[c,l]=useState(false),i=useRef(e),d=useRef([]);return useEffect(()=>{if(d.current.forEach(clearTimeout),d.current=[],!r||e===i.current||e===void 0){o(e),i.current=e;return}let u=i.current??0,p=e,m=p-u,f=a/n;l(true);for(let x=1;x<=n;x++){let y=setTimeout(()=>{let b=x/n,h=1-Math.pow(1-b,3),v=Math.round(u+m*h);o(v),x===n&&(l(false),o(p));},f*x);d.current.push(y);}return i.current=e,()=>{d.current.forEach(clearTimeout),d.current=[];}},[e,r,a,n]),{displayValue:s,isAnimating:c}}function xg(e,t={}){let{delay:r=1500,onCancel:a}=t,[n,s]=useState(null),[o,c]=useState(0),l=useRef(null),i=useRef(null),d=useCallback(m=>{l.current&&clearTimeout(l.current),i.current&&clearInterval(i.current),s(m),c(0);let f=Date.now();i.current=setInterval(()=>{let x=Date.now()-f,y=Math.min(x/r*100,100);c(y);},16),l.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(m),s(null),c(0);},r);},[r,e]),u=useCallback(()=>{l.current&&clearTimeout(l.current),i.current&&clearInterval(i.current),s(null),c(0),a?.();},[a]);return useEffect(()=>()=>{l.current&&clearTimeout(l.current),i.current&&clearInterval(i.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:d,cancelChange:u}}function wg({value:e=0,onChange:t,isDark:r,disabled:a=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,c]=useState(false),[l,i]=useState(""),d=useRef(null),{isFlashing:u,triggerFlash:p}=us(),{displayValue:m,isAnimating:f}=bl(e,{enabled:n,duration:300,steps:6}),x=w=>{if(a||!t)return;w.stopPropagation();let T=w.currentTarget.getBoundingClientRect(),E=w.clientX-T.left,F=Math.round(E/T.width*100),k=Math.max(0,Math.min(100,F));k!==e&&(t(k),s&&p());},y=useCallback(w=>{a||!t||(w.stopPropagation(),i(String(e)),c(true));},[a,t,e]);useEffect(()=>{o&&d.current&&(d.current.focus(),d.current.select());},[o]);let b=useCallback(()=>{c(false);let w=parseInt(l,10);if(!isNaN(w)&&t){let T=Math.max(0,Math.min(100,w));T!==e&&(t(T),s&&p());}},[l,t,e,s,p]),h=useCallback(w=>{w.key==="Enter"&&b(),w.key==="Escape"&&c(false);},[b]),v=m??e;return jsxs("div",{className:g("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",u&&(r?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[v>0?jsx("div",{onClick:x,className:g("flex-1 h-2 rounded-full overflow-hidden",r?"bg-white/[0.05]":"bg-gray-200",!a&&t&&"cursor-pointer"),children:jsx("div",{className:g("h-full rounded-full transition-[width]",v===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",f&&"transition-none"),style:{width:`${v}%`}})}):jsx("div",{className:"flex-1"}),o?jsxs("div",{className:"flex items-center gap-0.5",onClick:w=>w.stopPropagation(),children:[jsx("input",{ref:d,value:l,onChange:w=>i(w.target.value.replace(/[^0-9]/g,"")),onBlur:b,onKeyDown:h,maxLength:3,className:g("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",r?"bg-white/10 border-white/20 text-white focus:border-[#00E5CC]":"bg-white border-gray-300 text-gray-900 focus:border-[#00E5CC]")}),jsx("span",{className:g("text-xs font-mono",r?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:y,className:g("text-xs w-8 text-right tabular-nums font-mono rounded px-1",v===0?r?"text-[#6B7280]":"text-gray-400":r?"text-white/60":"text-gray-500",!a&&t&&"cursor-pointer hover:bg-white/[0.08]",f&&"font-medium scale-105"),title:!a&&t?"Click to edit":void 0,children:[v,"%"]})]})}function Tg({value:e="",onChange:t,isDark:r,placeholder:a="-",disabled:n=false}){let[s,o]=useState(false),[c,l]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{l(e);},[e]);let d=()=>{c!==e&&t?.(c),o(false);},u=p=>{p.key==="Enter"?d():p.key==="Escape"&&(l(e),o(false));};return n||!t?jsx("span",{className:g("text-sm truncate",r?"text-white/60":"text-gray-500"),children:e||a}):s?jsx("input",{ref:i,type:"text",value:c,onChange:p=>l(p.target.value),onBlur:d,onKeyDown:u,onClick:p=>p.stopPropagation(),className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:p=>{p.stopPropagation(),o(true);},className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(r?"text-white/30":"text-gray-400")),children:e||a})}function Sg({value:e,onChange:t,isDark:r,placeholder:a="-",min:n,max:s,disabled:o=false,enableSlotMachine:c=true,enableSaveFlash:l=true}){let[i,d]=useState(false),[u,p]=useState(e?.toString()||""),m=useRef(null),{isFlashing:f,triggerFlash:x}=us(),{displayValue:y,isAnimating:b}=bl(e,{enabled:c&&!i});useEffect(()=>{i&&m.current&&(m.current.focus(),m.current.select());},[i]),useEffect(()=>{p(e?.toString()||"");},[e]);let h=()=>{let w=parseFloat(u);if(!isNaN(w)){let T=w;n!==void 0&&(T=Math.max(n,T)),s!==void 0&&(T=Math.min(s,T)),T!==e&&(t?.(T),l&&x());}d(false);},v=w=>{w.key==="Enter"?h():w.key==="Escape"&&(p(e?.toString()||""),d(false));};return o||!t?jsx("span",{className:g("text-sm font-mono",r?"text-white/60":"text-gray-500",b&&"font-medium"),children:y!==void 0?y:a}):i?jsx("input",{ref:m,type:"number",value:u,onChange:w=>p(w.target.value),onBlur:h,onKeyDown:v,onClick:w=>w.stopPropagation(),min:n,max:s,className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:w=>{w.stopPropagation(),d(true);},className:g("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",y===void 0&&(r?"text-white/30":"text-gray-400"),f&&(r?"bg-green-500/30":"bg-green-500/20"),b&&"font-medium scale-105"),children:y!==void 0?y:a})}function Eg({value:e,options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false}){let[o,c]=useState(false),l=useRef(null);return useEffect(()=>{let i=d=>{l.current&&!l.current.contains(d.target)&&c(false);};return o&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[o]),s||!r?jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:e||n}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),c(!o);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:g("text-sm flex-1 text-left truncate",a?"text-white/60":"text-gray-500",!e&&(a?"text-white/30":"text-gray-400")),children:e||n}),jsx(ChevronDown,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")})]}),o&&jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:g("px-3 py-2 text-sm",a?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:d=>{d.stopPropagation(),r(i),c(false);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:a?"text-white":"text-gray-900",children:i}),e===i&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},i))})]})}function Pg({value:e=false,onChange:t,isDark:r,disabled:a=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:c,progress:l,startChange:i,cancelChange:d}=xg(t,{delay:s}),u=m=>{m.stopPropagation(),!a&&t&&(n?c?d():i(!e):t(!e));},p=c?o:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:u,disabled:a||!t,className:g("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",p?"bg-[#00E5CC] border-[#00E5CC]":r?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(a||!t)&&"opacity-50 cursor-not-allowed",c&&"ring-2 ring-offset-1",c&&p&&"ring-green-500/50",c&&!p&&"ring-red-500/50",c&&(r?"ring-offset-[#050505]":"ring-offset-white")),children:[c&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${l/100*50.26} 50.26`,className:"transition-all duration-100"})}),c?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),c&&jsx("button",{onClick:m=>{m.stopPropagation(),d();},className:g("w-4 h-4 rounded-full flex items-center justify-center transition-colors",r?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsx(X,{className:"w-3 h-3"})})]})}function Ag({value:e=[],isDark:t,maxVisible:r=2}){if(e.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let a=e.slice(0,r),n=e.length-r;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[a.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),n>0&&jsxs("span",{className:g("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",n]})]})}function hk(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let r=Math.floor(e/60),a=e%60;return r===0?`${a}m`:a===0?`${r}h`:`${r}h ${a}m`}function yk(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let r=t.match(/^(\d+):(\d+)$/);if(r&&r[1]&&r[2]){let c=parseInt(r[1],10),l=parseInt(r[2],10);return c*60+l}let a=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(a&&a[1]){let c=parseFloat(a[1]),l=a[2]?parseInt(a[2],10):0;return Math.round(c*60)+l}let n=t.match(/^(\d+\.?\d*)\s*h$/);if(n&&n[1])return Math.round(parseFloat(n[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function Fa({value:e,onChange:t,isDark:r,locale:a="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:c=false,lens:l="hours",hourlyRate:i=0,financialOverride:d}){let[u,p]=useState(false),[m,f]=useState(""),x=useRef(null),{isFlashing:y,triggerFlash:b}=us(),h=l==="financial"&&(i>0||d!=null),v=d??(e?e/60*i:0),w=h&&(d!=null?d>0:e)?`$${Math.round(v).toLocaleString("en-US")}`:hk(e,a);useEffect(()=>{u&&x.current&&(x.current.focus(),x.current.select());},[u]),useEffect(()=>{if(e){let k=Math.floor(e/60),D=e%60;k>0&&D>0?f(`${k}h ${D}m`):k>0?f(`${k}h`):f(`${D}m`);}else f("");},[e,u]);let T=()=>{let k=yk(m);k!==e&&(t?.(k),o&&b()),p(false);},E=k=>{k.key==="Enter"?T():k.key==="Escape"&&p(false);};if(c)return jsxs("div",{className:"flex items-center gap-1.5",title:a==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",r?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let F=h?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsx(F,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm font-mono",r?"text-white/60":"text-gray-500"),children:w})]}):u?jsx("input",{ref:x,type:"text",value:m,onChange:k=>f(k.target.value),onBlur:T,onKeyDown:E,onClick:k=>k.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:k=>{k.stopPropagation(),p(true);},className:g("flex items-center justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?r?"text-white/60":"text-gray-600":r?"text-white/30":"text-gray-400",y&&(r?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(F,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:w})]})}function $g({startDate:e,endDate:t,scheduleVariance:r,isDark:a,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:g("text-[11px] font-mono",a?"text-white/30":"text-gray-400"),children:"-"});let o=l=>l.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),c=()=>{if(r==null)return null;let l=n==="es";return r===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:l?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color:a?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:l?"Tiempo no asignado":"No time allocated"}):r>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",r,"d ",l?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[r,"d ",l?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:g("text-[11px] font-mono",a?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsx("span",{className:a?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),c()]})}function Hg({task:e,isDark:t,locale:r="en",onLogTime:a,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:c="hours",hourlyRate:l=0}){let i=r==="es",d=c==="financial"&&l>0,u=j=>d?`$${Math.round(j*l).toLocaleString("en-US")}`:`${j}h`,[p,m]=useState(false),[f,x]=useState(false),[y,b]=useState(null),h=useRef(null),v=e.timeLoggedMinutes||0,w=e.effortMinutes||0,T=e.soldEffortMinutes||0,E=Math.round(v/60*10)/10,F=Math.round(w/60*10)/10,k=w>0?v/w*100:0,D=k>100?Math.round((v-w)/60*10)/10:0,P=k>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!f&&!y)return;let j=W=>{h.current&&!h.current.contains(W.target)&&(x(false),b(null));};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[f,y]);let N=j=>{if(j.stopPropagation(),a&&!n&&!s){b("log");return}if(a||n||s){x(W=>!W),b(null);return}o&&o(e);},K=j=>{x(false),b(j);},H=async(j,W)=>{y==="log"&&a&&j?a(e,j,W):y==="estimate"&&n?n(e,j):y==="quoted"&&s&&s(e,j),b(null);},te=a||n||s||o,I=[{mode:"log",icon:Clock,label:i?"Registrar tiempo":"Log time",show:!!a},{mode:"estimate",icon:Target,label:i?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(j=>j.show),_=y==="estimate"?w:y==="quoted"?T:void 0;return w===0&&v===0&&T===0?jsxs("div",{ref:h,className:"relative flex items-center gap-2",onClick:j=>j.stopPropagation(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsx("span",{className:g("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),p&&te&&jsx("button",{onClick:N,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:j=>{j.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",j.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:j=>{j.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",j.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:I.map(j=>jsxs("button",{onClick:W=>{W.stopPropagation(),K(j.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:W=>{W.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.target.style.background="transparent";},children:[jsx(j.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),j.label]},j.mode))})}),jsx(AnimatePresence,{children:y&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(vn,{mode:y,locale:r,isDark:t,currentValue:_||void 0,onSave:H,onClose:()=>b(null)})})})})]}):jsxs("div",{ref:h,className:"relative flex items-center gap-2 w-full",onClick:j=>j.stopPropagation(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[(()=>{let j=v===0,B=(w>0?v/w:0)>1.1;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:j?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:u(E)}),w>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",u(F)]}),D>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:B?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:B?"rgba(239,68,68,0.15)":"transparent"},children:["+",u(D)," ",i?"Excedido":"Over"]})]})})(),w>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(k,100)}%`,backgroundColor:P,borderRadius:2,transition:"width 0.3s"}})})]}),te&&jsx("button",{onClick:N,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:p?1:0,pointerEvents:p?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:j=>{j.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",j.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:j=>{j.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",j.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:I.map(j=>jsxs("button",{onClick:W=>{W.stopPropagation(),K(j.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:W=>{W.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.target.style.background="transparent";},children:[jsx(j.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),j.label]},j.mode))})}),jsx(AnimatePresence,{children:y&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(vn,{mode:y,locale:r,isDark:t,currentValue:_||void 0,onSave:H,onClose:()=>b(null)})})})})]})}function Nk(e){let t=new Map;function r(a){if(a.assignees)for(let n of a.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(a.subtasks)for(let n of a.subtasks)r(n);}return r(e),Array.from(t.values())}function Dk(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function Ug({assignee:e,size:t=28,isDark:r}){let a=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",n=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:g(a,"rounded-full object-cover ring-1 flex-shrink-0",r?"ring-white/10":"ring-gray-200")}):jsx("div",{className:g(a,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,r?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function Wg({task:e,isDark:t,locale:r="en"}){let a=r==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let d=Nk(e);if(d.length===0)return null;let u=d.slice(0,3),p=d.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:u.map((m,f)=>jsx(Ug,{assignee:m,size:24,isDark:t},m.name+f))}),p>0&&jsxs("span",{className:g("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:d.slice(3).map(m=>m.name).join(", "),children:["+",p]})]})}if(!s)return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsx(User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsx("span",{className:g("text-[11px]",t?"text-white/30":"text-gray-400"),children:a?"Sin asignar":"Unassigned"})]});let c=o?.percentage??0,l=!!o&&c>0,i=l?Dk(c):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Ug,{assignee:s,size:28,isDark:t}),jsx("span",{className:g("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),l&&i&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[c,"% LOAD"]})]})}var Sk={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function Gg({blockers:e,isDark:t,locale:r="en"}){return !e||e.length===0?jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:r==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((a,n)=>jsxs("span",{className:g("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",Sk[a.severity]),children:[a.type," #",a.id]},`${a.type}-${a.id}-${n}`))})}function zk(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Gk(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"blue"}function Xg({state:e,onClose:t,isDark:r,locale:a,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:c,onColumnHide:l,onColumnSort:i,availableUsers:d=[],onOpenTimeLog:u,onReportBlocker:p,onCopyTaskLink:m,onTaskMove:f,onTaskIndent:x,onTaskOutdent:y}){let b=useRef(null),h=a==="es"?_g.es:_g.en,[v,w]=useState({left:e.x,top:e.y});if(useLayoutEffect(()=>{w({left:e.x,top:e.y});let D=b.current;if(!D)return;let P=D.getBoundingClientRect(),N=8,K=e.x,H=e.y;e.y+P.height>window.innerHeight-N&&(H=Math.max(N,e.y-P.height)),e.x+P.width>window.innerWidth-N&&(K=Math.max(N,window.innerWidth-P.width-N)),(K!==e.x||H!==e.y)&&w({left:K,top:H});},[e.x,e.y,e.isOpen]),useEffect(()=>{let D=N=>{b.current&&!b.current.contains(N.target)&&t();},P=N=>{N.key==="Escape"&&t();};return document.addEventListener("mousedown",D),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",D),document.removeEventListener("keydown",P);}},[t]),!e.isOpen)return null;let T=()=>{if(!e.task)return [];let D=[];return n&&D.push({id:"edit",label:h.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),D.push({id:"sep1",label:"",icon:null,separator:true}),c&&(D.push({id:"status",label:h.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:h.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{c({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:h.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-[#00E5CC]"}),onClick:()=>{c({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:h.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{c({...e.task,status:"completed",progress:100}),t();}}]}),D.push({id:"priority",label:h.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:h.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{c({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:h.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{c({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:h.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{c({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:h.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{c({...e.task,priority:"low"}),t();}}]}),d.length>0&&D.push({id:"assign",label:h.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:d.slice(0,5).map(P=>({id:`assign-${P.id}`,label:P.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:P.name.charAt(0).toUpperCase()}),onClick:()=>{let N=e.task.assignees||[],H=N.some(te=>te.name===P.name)?N.filter(te=>te.name!==P.name):[...N,{name:P.name,initials:zk(P.name),color:P.color||Gk(P.name),avatar:P.avatarUrl}];c({...e.task,assignees:H}),t();}}))})),u&&D.push({id:"log-time",label:h.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{u(e.task),t();}}),p&&D.push({id:"report-blocker",label:h.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),m&&D.push({id:"copy-link",label:h.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),D.push({id:"sep2",label:"",icon:null,separator:true}),s&&D.push({id:"duplicate",label:h.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||x||y)&&(D.push({id:"sep3",label:"",icon:null,separator:true}),f&&(D.push({id:"move-up",label:h.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),D.push({id:"move-down",label:h.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),x&&D.push({id:"indent",label:h.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),y&&D.push({id:"outdent",label:h.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{y(e.task.id),t();}})),o&&D.push({id:"delete",label:h.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),D},E=()=>{if(!e.columnId)return [];let D=[];return i&&(D.push({id:"sort-asc",label:h.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),D.push({id:"sort-desc",label:h.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),l&&e.columnId!=="name"&&(D.push({id:"sep-hide",label:"",icon:null,separator:true}),D.push({id:"hide",label:h.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId),t();}})),D},F=e.type==="task"?T():E(),k={position:"fixed",left:v.left,top:v.top,zIndex:9999};return jsx("div",{ref:b,style:k,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:F.map(D=>D.separator?jsx("div",{className:g("my-1 h-px",r?"bg-white/[0.05]":"bg-gray-200")},D.id):D.submenu?jsx(Vk,{item:D,isDark:r},D.id):jsxs("button",{onClick:D.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",D.danger?"text-red-500 hover:text-red-600":r?"text-white":"text-gray-700"),children:[jsx("span",{className:g(D.danger?"text-red-500":r?"text-white/60":"text-gray-400"),children:D.icon}),D.label]},D.id))})}function Vk({item:e,isDark:t}){let[r,a]=useState(false),n=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),a(true);},onMouseLeave:()=>{n.current=setTimeout(()=>a(false),150);},children:[jsxs("button",{className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:g("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),r&&e.submenu&&jsx("div",{className:g("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(c=>jsxs("button",{onClick:c.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:c.icon}),c.label]},c.id))})]})}var _g={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var n0={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),scheduleVariance:jsx(CalendarClock,{className:"w-4 h-4"}),hoursBar:jsx(BarChart3,{className:"w-4 h-4"}),teamLoad:jsx(Users,{className:"w-4 h-4"}),blockers:jsx(AlertTriangle,{className:"w-4 h-4"}),weight:jsx(BarChart,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"})},i1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function s0({isOpen:e,onClose:t,columns:r,customFields:a=[],onColumnsChange:n,onCreateCustomField:s,isDark:o,locale:c}){let[l,i]=useState(""),[d,u]=useState(null),[p,m]=useState(null),f=useRef(null),x=c==="es"?o0.es:o0.en;useLayoutEffect(()=>{if(!e||!f.current)return;let F=()=>{if(!f.current)return;let k=f.current.parentElement;if(k){let K=k.getBoundingClientRect();m({top:K.bottom+4,right:window.innerWidth-K.right});}let D=f.current.getBoundingClientRect(),N=window.innerHeight-D.top-20;u(Math.max(300,N));};return requestAnimationFrame(F),window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)},[e]),useEffect(()=>{if(!e)return;let F=setTimeout(()=>{let k=P=>{f.current&&!f.current.contains(P.target)&&t();},D=P=>{P.key==="Escape"&&t();};document.addEventListener("mousedown",k),document.addEventListener("keydown",D),f._cleanup=()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",D);};},100);return ()=>{clearTimeout(F),f._cleanup&&f._cleanup();}},[e,t]);let y=useMemo(()=>{let F=new Set([...i1]);return r.forEach(k=>{k.type&&k.type!=="assignees"&&F.add(k.type);}),Array.from(F)},[r]);if(!e)return null;let b=F=>{let k=x.columns[F];if(k)return k;let D=r.find(P=>P.type===F);return D?.label?D.label:F},h=F=>{if(F==="name")return;let k=r.map(D=>D.id===F?{...D,visible:!D.visible}:D);n(k);},v=(F,k)=>{let D=r.find(N=>N.type===F&&(!k||N.customFieldId===k));if(D){h(D.id);return}let P={id:k||F,type:F,label:k?a.find(N=>N.id===k)?.name||F:b(F),width:120,visible:true,sortable:true,resizable:true,customFieldId:k};n([...r,P]);},w=y.filter(F=>F!=="assignees"&&b(F).toLowerCase().includes(l.toLowerCase())),T=a.filter(F=>F.name.toLowerCase().includes(l.toLowerCase())),E=o?"#00E5FF":"#00E5CC";return jsxs("div",{ref:f,style:{...d?{maxHeight:`${d}px`}:{},...p?{top:p.top,right:p.right}:{},background:o?"#111114":"#FFFFFF",border:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:o?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)",zIndex:99999},className:"fixed w-64 rounded-xl flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:o?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:x.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",F.currentTarget.style.color=o?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent",F.currentTarget.style.color=o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"px-3 py-2",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:o?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:l,onChange:F=>i(F.target.value),placeholder:x.searchPlaceholder,style:{fontSize:12,background:o?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:o?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:F=>{F&&F.style.setProperty("--focus-border",E);},onFocus:F=>{F.currentTarget.style.borderColor=E,F.currentTarget.style.background=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:F=>{F.currentTarget.style.borderColor=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",F.currentTarget.style.background=o?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:F=>F.stopPropagation(),children:[jsxs("div",{className:"mb-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:o?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:x.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:w.map(F=>{let k=r.find(N=>N.type===F&&!N.customFieldId),D=k?.visible??false,P=F==="name";return jsxs("button",{onClick:()=>{P||(k?h(k.id):v(F));},disabled:P,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:P?.4:1,cursor:P?"not-allowed":"pointer"},onMouseEnter:N=>{P||(N.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:D?E:"transparent",border:D?`1.5px solid ${E}`:`1.5px solid ${o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:D?`0 0 6px ${E}40`:"none"},children:D&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:D?E:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:n0[F]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:D?500:400,color:D?o?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":o?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:b(F),children:b(F)})]},F)})})]}),T.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:o?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:x.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:T.map(F=>{let D=r.find(P=>P.customFieldId===F.id)?.visible??false;return jsxs("button",{onClick:()=>v(F.type,F.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:P=>{P.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:D?E:"transparent",border:D?`1.5px solid ${E}`:`1.5px solid ${o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:D?`0 0 6px ${E}40`:"none"},children:D&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:D?E:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:n0[F.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:D?500:400,color:D?o?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":o?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:F.name})]},F.id)})})]})]})]})}var o0={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var b1=[{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 c0({isOpen:e,onClose:t,onSave:r,isDark:a,locale:n}){let[s,o]=useState(""),[c,l]=useState("text"),[i,d]=useState([""]),u=n==="es"?l0.es:l0.en;useEffect(()=>{e&&(o(""),l("text"),d([""]));},[e]),useEffect(()=>{let y=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,t]);let p=()=>{if(!s.trim())return;let y={name:s.trim(),type:c};c==="dropdown"&&(y.options=i.filter(b=>b.trim())),r(y),t();},m=()=>{d([...i,""]);},f=(y,b)=>{let h=[...i];h[y]=b,d(h);},x=y=>{i.length>1&&d(i.filter((b,h)=>h!==y));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:g("relative w-full max-w-md rounded-xl shadow-2xl border",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:g("flex items-center justify-between px-6 py-4 border-b",a?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:g("text-lg font-semibold",a?"text-white":"text-gray-900"),children:u.title}),jsx("button",{onClick:t,className:g("p-1 rounded",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:g("w-5 h-5",a?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:u.fieldName}),jsx("input",{type:"text",value:s,onChange:y=>o(y.target.value),placeholder:u.fieldNamePlaceholder,className:g("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:u.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:b1.map(y=>jsxs("button",{onClick:()=>l(y.type),className:g("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",c===y.type?"border-[#00E5CC] bg-[#00E5CC]/10":a?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:c===y.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-400",children:y.icon}),jsx("span",{className:g("text-xs",c===y.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-500"),children:u.types[y.type]})]},y.type))})]}),c==="dropdown"&&jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:u.options}),jsxs("div",{className:"space-y-2",children:[i.map((y,b)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:y,onChange:h=>f(b,h.target.value),placeholder:`${u.option} ${b+1}`,className:g("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsx("button",{onClick:()=>x(b),className:g("p-2 rounded-lg transition-colors",a?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},b)),jsxs("button",{onClick:m,className:g("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",a?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),u.addOption]})]})]})]}),jsxs("div",{className:g("flex items-center justify-end gap-3 px-6 py-4 border-t",a?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:u.cancel}),jsx("button",{onClick:p,disabled:!s.trim(),className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#00E5CC] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:u.create})]})]})]}):null}var l0={en:{title:"Create Custom Field",fieldName:"Field Name",fieldNamePlaceholder:"Enter field name...",fieldType:"Field Type",options:"Options",option:"Option",addOption:"Add option",cancel:"Cancel",create:"Create Field",types:{text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Crear Campo Personalizado",fieldName:"Nombre del Campo",fieldNamePlaceholder:"Ingresa el nombre...",fieldType:"Tipo de Campo",options:"Opciones",option:"Opci\xF3n",addOption:"Agregar opci\xF3n",cancel:"Cancelar",create:"Crear Campo",types:{text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var p0={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To Do / Pending",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En Progreso",toDo:"Por Hacer / Pendiente",hideCompleted:"Ocultar Tareas Completadas"}};function m0({value:e,hideCompleted:t,onChange:r,onHideCompletedChange:a,isDark:n,locale:s}){let[o,c]=useState(false),l=useRef(null),i=useRef(0),d=s==="es"?p0.es:p0.en;useEffect(()=>{if(!o)return;let m=x=>{Date.now()-i.current<100||l.current&&!l.current.contains(x.target)&&c(false);},f=x=>{x.key==="Escape"&&c(false);};return document.addEventListener("mousedown",m),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",f);}},[o]);let u=[{value:"all",label:d.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:d.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:d.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:d.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:m=>{m.stopPropagation(),o||(i.current=Date.now()),c(f=>!f);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",n?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(n?"bg-[#00E5CC]/20 border-[#00E5CC]/50 text-[#00E5CC]":"bg-[#00E5CC]/15 border-[#00E5CC]/15 text-[#00C4AE]"),o&&(n?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),d.filters,p&&jsx("span",{className:g("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),o&&jsxs("div",{className:g("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:g("px-4 py-3 border-b",n?"border-[#222]":"border-gray-200"),children:jsx("span",{className:g("text-xs font-medium uppercase tracking-wider",n?"text-white/30":"text-gray-400"),children:d.filterByStatus})}),jsx("div",{className:"py-2",children:u.map(m=>{let f=e===m.value&&!t,x=()=>m.value==="all"?f?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):m.icon;return jsxs("button",{onClick:()=>{r(m.value),a(false),c(false);},className:g("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",f&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:g(f?m.color:"text-gray-400","flex-shrink-0"),children:x()}),jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:m.label}),f&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},m.value)})}),jsx("div",{className:g("my-2 mx-4 h-px",n?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let m=!t;a(m),m&&r("all"),c(false);},className:g("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:g("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":n?"text-white/30":"text-gray-400")}),jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:d.hideCompleted}),t&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function g0(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function Po(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function f0({data:e,isDark:t,locale:r="en",onClose:a,lens:n="hours",onUnassignedTaskClick:s}){let o=r==="es",c=n==="financial";return jsxs("div",{className:g("w-[260px] xl:w-[320px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:g("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:g("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:c?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),a&&jsx("button",{onClick:a,className:g("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),c&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let l=e.totalOffered??0,i=e.totalEstimated??0,d=e.totalExecuted??0,u=l-d,p=l>0?Math.round(u/l*100):0,m=l>0?Math.min(Math.round(d/l*100),120):0,f=d>l&&l>0,x=f?"#F87171":"#00E5CC";return jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"PRESUPUESTO":"BUDGET"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Po(l)})]}),(()=>{let y=e.totalEstimatedLabor??0,b=e.totalEstimatedEquipment??0,h=e.totalEstimatedTravel??0,v=b>0||h>0,w=(T,E)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:T}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:Po(E)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Estimado":"Estimated"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Po(i)})]}),v&&jsxs(Fragment,{children:[w(o?"Mano de obra":"Labor",y),b>0&&w(o?"Activos":"Equipment",b),h>0&&w(o?"Vi\xE1ticos":"Travel",h)]})]})})(),d>0&&(()=>{let y=e.totalExecutedLabor??0,b=e.totalExecutedEquipment??0,h=e.totalExecutedTravel??0,v=b>0||h>0,w=(T,E)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:T}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:Po(E)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsx("span",{className:g("text-[11px] font-mono font-bold",f?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Po(d)})]}),v&&jsxs(Fragment,{children:[w(o?"Mano de obra":"Labor",y),b>0&&w(o?"Activos":"Equipment",b),h>0&&w(o?"Vi\xE1ticos":"Travel",h)]})]})})(),l>0&&jsx("div",{className:g("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(m,100)}%`,backgroundColor:x}})}),jsxs("div",{className:g("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",u>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[u>=0?`+${Po(u)} ${o?"Disp.":"Avail."}`:`${Po(Math.abs(u))} ${o?"P\xE9rdida":"Loss"}`,l>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",p,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let l=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,d=i>0?Math.min(Math.round(l/i*100),100):0,m=(i>0?l/i:0)>1.1?"#F87171":d>=90?"#FFD60A":"#3BF06E";return jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:g0(l)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:g("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:g0(i)})]}),i>0&&jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${d}%`,backgroundColor:m}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:g("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#F87171]/15 text-[#F87171]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:g("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.unassignedCount!=null&&e.unassignedCount>0&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsx("div",{className:g("flex items-center justify-center w-10 h-10 rounded-lg font-mono text-lg font-bold",e.unassignedCount>=10?"bg-[#F87171]/15 text-[#F87171]":"bg-[#FFD60A]/15 text-[#FFD60A]"),children:e.unassignedCount}),jsxs("div",{children:[jsx("p",{className:g("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?o?"tarea pendiente":"pending task":o?"tareas pendientes":"pending tasks"}),jsx("p",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:o?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsx("div",{className:g("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(l=>jsxs("button",{onClick:()=>s?.(l.id),className:g("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[11px] w-full text-left transition-colors",t?"bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white":"bg-gray-50 text-gray-600 hover:bg-gray-100 hover:text-gray-900",s&&"cursor-pointer"),children:[jsx("span",{className:g("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsx("span",{className:"truncate",children:l.name})]},l.id))})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let l=e.scheduleVarianceDays??0,i=l>0,d=l<0,u=e.scheduleVarianceLabel||(i?`+${l} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:d?`${l} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:g("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",d&&"bg-[#F87171]/15 text-[#F87171]",!i&&!d&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:u})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:g("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((l,i)=>{let d=l.utilizationPercent>=100?"#F87171":l.utilizationPercent>=80?"#FFD60A":l.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:l.name}),jsxs("span",{className:g("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[l.utilizationPercent,"%"]})]}),jsx("div",{className:g("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(l.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${l.name}-${i}`)})})]})]})}var L1=[{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 C0(e,t=0,r=[]){let a=[];for(let n of e){let s=[...r,n.id];a.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&a.push(...C0(n.subtasks,t+1,s));}return a}function A1(e){let t=e.subtasks;if(!t?.length)return null;let r=new Date,a=0,n=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),l=s.endDate.getTime()-o;if(l<=0)continue;let d=Math.max(0,Math.min(r.getTime()-o,l))/l*100;if(d<=0)continue;let u=(s.progress||0)/d;a+=u,n++;}return n>0?a/n:null}function hs(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,r=0,a=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=hs(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,r+=s.allocated>0?s.allocated:n.effortMinutes??0,a+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,r+=n.effortMinutes??0,a+=n.soldEffortMinutes??0;return {spent:t,allocated:r,quoted:a}}function bs(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function I1({value:e,onChange:t,isDark:r}){let[a,n]=useState(false),[s,o]=useState(String(e||""));return a?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:c=>c.stopPropagation(),onChange:c=>o(c.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let c=parseFloat(s);!isNaN(c)&&c>=0&&c<=100?t(c):s===""&&t(0),n(false);},onKeyDown:c=>{c.key==="Enter"&&c.target.blur(),c.key==="Escape"&&(o(String(e||"")),n(false));},className:g("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",r?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:c=>{c.stopPropagation(),o(String(e||"")),n(true);},className:g("text-xs font-mono cursor-pointer hover:underline",e>0?r?"text-white/80":"text-gray-700":r?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function w0(e){if(e.length===0)return 0;let t=0,r=0,a=0;for(let c of e){let l=c.weight||0;l>0&&(t+=(c.progress||0)*l,r+=l,a+=1);}let n=a/e.length;if(r>=99&&n>=.95)return Math.round(t/r*10)/10;if(e.reduce((c,l)=>c+(l.effort_minutes||0),0)>0){let c=0,l=0;for(let i of e){let d=i.effort_minutes||60;c+=(i.progress||0)*d,l+=d;}return Math.round(c/l*10)/10}let o=e.reduce((c,l)=>c+(l.progress||0),0);return Math.round(o/e.length*10)/10}function Rd(e,t=[]){for(let r of e)r.subtasks&&r.subtasks.length>0?Rd(r.subtasks,t):t.push({progress:r.progress||0,weight:r.weight||0,effort_minutes:r.effort_minutes??r.effortMinutes});return t}function T0({tasks:e,config:t={},callbacks:r={},isLoading:a=false,error:n,className:s,style:o,availableUsers:c=[],customFields:l=[],toolbarRightContent:i,onColumnHeaderClick:d,columnsWithFilter:u,filterDotColor:p="#00E5CC"}){let{theme:m="dark",locale:f="en",customTranslations:x,showSearch:y=true,showHierarchy:b=true,tableColumns:h,allowColumnCustomization:v=true,allowColumnResize:w=true,enableContextMenu:T=true,showCreateTaskButton:E=false,onCreateTask:F,persistFilter:k=false,financialBlur:D,healthSidebar:P,lens:N="hours",hourlyRate:K=0,rateMap:H,aggregateParentHours:te=false,showProjectTotals:I=false,totalsDollarOverride:_}=t,j=ul(f,x),W=m==="dark",B=S=>{if(!H||!S.assignees||S.assignees.length===0)return K;let Q=0,ue=0;for(let Ce of S.assignees){let Oe=Ce.id?H[Ce.id]:void 0;if(Oe==null||Oe<=0)continue;let ie=typeof Ce.estimatedMinutes=="number"?Ce.estimatedMinutes:0;ie>0&&(Q+=Oe*ie,ue+=ie);}if(ue>0)return Q/ue;let we=S.assignees.map(Ce=>Ce.id?H[Ce.id]:void 0).filter(Ce=>Ce!=null&&Ce>0);return we.length===0?K:we.reduce((Ce,Oe)=>Ce+Oe,0)/we.length},ve=S=>{let Q=0,ue=0,we=0,Ce=Oe=>{for(let ie of Oe)if(ie.subtasks&&ie.subtasks.length>0){let Re={s:Q,a:ue,q:we};if(Ce(ie.subtasks),Q-Re.s+(ue-Re.a)+(we-Re.q)===0){let st=B(ie);Q+=(ie.timeLoggedMinutes??0)/60*st,ue+=(ie.effortMinutes??0)/60*st,we+=(ie.soldEffortMinutes??0)/60*st;}}else {let Re=B(ie);Q+=(ie.timeLoggedMinutes??0)/60*Re,ue+=(ie.effortMinutes??0)/60*Re,we+=(ie.soldEffortMinutes??0)/60*Re;}};return S.subtasks&&Ce(S.subtasks),{dollarSpent:Q,dollarAllocated:ue,dollarQuoted:we}},We=useCallback(()=>{if(!k||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let S=localStorage.getItem(k);if(S){let Q=JSON.parse(S);return {statusFilter:Q.statusFilter||"all",hideCompleted:Q.hideCompleted||!1}}}catch(S){console.error("Error loading persisted filter:",S);}return {statusFilter:"all",hideCompleted:false}},[k]),Le=useMemo(()=>{function S(Q){let ue=0,we=0,Ce=0,Oe=0,ie=0,Re=0;for(let Me of Q)if(Me.subtasks&&Me.subtasks.length>0){let st=S(Me.subtasks);if(st.spent+st.allocated+st.quoted>0)ue+=st.spent,we+=st.allocated,Ce+=st.quoted,Oe+=st.dollarSpent,ie+=st.dollarAllocated,Re+=st.dollarQuoted;else {let dt=Me.timeLoggedMinutes??0,ut=Me.effortMinutes??0,sr=Me.soldEffortMinutes??0;ue+=dt,we+=ut,Ce+=sr;let hr=B(Me);Oe+=dt/60*hr,ie+=ut/60*hr,Re+=sr/60*hr;}}else {let st=Me.timeLoggedMinutes??0,Bt=Me.effortMinutes??0,dt=Me.soldEffortMinutes??0;ue+=st,we+=Bt,Ce+=dt;let ut=B(Me);Oe+=st/60*ut,ie+=Bt/60*ut,Re+=dt/60*ut;}return {spent:ue,allocated:we,quoted:Ce,dollarSpent:Oe,dollarAllocated:ie,dollarQuoted:Re}}return S(e)},[e]),be=useMemo(()=>{let S=new Map;function Q(ue){let we=0;for(let Ce of ue)if(Ce.subtasks&&Ce.subtasks.length>0){let Oe=Q(Ce.subtasks);S.set(Ce.id,Oe),we+=Oe;}else we+=Ce.weight||0;return we}return Q(e),S},[e]),ge=useMemo(()=>!P?.enabled||!P.data?P:{...P,data:{...P.data,totalHoursSpentMinutes:Le.spent,totalHoursAllocatedMinutes:Le.allocated}},[P,Le]),[ye,ze]=useState(true),[ke,Ie]=useState(null),[De,qe]=useState("position"),[fe,tt]=useState("asc"),[Be,$e]=useState(""),[gt,Ft]=useState(()=>We().statusFilter),[He,Ae]=useState(()=>We().hideCompleted),[ot,Lt]=useState(h||L1),[Fe,Xe]=useState(false),[L,ae]=useState(false),[R,q]=useState({isOpen:false,x:0,y:0,type:"task"}),[U,X]=useState(null),[Se,de]=useState(false),[et,rt]=useState(null),[Qe,At]=useState(null),[kt,jt]=useState(null),Gt=useRef(0),or=useRef(false),br=!!(r.onTaskMove||r.onTaskReparent),[da,qt]=useState(null),[gr,St]=useState(null),Lr=S=>S==="assignees"||S==="teamLoad"?"assignees":S==="startDate"?"startDate":S==="endDate"?"endDate":null,Yt=useRef([]),tr=useCallback((S,Q)=>{br&&(Q.preventDefault(),Gt.current=Q.clientY,X(S),or.current=false,de(false),jt({x:Q.clientX,y:Q.clientY}));},[br]),kr=useCallback(S=>{if(!U||(Math.abs(S.clientY-Gt.current)>5&&!or.current&&(or.current=true,de(true)),jt({x:S.clientX,y:S.clientY}),!or.current))return;let ue=document.querySelectorAll("[data-listview-row]"),we=null,Ce=null;ue.forEach(Oe=>{let ie=Oe.getBoundingClientRect(),Re=Oe.getAttribute("data-listview-row");if(Re&&Re!==U&&S.clientY>=ie.top&&S.clientY<=ie.bottom){we=Re;let Me=S.clientY-ie.top,st=ie.height;Ce=Me<st*.25?"above":Me>st*.75?"below":"child";}}),rt(we),At(Ce);},[U]),oa=useCallback(()=>{if(or.current&&U&&et&&Qe){if(Qe==="child"&&r.onTaskReparent)r.onTaskReparent(U,et);else if(Qe==="above"||Qe==="below"){let S=(we,Ce,Oe=null)=>{for(let ie of we){if(ie.id===Ce)return Oe;if(ie.subtasks){let Re=S(ie.subtasks,Ce,ie.id);if(Re!==void 0)return Re}}},Q=S(e,U,null),ue=S(e,et,null);if(r.onTaskReparent){let we=(st,Bt)=>{if(Bt===null)return st;for(let dt of st){if(dt.id===Bt)return dt.subtasks||[];if(dt.subtasks){let ut=we(dt.subtasks,Bt);if(ut.length>0||dt.subtasks.some(sr=>sr.id===Bt))return ut}}return []},Ce=we(e,ue??null),Oe=Ce.findIndex(st=>st.id===et),ie=Q===ue,Re=ie?Ce.findIndex(st=>st.id===U):-1,Me=Qe==="below"?Oe+1:Oe;ie&&Re!==-1&&Re<Oe&&(Me-=1),r.onTaskReparent(U,ue??null,Math.max(0,Me));}}}X(null),rt(null),At(null),jt(null),or.current=false,de(false);},[U,et,Qe,e,r]),Ze=(S,Q)=>Q==="assignees"?S.assignees:Q==="startDate"?S.startDate:S.endDate,Ye=(S,Q,ue,we)=>{S.preventDefault(),S.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let Ce=Array.from(document.querySelectorAll("[data-listview-row]")),Oe=Ce.map(Ct=>Ct.getAttribute("data-listview-row")||""),ie=Math.max(0,Oe.indexOf(Q)),Re=Ct=>Oe.slice(ie,Ct+1);St({sourceTaskId:Q,column:ue,sourceIndex:we,targetIndex:we,rangeIds:new Set([Q])});let st=(Ct=>{let ft=Ct?.parentElement??null;for(;ft;){let xa=window.getComputedStyle(ft).overflowY;if((xa==="auto"||xa==="scroll")&&ft.scrollHeight>ft.clientHeight)return ft;ft=ft.parentElement;}let Ar=document.scrollingElement;return Ar&&Ar.scrollHeight>Ar.clientHeight?Ar:null})(S.currentTarget),Bt=Ct=>{let ft=ie,Ar=false;Ce.forEach((xa,pa)=>{let qr=xa.getBoundingClientRect();Ct>=qr.top&&Ct<=qr.bottom&&(ft=pa,Ar=true);});let ga=Ce[Ce.length-1];if(!Ar&&ga){let xa=ga.getBoundingClientRect();Ct>xa.bottom&&(ft=Ce.length-1);}return ft<ie&&(ft=ie),ft},dt=S.clientY,ut=null,sr=()=>{ut!==null&&(cancelAnimationFrame(ut),ut=null);},hr=()=>{let Ct=Bt(dt),ft=new Set(Re(Ct));St(Ar=>Ar&&{...Ar,targetIndex:Ct,rangeIds:ft});},Gr=()=>{if(sr(),!st)return;let Ct=st,Ar=Ct===document.scrollingElement?{top:0,bottom:window.innerHeight}:Ct.getBoundingClientRect(),ga=60,xa=12,pa=dt-Ar.top,qr=Ar.bottom-dt,Pn=Ct.scrollHeight-Ct.clientHeight;if(qr<ga&&Ct.scrollTop<Pn){let Cs=Math.max(1,Math.round(xa*(1-Math.max(0,qr)/ga))),go=()=>{Ct.scrollTop+=Cs,hr(),Ct.scrollTop<Ct.scrollHeight-Ct.clientHeight&&(ut=requestAnimationFrame(go));};ut=requestAnimationFrame(go);}else if(pa<ga&&Ct.scrollTop>0){let Cs=Math.max(1,Math.round(xa*(1-Math.max(0,pa)/ga))),go=()=>{Ct.scrollTop-=Cs,hr(),Ct.scrollTop>0&&(ut=requestAnimationFrame(go));};ut=requestAnimationFrame(go);}},$t=Ct=>{dt=Ct.clientY,hr(),Gr();},Jt=Ct=>{window.removeEventListener("mousemove",$t),window.removeEventListener("mouseup",Jt),sr(),document.body.style.cursor="",document.body.style.userSelect="",St(null);let ft=Bt(Ct.clientY),Ar=new Map(Yt.current.map(qr=>[qr.id,qr])),ga=Ar.get(Q);if(!ga)return;let xa=Ze(ga,ue),pa=[];for(let qr of Re(ft)){if(qr===Q)continue;let Pn=Ar.get(qr);Pn&&(Pn.subtasks&&Pn.subtasks.length>0||pa.push(qr));}pa.length>0&&r.onBulkFill?.(pa,ue,xa);};window.addEventListener("mousemove",$t),window.addEventListener("mouseup",Jt);},ua=S=>gr?gr.rangeIds.has(S):false;useEffect(()=>{if(U)return document.addEventListener("mousemove",kr),document.addEventListener("mouseup",oa),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",kr),document.removeEventListener("mouseup",oa),document.body.style.cursor="",document.body.style.userSelect="";}},[U,kr,oa]);let[Xt,Zr]=useState("all"),[ne,pe]=useState(false),pt=useRef(null),je=useRef(null),it=useMemo(()=>{let S=0;function Q(ue,we){for(let Ce of ue)we>S&&(S=we),Ce.subtasks?.length&&Q(Ce.subtasks,we+1);}return Q(e,1),S},[e]);useEffect(()=>{if(!ne)return;let S=Q=>{pt.current?.contains(Q.target)||je.current?.contains(Q.target)||pe(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[ne]),useEffect(()=>{if(Xt==="all"){let ue=function(we){for(let Ce of we)Ce.subtasks?.length&&(Ce.isExpanded===false&&r.onTaskToggleExpand?.(Ce.id),ue(Ce.subtasks));};ue(e);}else {let ue=function(we,Ce){for(let Oe of we)if(Oe.subtasks?.length){let ie=Ce<Xt,Re=Oe.isExpanded!==false;ie!==Re&&r.onTaskToggleExpand?.(Oe.id),ue(Oe.subtasks,Ce+1);}};ue(e,1);}},[Xt]);let[V,le]=useState(null),[J,O]=useState(0),[Z,Te]=useState(0),C=useRef(null),[$,ce]=useState(null),[xe,ee]=useState(null);useEffect(()=>{h&&Lt(S=>{if(S.length===h.length){let Q=true;for(let ue=0;ue<S.length;ue++){let we=S[ue],Ce=h[ue];if(!we||!Ce||we.id!==Ce.id||we.visible!==Ce.visible||we.width!==Ce.width||we.label!==Ce.label){Q=false;break}}if(Q)return S}return h});},[h]),useEffect(()=>{if(!(!k||typeof window>"u"))try{localStorage.setItem(k,JSON.stringify({statusFilter:gt,hideCompleted:He}));}catch(S){console.error("Error persisting filter state:",S);}},[k,gt,He]);let Je=useMemo(()=>{let S=new Set;function Q(ue){for(let we of ue)we.subtasks?.length&&(we.isExpanded!==false&&S.add(we.id),Q(we.subtasks));}return Q(e),S},[e]),_e=useMemo(()=>ot.filter(S=>S.visible),[ot]),Rt=useCallback(S=>{r.onTaskToggleExpand?.(S);},[r]),Et=useCallback(S=>{De===S?tt(Q=>Q==="asc"?"desc":"asc"):(qe(S),tt("asc")),r.onSortChange?.({column:S,direction:fe==="asc"?"desc":"asc"});},[De,fe,r]),Nt=useCallback(S=>{Lt(S),r.onColumnsChange?.(S);},[r]),Cr=useCallback(S=>{let Q=ot.map(ue=>ue.id===S?{...ue,visible:false}:ue);Nt(Q);},[ot,Nt]),Aa=useCallback((S,Q)=>{qe(S),tt(Q);},[]),Ut=useCallback((S,Q,ue)=>{T&&(S.preventDefault(),q({isOpen:true,x:S.clientX,y:S.clientY,type:Q?"task":"header",task:Q,columnId:ue}));},[T]),$o=useCallback(()=>{q(S=>({...S,isOpen:false}));},[]),bn=useCallback((S,Q)=>{if(!w)return;S.preventDefault(),S.stopPropagation();let ue=ot.find(we=>we.id===Q);ue&&(le(Q),O(S.clientX),Te(ue.width));},[ot,w]);useEffect(()=>{if(!V)return;let S=ot,Q=we=>{let Ce=we.clientX-J,Oe=Math.max(50,Z+Ce);S=S.map(ie=>ie.id===V?{...ie,width:Oe}:ie),Lt(S);},ue=()=>{r.onColumnsChange?.(S),le(null);};return document.addEventListener("mousemove",Q),document.addEventListener("mouseup",ue),()=>{document.removeEventListener("mousemove",Q),document.removeEventListener("mouseup",ue);}},[V,J,Z,r]);let ws=useCallback((S,Q)=>{if(Q==="name"){S.preventDefault();return}ce(Q),S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",Q),S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="0.5");},[]),hn=useCallback(S=>{S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="1"),ce(null),ee(null);},[]),pi=useCallback((S,Q)=>{S.preventDefault(),Q!=="name"&&(S.dataTransfer.dropEffect="move",ee(Q));},[]),Kr=useCallback(()=>{ee(null);},[]),ks=useCallback((S,Q)=>{if(S.preventDefault(),!$||$===Q||Q==="name")return;let ue=[...ot],we=ue.findIndex(ie=>ie.id===$),Ce=ue.findIndex(ie=>ie.id===Q);if(we===-1||Ce===-1)return;let Oe=ue.splice(we,1);Oe[0]&&(ue.splice(Ce,0,Oe[0]),Nt(ue),ce(null),ee(null));},[$,ot,Nt]),Wa=useCallback(async S=>{if(r.onCreateCustomField){let Q={...S,id:`cf_${Date.now()}`,projectId:""};await r.onCreateCustomField(Q);}ae(false);},[r]),za=useCallback(S=>S.progress===100||S.status==="completed"?"completed":S.progress&&S.progress>0||S.status==="in-progress"?"in-progress":"todo",[]),Ia=useMemo(()=>{let S=C0(e);if(Be.trim()){let Q=Be.toLowerCase();S=S.filter(ue=>ue.name.toLowerCase().includes(Q));}if(gt!=="all"){let Q=new Set(S.filter(ue=>za(ue)===gt).flatMap(ue=>ue.parentPath));S=S.filter(ue=>Q.has(ue.id));}if(He){let Q=new Set(S.filter(ue=>za(ue)!=="completed").flatMap(ue=>ue.parentPath));S=S.filter(ue=>Q.has(ue.id));}return S.sort((Q,ue)=>{let we,Ce;switch(De){case "name":we=Q.name.toLowerCase(),Ce=ue.name.toLowerCase();break;case "startDate":we=Q.startDate?.getTime()||0,Ce=ue.startDate?.getTime()||0;break;case "endDate":we=Q.endDate?.getTime()||0,Ce=ue.endDate?.getTime()||0;break;case "progress":we=Q.progress||0,Ce=ue.progress||0;break;case "status":we=Q.status||"todo",Ce=ue.status||"todo";break;case "priority":let Oe={urgent:0,high:1,medium:2,low:3,none:4};we=Oe[Q.priority]??4,Ce=Oe[ue.priority]??4;break;case "position":return 0;default:return 0}return we<Ce?fe==="asc"?-1:1:we>Ce?fe==="asc"?1:-1:0}),S},[e,Be,gt,He,De,fe,za]);Yt.current=Ia;let Oo=useCallback((S,Q)=>{let ue=Oe=>{r.onTaskUpdate?.({...S,...Oe});},we=Oe=>Oe?S.customFields?.find(Re=>Re.fieldId===Oe)?.value:void 0,Ce=(Oe,ie)=>{if(!Oe)return;let Me=[...S.customFields||[]],st=Me.findIndex(Bt=>Bt.fieldId===Oe);st>=0?Me[st]={fieldId:Oe,value:ie}:Me.push({fieldId:Oe,value:ie}),ue({customFields:Me});};switch(Q.type){case "name":return null;case "status":return jsx(dg,{value:S.status||(S.progress===100?"completed":S.progress&&S.progress>0?"in-progress":"todo"),onChange:ie=>{ue({status:ie,progress:ie==="completed"?100:ie==="in-progress"?50:0});},isDark:W,locale:f,translations:j.status});case "priority":return jsx(pg,{value:S.priority,onChange:ie=>ue({priority:ie}),isDark:W,locale:f});case "assignees":{let ie=S.hasChildren,Re=S.assignees||[];if(ie&&S.subtasks?.length){let Me=new Map,st=Bt=>{(Bt||[]).forEach(dt=>{(dt.assignees||[]).forEach(ut=>{Me.has(ut.name)||Me.set(ut.name,ut);}),dt.subtasks?.length&&st(dt.subtasks);});};st(S.subtasks),Re=Array.from(Me.values());}else ie&&(Re=[]);return jsx(yd,{value:Re,availableUsers:c,onChange:Me=>ue({assignees:Me}),isDark:W,locale:f,disabled:ie})}case "startDate":return jsx(fl,{value:S.startDate,onChange:ie=>ue({startDate:ie}),isDark:W,locale:f,dateField:"start",startDate:S.startDate,endDate:S.endDate});case "endDate":return jsx(fl,{value:S.endDate,onChange:ie=>ue({endDate:ie}),isDark:W,locale:f,dateField:"end",startDate:S.startDate,endDate:S.endDate});case "progress":{let ie=!!(S.subtasks&&S.subtasks.length>0),Re=ie?w0(Rd(S.subtasks||[])):S.progress||0;return jsx(wg,{value:Re,onChange:ie?void 0:Me=>{let st=Me===100?"completed":Me>0?"in-progress":"todo";ue({progress:Me,status:st});},isDark:W,disabled:ie})}case "tags":return jsx(Ag,{value:S.tags||[],isDark:W});case "text":return jsx(Tg,{value:we(Q.customFieldId)||"",onChange:ie=>Ce(Q.customFieldId,ie),isDark:W});case "number":return jsx(Sg,{value:we(Q.customFieldId)||0,onChange:ie=>Ce(Q.customFieldId,ie),isDark:W});case "date":let Oe=we(Q.customFieldId);return jsx(fl,{value:Oe?new Date(Oe):void 0,onChange:ie=>Ce(Q.customFieldId,ie),isDark:W,locale:f});case "dropdown":return jsx(Eg,{value:we(Q.customFieldId)||"",options:Q.options||[],onChange:ie=>Ce(Q.customFieldId,ie),isDark:W});case "checkbox":return jsx(Pg,{value:we(Q.customFieldId)||false,onChange:ie=>Ce(Q.customFieldId,ie),isDark:W});case "estimatedTime":{let ie=S.status==="completed"||S.progress===100;return jsx(Fa,{value:S.estimatedTime,onChange:Re=>ue({estimatedTime:Re}),isDark:W,locale:f,disabled:ie,lens:N,hourlyRate:B(S)})}case "quotedTime":{let ie=S.status==="completed"||S.progress===100,Re=D?.enabled&&(!D.columns||D.columns.includes("quotedTime"));return jsx(Fa,{value:S.quotedTime,onChange:Me=>ue({quotedTime:Me}),isDark:W,locale:f,disabled:ie,isBlurred:Re,lens:N,hourlyRate:B(S)})}case "elapsedTime":{let ie=S.status==="completed"||S.progress===100,Re=S.executedDollarsCanonical;return jsx(Fa,{value:S.elapsedTime,onChange:Me=>ue({elapsedTime:Me}),isDark:W,locale:f,disabled:ie,lens:N,hourlyRate:B(S),financialOverride:Re})}case "effortMinutes":{if(te&&S.subtasks&&S.subtasks.length>0){let{allocated:Bt}=hs(S);if(N==="financial"){let dt=ve(S),ut=Math.round(dt.dollarAllocated),sr=Math.round(dt.dollarQuoted),hr=sr-ut;return jsxs("div",{className:"flex flex-col",children:[ut>0?jsxs("span",{className:g("text-sm font-mono",W?"text-white/60":"text-gray-500"),children:["$",ut.toLocaleString("es-CO")]}):null,hr!==0&&ut>0&&sr>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",hr>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[hr>0?"+":"",Math.abs(hr)>=1e3?`$${(hr/1e3).toFixed(1)}K`:`$${hr}`]})]})}return jsx(Fa,{value:Bt>0?Bt:void 0,isDark:W,locale:f,disabled:true,lens:N,hourlyRate:K})}let ie=S.status==="completed"||S.progress===100,Re=S.effortMinutes||0,Me=S.soldEffortMinutes||0,st=B(S);if(N==="financial"&&st&&Re>0&&Me>0){let Bt=Math.round(Re/60*st),ut=Math.round(Me/60*st)-Bt;return jsxs("div",{className:"flex flex-col",children:[jsx(Fa,{value:Re,onChange:sr=>ue({effortMinutes:sr}),isDark:W,locale:f,disabled:ie,lens:N,hourlyRate:B(S)}),ut!==0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",ut>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[ut>0?"+":"",Math.abs(ut)>=1e3?`$${(ut/1e3).toFixed(1)}K`:`$${ut}`]})]})}return jsx(Fa,{value:Re,onChange:Bt=>ue({effortMinutes:Bt}),isDark:W,locale:f,disabled:ie,lens:N,hourlyRate:B(S)})}case "timeLoggedMinutes":{let ie=S.executedDollarsCanonical;if(te&&S.subtasks&&S.subtasks.length>0){let{spent:Me}=hs(S);return jsx(Fa,{value:Me>0?Me:void 0,isDark:W,locale:f,disabled:true,lens:N,hourlyRate:B(S),financialOverride:ie})}let Re=S.status==="completed"||S.progress===100;return jsx(Fa,{value:S.timeLoggedMinutes,onChange:r.onLogTime?Me=>{r.onLogTime?.(S,Me);}:void 0,isDark:W,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:Re,lens:N,hourlyRate:B(S),financialOverride:ie})}case "soldEffortMinutes":{if(te&&S.subtasks&&S.subtasks.length>0){let{quoted:Me}=hs(S),st=D?.enabled&&(!D.columns||D.columns.includes("soldEffortMinutes"));return jsx(Fa,{value:Me>0?Me:void 0,isDark:W,locale:f,disabled:true,isBlurred:st,lens:N,hourlyRate:B(S)})}let ie=S.status==="completed"||S.progress===100,Re=D?.enabled&&(!D.columns||D.columns.includes("soldEffortMinutes"));return jsx(Fa,{value:S.soldEffortMinutes,onChange:Me=>ue({soldEffortMinutes:Me}),isDark:W,locale:f,disabled:ie,isBlurred:Re,lens:N,hourlyRate:B(S)})}case "scheduleVariance":{let ie=S.effortMinutes||0,Re=S.soldEffortMinutes||0,Me=S.timeLoggedMinutes||0,st=ie>0||Re>0||Me>0;return jsx($g,{startDate:S.startDate,endDate:S.endDate,scheduleVariance:S.scheduleVariance,isDark:W,locale:f,hasTimeAllocated:st})}case "hoursBar":{if(te&&S.hasChildren){let{spent:ie,allocated:Re,quoted:Me}=hs(S),st=ie>Re&&Re>0;return jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",W?"text-white/50":"text-gray-500"),children:[jsx("span",{className:g("font-bold",st?"text-[#FF453A]":W?"text-white/80":"text-gray-800"),children:bs(ie)}),Re>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:W?"text-white/60":"text-gray-600",children:bs(Re)})]}),Me>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:W?"text-amber-400/70":"text-amber-600",children:bs(Me)})]})]})}return jsx(Hg,{task:S,isDark:W,locale:f,onLogTime:r.onLogTime,onEstimateUpdate:r.onEstimateUpdate,onSoldEffortUpdate:r.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:r.onOpenTimeLog,lens:N,hourlyRate:B(S)})}case "teamLoad":return S.hasChildren||S.subtasks&&S.subtasks.length>0?jsx(Wg,{task:S,isDark:W,locale:f}):jsx(yd,{value:S.assignees||[],availableUsers:c,onChange:Re=>{r.onTaskUpdate?.({...S,assignees:Re});},isDark:W,locale:f});case "blockers":return jsx(Gg,{blockers:S.blockers,isDark:W,locale:f});case "weight":{let ie=be.get(S.id);if(ie!==void 0)return jsx("span",{className:g("text-xs font-mono",ie>0?W?"text-white/50":"text-gray-400":W?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:ie>0?`${Number(ie.toFixed(2))}%`:"\u2014"});let Re=S.weight||0;return jsx(I1,{value:Re,onChange:Me=>ue({weight:Me}),isDark:W})}default:return jsx("span",{className:g("text-sm",W?"text-white/60":"text-gray-500"),children:"-"})}},[r,W,f,c,j,te,be]),Vn=useCallback(S=>{let ue={name:j.columns.name,status:j.columns.status,priority:j.columns.priority,assignees:j.columns.assignees,startDate:j.columns.startDate,endDate:j.columns.endDate,progress:j.columns.progress,tags:j.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:j.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:j.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:j.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:j.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:j.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:j.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:j.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:j.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:j.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:j.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:j.columns.weight||(f==="es"?"Peso":"Weight")}[S.type]||S.label;return typeof ue=="string"?ue:String(ue||S.type)},[j,f]),mo=useMemo(()=>{let ue=_e.reduce((Ce,Oe)=>Ce+Oe.width,0)+(v?48:0),we={};for(let Ce of _e)we[Ce.id]=`${Ce.width/ue*100}%`;return we},[_e,v]);return a?jsx("div",{className:g("flex-1 flex items-center justify-center",W?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#00E5CC]"}),jsxs("p",{className:g("text-sm",W?"text-white/60":"text-gray-600"),children:[j.empty.noTasks,"..."]})]})}):n?jsx("div",{className:g("flex-1 flex items-center justify-center",W?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:g("text-lg font-semibold mb-2",W?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:g("text-sm",W?"text-white/60":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsx("div",{className:g("flex-1 flex items-center justify-center",W?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#00E5CC]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#00E5CC]"})}),jsx("h3",{className:g("text-lg font-semibold mb-2",W?"text-white":"text-gray-900"),children:j.empty.noTasks}),jsx("p",{className:g("text-sm",W?"text-white/60":"text-gray-600"),children:j.empty.addFirstTask})]})}):jsxs("div",{ref:C,className:g(W?"bg-[#0D0D0D]":"bg-white",V&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[jsx("div",{className:g("flex-shrink-0 px-6 py-4 border-b",W?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:g("text-sm",W?"text-white/60":"text-gray-600"),children:[Ia.length," ",j.pagination.tasks]}),y&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:g("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",W?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:Be,onChange:S=>$e(S.target.value),placeholder:j.toolbar.searchPlaceholder,className:g("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",W?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),i&&jsx("div",{className:"flex items-center gap-2",children:i}),b&&it>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:pt,onClick:()=>pe(!ne),className:g("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",W?ne?"bg-[#00E5CC]/10 border-[#00E5CC]/40 text-[#00E5CC]":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":ne?"bg-[#00E5CC]/15 border-[#00E5CC] text-[#00C4AE]":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsx(Layers,{className:"w-3.5 h-3.5"}),Xt==="all"?f==="es"?"Todos":"All":`L${Xt}`]}),ne&&jsx("div",{ref:je,className:g("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",W?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(it,5)},(S,Q)=>({value:Q+1,label:`L${Q+1}`}))].map(S=>jsxs("button",{onClick:()=>{Zr(S.value),pe(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",W?Xt===S.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":Xt===S.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:S.label}),Xt===S.value&&jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(S.value)))})]}),jsx(m0,{value:gt,hideCompleted:He,onChange:Ft,onHideCompletedChange:Ae,isDark:W,locale:f}),ge?.enabled&&ge.data&&!ye&&jsx("button",{onClick:()=>ze(true),className:g("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",W?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:f==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,E&&F&&jsxs(motion.button,{onClick:F,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #00E5CC 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:j.toolbar.newTask})]})]})}),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:g("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",W?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[br&&jsx("div",{className:"w-5 flex-shrink-0"}),_e.map(S=>{let Q=S.id!=="name",ue=xe===S.id&&$!==S.id;return jsxs("div",{className:g("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",W?"text-white/60":"text-gray-500",Q&&"cursor-grab",S.type!=="name"&&"justify-center",$===S.id&&"opacity-50",ue&&(W?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:mo[S.id],minWidth:S.minWidth},draggable:Q,onDragStart:Q?we=>ws(we,S.id):void 0,onDragEnd:Q?hn:void 0,onDragOver:Q?we=>pi(we,S.id):void 0,onDragLeave:Q?Kr:void 0,onDrop:Q?we=>ks(we,S.id):void 0,onContextMenu:we=>Ut(we,void 0,S.id),children:[Q&&jsx(GripVertical,{className:g("w-3 h-3 flex-shrink-0 transition-opacity",W?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),d?jsxs("button",{draggable:false,onClick:we=>{let Ce=we.currentTarget.getBoundingClientRect();d(S.id,Ce);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[Vn(S),u?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:p,display:"inline-block",flexShrink:0}}),De===S.id&&jsx(ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):S.sortable?jsxs("button",{draggable:false,onClick:()=>Et(S.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[Vn(S),u?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:p,display:"inline-block",flexShrink:0}}),jsx(ArrowUpDown,{className:g("w-3 h-3",De===S.id&&"text-[#00E5CC]")})]}):jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[Vn(S),u?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:p,display:"inline-block",flexShrink:0}})]}),w&&S.resizable&&jsx("div",{className:g("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#00E5CC]",V===S.id&&"bg-[#00E5CC]"),onMouseDown:we=>bn(we,S.id)})]},S.id)}),v&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:S=>{S.stopPropagation(),Xe(Q=>!Q);},className:g("p-0.5 rounded transition-colors",W?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",Fe&&(W?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(s0,{isOpen:Fe,onClose:()=>Xe(false),columns:ot,customFields:l,onColumnsChange:Nt,onCreateCustomField:()=>{Xe(false),ae(true);},isDark:W,locale:f})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Ia.map((S,Q)=>{let ue=Je.has(S.id),we=Math.min(Q*.01,.2),Ce=S.hasChildren&&S.level===0,Oe=S.subtasks?.length||0;if(Ce){let{spent:dt,allocated:ut,quoted:sr}=hs(S),hr=A1(S);return jsxs(motion.div,{"data-task-id":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:we},className:g("flex items-center border-y cursor-pointer transition-colors duration-500",W?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",ke===S.id&&(W?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>r.onTaskClick?.(S),children:[br&&jsx("div",{className:"w-5 flex-shrink-0"}),_e.map(Gr=>jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",Gr.type!=="name"&&"justify-center"),style:{width:mo[Gr.id],minWidth:Gr.minWidth},children:Gr.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{onClick:$t=>{$t.stopPropagation(),Rt(S.id);},className:g("p-0.5 rounded flex-shrink-0 mt-0.5",W?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ue?jsx(ChevronDown,{className:g("w-4 h-4",W?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:g("w-4 h-4",W?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:$t=>{$t.stopPropagation(),Rt(S.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:ue?jsx(FolderOpen,{className:"w-4 h-4",style:{color:W?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:W?"#FFD60A":"#B45309"}})}),S.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:W?"#FFD60A":"#B45309"},children:S.wbsCode}),jsxs("div",{className:"flex flex-col min-w-0",children:[jsx("span",{className:g("text-[13px] font-bold uppercase tracking-wide",W?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:S.name}),jsxs("span",{className:g("text-[10px] font-mono",W?"text-white/30":"text-gray-500"),children:["(",Oe," ",f==="es"?Oe===1?"Tarea":"Tareas":Oe===1?"Item":"Items",")"]}),hr!==null&&jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",hr>=1?"text-[#32D74B] bg-[#32D74B]/10":hr>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",hr.toFixed(2)]})]})]}):Gr.type==="timeLoggedMinutes"?N==="financial"?(()=>{let $t=S.executedDollarsCanonical,Jt=$t!=null?Math.round($t):Math.round(ve(S).dollarSpent);return Jt>0?jsxs("span",{className:g("text-sm font-mono",W?"text-white/60":"text-gray-500"),children:["$",Jt.toLocaleString("en-US")]}):null})():jsx(Fa,{value:dt>0?dt:void 0,isDark:W,locale:f,disabled:true,lens:N,hourlyRate:B(S)}):Gr.type==="soldEffortMinutes"?N==="financial"?(()=>{let $t=ve(S),Jt=Math.round($t.dollarQuoted);return Jt>0?jsxs("span",{className:g("text-sm font-mono",W?"text-white/60":"text-gray-500"),children:["$",Jt.toLocaleString("en-US")]}):null})():jsx(Fa,{value:sr>0?sr:void 0,isDark:W,locale:f,disabled:true,lens:N,hourlyRate:B(S)}):Gr.type==="effortMinutes"?N==="financial"?(()=>{let $t=ve(S),Jt=Math.round($t.dollarAllocated),Ct=Math.round($t.dollarQuoted),ft=Ct-Jt;return jsxs("div",{className:"flex flex-col",children:[Jt>0?jsxs("span",{className:g("text-sm font-mono",W?"text-white/60":"text-gray-500"),children:["$",Jt.toLocaleString("es-CO")]}):null,ft!==0&&Jt>0&&Ct>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",ft>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[ft>0?"+":"",Math.abs(ft)>=1e3?`$${(ft/1e3).toFixed(1)}K`:`$${ft}`]})]})})():jsx(Fa,{value:ut>0?ut:void 0,isDark:W,locale:f,disabled:true,lens:N,hourlyRate:B(S)}):Oo(S,Gr)},Gr.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)}let ie=U===S.id,Re=et===S.id,Me=Re&&Qe==="above",st=Re&&Qe==="below",Bt=Re&&Qe==="child";return jsxs(motion.div,{"data-task-id":S.id,"data-listview-row":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:we},className:g("flex items-center border-b transition-colors relative group",W?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",ke===S.id&&(W?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:ie?.4:1,backgroundColor:Bt?W?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:Bt?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>r.onTaskClick?.(S),onDoubleClick:()=>r.onTaskDoubleClick?.(S),onContextMenu:dt=>Ut(dt,S),onMouseEnter:()=>qt(S.id),onMouseLeave:()=>qt(dt=>dt===S.id?null:dt),children:[Me&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),st&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),br&&jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:dt=>tr(S.id,dt),style:{color:W?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),_e.map(dt=>{let ut=!!(S.subtasks&&S.subtasks.length>0),sr=Lr(dt.type),Gr=!!sr&&!ut&&da===S.id&&!gr,$t=!!gr&&!!sr&&gr.column===sr&&ua(S.id);return jsxs("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",dt.type!=="name"&&"justify-center"),style:{width:mo[dt.id],minWidth:dt.minWidth,position:"relative",backgroundColor:$t?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:$t?"inset 0 0 0 1px rgba(0, 229, 204, 0.45)":void 0},children:[dt.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&S.level>0&&jsx("div",{style:{width:`${S.level*24}px`},className:"flex-shrink-0"}),b&&S.hasChildren&&jsx("button",{onClick:Jt=>{Jt.stopPropagation(),Rt(S.id);},className:g("p-0.5 rounded flex-shrink-0",W?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ue?jsx(ChevronDown,{className:g("w-4 h-4",W?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:g("w-4 h-4",W?"text-white/60":"text-gray-400")})}),b&&!S.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(S.wbsCode||S.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[S.wbsCode&&jsx("span",{className:g("text-[10px] font-mono",W?"text-[#00E5CC]":"text-[#00C4AE]"),children:S.wbsCode}),S.taskCode&&jsx("span",{className:g("text-[10px] font-mono",W?"text-white/40":"text-gray-400"),children:S.taskCode})]}),jsx("span",{className:g("truncate",S.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",S.progress===100?W?"line-through text-white/50":"line-through text-gray-400":S.hasChildren?W?"text-white":"text-gray-900":W?"text-[#D1D5DB]":"text-gray-600"),children:S.name}),S.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${S.tags[0].color}20`,color:S.tags[0].color},children:S.tags[0].name})]})]}):Oo(S,dt),Gr&&sr&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Jt=>Ye(Jt,S.id,sr,Q),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:"#00E5CC",border:"1px solid rgba(0,0,0,0.3)",cursor:"crosshair",zIndex:5}})]},dt.id)}),v&&jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)})}),I&&Ia.length>0&&(()=>{let{spent:S,allocated:Q,quoted:ue}=Le,we=Q-S,Ce=we<0,Oe=Ce?`+${bs(Math.abs(we))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${bs(we)} ${f==="es"?"AHORRADO":"SAVED"}`,ie=N==="financial"&&K>0,Re=_?.breakdown,Me=!!Re&&((Re.equipment??0)>0||(Re.travel??0)>0),st=Re?.laborSpent!=null?Re.laborSpent:_?.spent!=null?_.spent:Le.dollarSpent,Bt=Re?.laborAllocated!=null?Re.laborAllocated:_?.allocated!=null?_.allocated:Le.dollarAllocated,dt=_?.quoted!=null?_.quoted:Le.dollarQuoted,ut=($t,Jt)=>{if(ie){let Ct=Jt??$t/60*K;return `$${Math.round(Ct).toLocaleString("es-CO")}`}return bs($t)},sr=ie?Math.abs(Bt-st):0,hr=ie?`+$${sr.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Ce?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:Oe,Gr=ie&&Me?f==="es"?"solo mano de obra":"labor only":void 0;return jsxs("div",{className:g("flex items-center sticky bottom-0 z-[5]",W?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:W?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[br&&jsx("div",{className:"w-5 flex-shrink-0"}),_e.map($t=>jsx("div",{className:g("flex items-center px-4 py-3",$t.type!=="name"&&"justify-center"),style:{width:mo[$t.id],minWidth:$t.minWidth},children:$t.type==="name"?jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:g("text-[11px] font-black uppercase tracking-widest",W?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),Gr&&jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",W?"text-white/35":"text-gray-400"),children:[jsx(Info,{className:"w-2.5 h-2.5"}),Gr]})]}):$t.type==="hoursBar"?jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:g("text-[12px] font-bold",W?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ut(S,ie?st:void 0)}),jsx("span",{className:g("text-[11px]",W?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:g("text-[11px]",W?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:ut(Q,ie?Bt:void 0)})]}),Q>0&&jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Ce?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:ie?hr:Oe})]}):$t.type==="soldEffortMinutes"?jsx("span",{className:g("text-[12px] font-bold",W?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ue>0?ut(ue,ie?dt:void 0):"\u2013"}):$t.type==="effortMinutes"?(()=>{if(ie&&ue>0&&Q>0){let Jt=Math.round(dt),Ct=Math.round(Bt),ft=Jt-Ct,Ar=Jt>0?Math.round(ft/Jt*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:g("text-[12px] font-bold",W?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ut(Q,Bt)}),jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",ft>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[ft>=0?"+":"",Math.abs(ft)>=1e3?`$${(ft/1e3).toFixed(1)}K`:`$${ft}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Ar,"%)"]})]})]})}return jsx("span",{className:g("text-[12px] font-bold",W?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Q>0?ut(Q,ie?Bt:void 0):"\u2013"})})():$t.type==="timeLoggedMinutes"?jsx("span",{className:g("text-[12px] font-bold",W?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:S>0?ut(S,ie?st:void 0):"\u2013"}):$t.type==="progress"?(()=>{let Jt=w0(Rd(e||[]));return jsxs("span",{className:g("text-[12px] font-bold font-mono",W?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Jt,"%"]})})():$t.type==="weight"?(()=>{let Jt=e||[],Ct=[],ft=pa=>{for(let qr of pa)Ct.push(qr),qr.subtasks?.length&&ft(qr.subtasks);};ft(Jt);let ga=Ct.filter(pa=>!pa.subtasks?.length||pa.subtasks.length===0).reduce((pa,qr)=>pa+(qr.weight||0),0),xa=Math.abs(ga-100)<.1;return jsxs("span",{className:g("text-[12px] font-bold font-mono",xa?W?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(ga.toFixed(1)),"%"]})})():jsx("span",{className:g("text-[11px]",W?"text-white/30":"text-gray-300"),children:"\u2013"})},$t.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Ia.length===0&&Be&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:g("w-12 h-12 mx-auto mb-4",W?"text-white/30":"text-gray-400")}),jsx("p",{className:g(W?"text-white/60":"text-gray-600"),children:j.empty.noResults})]})})]})}),ge?.enabled&&ge.data&&ye&&jsx(f0,{data:ge.data,isDark:W,locale:f,onClose:()=>ze(false),lens:t?.lens,onUnassignedTaskClick:S=>{let Q=document.querySelector(`[data-task-id="${S}"]`);Q&&(Q.scrollIntoView({behavior:"smooth",block:"center"}),Ie(S),setTimeout(()=>Ie(null),2e3));}})]}),jsx(Xg,{state:R,onClose:$o,isDark:W,locale:f,onTaskEdit:r.onTaskEdit,onTaskDuplicate:r.onTaskDuplicate,onTaskDelete:r.onTaskDelete,onTaskUpdate:r.onTaskUpdate,onColumnHide:Cr,onColumnSort:Aa,availableUsers:c,onOpenTimeLog:r.onOpenTimeLog,onReportBlocker:r.onReportBlocker,onCopyTaskLink:r.onCopyTaskLink,onTaskMove:r.onTaskMove,onTaskIndent:r.onTaskIndent,onTaskOutdent:r.onTaskOutdent}),Se&&kt&&U&&createPortal(jsx("div",{style:{position:"fixed",left:kt.x+12,top:kt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let Q=Ne.flattenTasks(e).find(ue=>ue.id===U);return Q?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:W?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${W?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsx(GripVertical,{className:"w-3 h-3",style:{color:"#00E5CC"}}),jsx("span",{className:"text-xs font-medium",style:{color:W?"#e6edf3":"#111827"},children:Q.name})]}):null})()}),document.body),jsx(c0,{isOpen:L,onClose:()=>ae(false),onSave:Wa,isDark:W,locale:f})]})}var N0=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],D0=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"},{type:"effortMinutes",labelKey:"columns.effortMinutes",icon:"Clock"},{type:"timeLoggedMinutes",labelKey:"columns.timeLoggedMinutes",icon:"Timer"},{type:"soldEffortMinutes",labelKey:"columns.soldEffortMinutes",icon:"FileText"},{type:"scheduleVariance",labelKey:"columns.scheduleVariance",icon:"CalendarClock"},{type:"hoursBar",labelKey:"columns.hoursBar",icon:"BarChart3"},{type:"teamLoad",labelKey:"columns.teamLoad",icon:"Users"},{type:"blockers",labelKey:"columns.blockers",icon:"AlertTriangle"},{type:"weight",labelKey:"columns.weight",icon:"Scale"}],S0=[{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 Bd={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#00E5CC",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#00E5CC",statusCompleted:"#34D399",focusRing:"#00E5CC",checkboxBg:"#1A1A1A",checkboxChecked:"#00E5CC",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},$d={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#00E5CC"},Od={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},Cl={dark:Bd,light:$d,neutral:Od};function E0(e){return Cl[e]||Cl.dark}function Tl(e,t,r,a,n=5){let s=[],o=[],c=e.filter(m=>m.endSerial>=r&&m.startSerial<=a).sort((m,f)=>m.startSerial-f.startSerial||f.endSerial-m.endSerial);for(let m of c){let f=Math.max(m.startSerial,r),x=Math.min(m.endSerial,a),y=0;for(;(s[y]||[]).some(([b,h])=>!(x<b||f>h));)y++;(s[y]=s[y]||[]).push([f,x]),o.push({t:m,s:f,e:x,lane:y,contL:m.startSerial<r,contR:m.endSerial>a});}let l={};for(let m=r;m<=a;m++)l[m]=new Set;o.forEach(m=>{for(let f=m.s;f<=m.e;f++)l[f].add(m.lane);});let i=[],d=[],u={};t.filter(m=>m.serial>=r&&m.serial<=a).forEach(m=>{(u[m.serial]=u[m.serial]||[]).push(m);}),Object.keys(u).forEach(m=>{let f=+m,x=u[f],y=[];for(let b=0;b<n;b++)l[f].has(b)||y.push(b);if(x.length<=y.length)x.forEach((b,h)=>i.push({it:b,day:f,lane:y[h]}));else {let b=Math.max(y.length-1,0);x.slice(0,b).forEach((h,v)=>i.push({it:h,day:f,lane:y[v]})),d.push({day:f,lane:y[b]!=null?y[b]:n-1,count:x.length-b,items:x.slice(b)});}});let p=s.length;return i.forEach(m=>{p=Math.max(p,m.lane+1);}),d.forEach(m=>{p=Math.max(p,m.lane+1);}),{bars:o,chips:i,more:d,laneCount:Math.max(p,1)}}var R1=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],B1=["MON","TUE","WED","THU","FRI","SAT","SUN"];function M0(e){return e==="es"?R1:B1}function P0(e){return (e.getDay()+6)%7}function F0(e,t){let r=new Date(e,t,1),a=P0(r),n=new Date(e,t,1-a),s=[];for(let u=0;u<6;u++)s.push({ws:u*7+1,we:u*7+7});let o=u=>{let p=new Date(n);return p.setDate(n.getDate()+(u-1)),p},c=u=>{let p=u.getTime()-n.getTime();return Math.floor(p/864e5)+1},l=c(r),i=new Date(e,t+1,0),d=c(i);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:c,monthStartSerial:l,monthEndSerial:d}}function ai(e,t){return P0(e.serialToDate(t))>=5}function $1(e){let t=[],r=(a,n,s)=>{for(let o of a){let c=n||o.id,l=s||o.name;t.push({t:o,phaseId:c,phaseName:l}),o.subtasks?.length&&r(o.subtasks,c,l);}};return r(e,"",""),t}function L0(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function A0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Nl(e){let{tasks:t,grid:r,projectColor:a,hourlyRate:n,projectId:s}=e,o=$1(t),c=42,l=[];for(let{t:d,phaseId:u,phaseName:p}of o){let m=L0(d.startDate),f=L0(d.endDate);if(!m||!f)continue;let x=r.dateToSerial(m),y=r.dateToSerial(f);if(y<1||x>c)continue;let b=d.effortMinutes??0,h=Math.round(b/60*10)/10,v=d.costAtCompletion,w=v!=null?A0(v):A0(h*n),T=d.assignees?.[0],E=T?.initials||(T?.name?U1(T.name):void 0),F=d.displayId||d.wbsCode||"",k=H1(F||d.id)?"":F||d.id;l.push({uid:d.id,id:k,name:d.name,projectId:s,startSerial:Math.max(x,1),endSerial:Math.min(y,c),hrs:h,cost:w,critical:!!d.isCriticalPath,who:E,realStart:m,realEnd:f,phaseId:u,phaseName:p});}let i=[];return {calTasks:l,dayItems:i,isEmpty:l.length===0&&i.length===0}}var O1=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function H1(e){return O1.test(e)||/^task-\d+/.test(e)}function U1(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}var W1=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],z1=["January","February","March","April","May","June","July","August","September","October","November","December"];function I0(e,t,r){return `${(r==="es"?W1:z1)[t]} ${e}`}var Hd=26,G1={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Dl({locale:e}){let t=M0(e);return jsx("div",{className:"cal-dow",children:t.map((r,a)=>jsx("div",{className:a>=5?"wknd":"",children:r},r))})}function Sl({bar:e,ws:t,money:r,projColor:a,slotH:n=Hd}){let{t:s}=e,o=e.s-t,c=e.e-e.s+1,l="cal-bar"+(s.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":""),i=r==="$"?s.cost:`${s.hrs}h`,d={"--proj":a,left:`calc(${o}/7*100% + 3px)`,width:`calc(${c}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxs("div",{className:l,style:d,children:[s.critical&&c>=3?jsx("span",{className:"cpm-tag",children:"CPM"}):null,s.id?jsx("span",{className:"tk",children:s.id}):null,jsx("span",{className:"nom",children:s.name}),c>=3?jsx("span",{className:"val",children:i}):null]})}function El({chip:e,ws:t,slotH:r=Hd}){let a=e.day-t,n=`cal-chip ${e.it.type}`,s={left:`calc(${a}/7*100% + 3px)`,width:"calc(1/7*100% - 6px)",top:`${e.lane*r}px`};return jsxs("div",{className:n,style:s,children:[jsx("span",{className:"ico",children:G1[e.it.type]}),jsx("span",{className:"lbl2",children:e.it.label})]})}function Ml({more:e,ws:t,slotH:r=Hd,onClick:a}){let s={left:`calc(${e.day-t}/7*100% + 3px)`,top:`${e.lane*r}px`};return jsxs("div",{className:"cal-more",style:s,role:a?"button":void 0,tabIndex:a?0:void 0,onClick:a?()=>a(e):void 0,children:["+",e.count," m\xE1s"]})}function R0({projects:e}){return jsxs("div",{className:"cal-legend",children:[e.map(t=>jsxs("span",{children:[jsx("span",{className:"dot",style:{background:t.color}}),t.id?`${t.id} `:"",t.name]},t.id||t.name)),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," Ruta cr\xEDtica"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," Hito / Desembolso"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," Vencimiento"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," Evento externo"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," Ausencia"]})]})}var K1=[{id:"mes",lbl:"Mes",key:"M"},{id:"semana",lbl:"Semana",key:"W"},{id:"lookahead",lbl:"Lookahead",key:"2"},{id:"agenda",lbl:"Agenda",key:"A"}];function B0({view:e,onViewChange:t,money:r,onMoneyChange:a,projectLabel:n}){return jsxs("div",{className:"cal-topbar",children:[jsxs("div",{className:"cal-projsel",children:[n,jsx("span",{className:"caret",children:"\u25BE"})]}),jsx("div",{className:"cal-spacer"}),jsx("div",{className:"cal-seg",children:K1.map(s=>jsxs("button",{type:"button",className:e===s.id?"on":"",onClick:()=>t(s.id),children:[s.lbl,jsx("span",{className:"key",children:s.key})]},s.id))}),jsxs("div",{className:"cal-seg",children:[jsx("button",{type:"button",className:r==="$"?"":"on",onClick:()=>a("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:r==="$"?"on":"",onClick:()=>a("$"),children:"$"})]})]})}function $0({monthLabel:e,onPrev:t,onNext:r,onToday:a,layersOpen:n,onToggleLayers:s,layersOff:o,phases:c,phaseFilter:l="all",onPhaseChange:i,locale:d="es",children:u}){let p=o?o.length:0,[m,f]=useState(false),x=useRef(null),y=d==="es";useEffect(()=>{if(!m)return;let h=v=>{x.current&&!x.current.contains(v.target)&&f(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[m]);let b=l==="all"?y?"Todas":"All":c?.find(h=>h.id===l)?.name??(y?"Todas":"All");return jsxs("div",{className:"cal-toolbar",children:[jsxs("div",{className:"cal-nav-arrows",children:[jsx("button",{type:"button",onClick:t,"aria-label":"Periodo anterior",children:"\u2039"}),jsx("button",{type:"button",onClick:r,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsx("div",{className:"cal-month-label",children:e}),jsx("button",{type:"button",className:"cal-hoy",onClick:a,children:y?"Hoy":"Today"}),jsx("div",{className:"cal-vsep"}),c&&c.length>0&&i?jsxs("div",{className:"relative",ref:x,style:{position:"relative"},children:[jsxs("button",{type:"button",className:"cal-ftog",onClick:()=>f(h=>!h),style:l!=="all"?{borderColor:"var(--cyan)",color:"var(--cyan)"}:void 0,children:[jsx("b",{children:y?"Fase":"Phase"})," ",b," \u25BE"]}),m?jsxs("div",{className:"cal-pop",style:{position:"absolute",top:"36px",left:0,zIndex:40,width:240,maxHeight:320,overflowY:"auto"},children:[jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:l==="all"?"var(--cyan)":"var(--txt)"},onClick:()=>{i("all"),f(false);},children:jsx("span",{className:"nm",children:y?"Todas las fases":"All phases"})}),c.map(h=>jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:l===h.id?"var(--cyan)":"var(--txt)"},onClick:()=>{i(h.id),f(false);},children:jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.name})},h.id))]}):null]}):null,u,jsx("div",{className:"cal-toolbar-right",children:jsxs("button",{type:"button",className:"cal-layers-btn"+(n?" open":""),onClick:s,children:["\u25E7 ",y?"Capas":"Layers"," ",jsxs("span",{className:"n",children:[6-p,"/6"]})]})})]})}var q1=[{id:"tareas",nm:"Tareas",sub:"Barras del Gantt",sw:"var(--p26011)"},{id:"cpm",nm:"Ruta cr\xEDtica",sub:"CPM \xB7 borde cian",sw:"var(--cyan)"},{id:"hitos",nm:"Milestones / Desembolsos",sub:"Rombo cian",sw:"var(--cyan)"},{id:"ext",nm:"Eventos externos",sub:"Google / Outlook \xB7 lectura",sw:"var(--subtle)"},{id:"festivos",nm:"Festivos",sub:"Calendario Colombia",sw:"var(--subtle)"},{id:"aus",nm:"Ausencias del equipo",sub:"Vacaciones \xB7 permisos",sw:"var(--orange)"}];function O0({off:e,onToggle:t}){let r=e||[];return jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:q1.map(a=>{let n=r.includes(a.id);return jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(a.id),children:[jsx("span",{className:"sw",style:{background:a.sw,opacity:n?.3:1}}),jsxs("div",{children:[jsx("div",{className:"nm",children:a.nm}),jsx("div",{className:"sub",children:a.sub})]}),jsx("span",{className:"cal-switch"+(n?"":" on")})]},a.id)})})}var J1={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},Q1={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function U0({dayLabel:e,items:t,tasks:r=[],itemValue:a,onClose:n,style:s}){let o=useRef(null);useEffect(()=>{function d(p){o.current&&!o.current.contains(p.target)&&n();}function u(p){p.key==="Escape"&&n();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",u);}},[n]);let c=r.length+t.length,i=a||(d=>{switch(d.type){case "hito":return "Hito";case "desembolso":return "Desemb.";case "deadline":return "Vence";case "aus":return "Ausencia";case "ext":default:return ""}});return jsxs("div",{ref:o,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${c} elementos`,children:[jsx("div",{className:"cal-pop-head",children:jsxs("div",{className:"sup",children:[e," \xB7 ",c," ",c===1?"elemento":"elementos"]})}),jsxs("div",{className:"cal-pop-list",children:[r.map((d,u)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"sw",style:{background:d.swatch}}),d.taskId?jsx("span",{className:"tk",children:d.taskId}):null,jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),d.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:"8px",letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:"3px",padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,jsx("span",{className:"v",children:d.value})]},`t${u}`)),t.map((d,u)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"ico",style:{color:Q1[d.type]},children:J1[d.type]}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsx("span",{className:"v",children:i(d)})]},`i${u}`)),jsx("div",{className:"cal-scrollbar"})]})]})}var H0={es:{title:"Sin tareas programadas este mes",upcoming:"Pr\xF3ximos hitos"},en:{title:"No tasks scheduled this month",upcoming:"Upcoming milestones"}};function W0({monthLabel:e,upcomingMilestones:t=[],locale:r="es"}){let a=H0[r]||H0.es,n=r!=="en";return jsxs("div",{className:"cal-empty",children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:a.title}),n?jsxs("p",{children:["Arrastra tareas del ",jsx("b",{children:"backlog"})," o cr\xE9alas en el ",jsx("b",{children:"Gantt"}),".",jsx("br",{}),"El plan CPM proyectar\xE1 aqu\xED lo que toque ejecutar en ",jsx("b",{children:e}),"."]}):jsxs("p",{children:["Drag tasks from the ",jsx("b",{children:"backlog"})," or create them in the ",jsx("b",{children:"Gantt"}),".",jsx("br",{}),"The CPM plan will project here what needs running in ",jsx("b",{children:e}),"."]}),t.length>0?jsxs("div",{className:"cal-empty-hitos",children:[jsx("div",{className:"hd",children:a.upcoming}),t.map((s,o)=>jsxs("div",{className:"cal-empty-hito",children:[jsx("span",{className:"ic "+(s.type==="deadline"?"rd":"cy"),children:s.type==="deadline"?"\u2691":"\u25C6"}),s.label,jsx("span",{className:"d",children:s.date})]},o))]}):null]})}function G0(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function tC(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}var z0=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function rC(e){return z0[e%z0.length]}function aC(e){return e>1?"over":e>=.9?"warn":"ok"}var Ud="\xA0";function Fo(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function V0(e,t,r){let a=new Map,n=new Set;for(let c of t)c.isWeekend||c.isHoliday||n.add(G0(c.date));if(n.size===0)return a;let s=new Map;e.forEach((c,l)=>{s.set(c.userId,{color:rC(l),initials:tC(c.name)});});let o=new Map;for(let c of e)for(let l of c.dailyEstimated){if(!l.date||!n.has(l.date))continue;o.has(l.date)||o.set(l.date,new Map);let i=o.get(l.date);i.set(c.userId,(i.get(c.userId)??0)+(l.hours||0));}for(let c of n){let l=o.get(c)??new Map,i=e.map(u=>{let p=s.get(u.userId);return {name:u.name,initials:p.initials,color:p.color,hours:Math.round((l.get(u.userId)??0)*100)/100,capacity:r}}),d=i.reduce((u,p)=>u+p.hours,0);a.set(c,{assigned:Math.round(d*100)/100,capacity:r*e.length,perPerson:i});}return a}function j0({days:e,capByDay:t,selectedKey:r,onSelectDay:a}){return jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=G0(n.date),o=n.isWeekend||n.isHoliday,c=o?void 0:t.get(s),l=!!c&&c.capacity>0,i=l?c.assigned/c.capacity:0,u="cal-cap-cell "+(o?"off":aC(i))+(r===s?" sel":""),p=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxs("div",{className:u,role:l&&a?"button":void 0,tabIndex:l&&a?0:void 0,title:o?void 0:p,onClick:m=>{!l||!a||a(s,p,m.currentTarget);},onKeyDown:m=>{!l||!a||(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),a(s,p,m.currentTarget));},children:[jsx("div",{className:"nums",children:o||!l?jsx("span",{children:o?"\u2014":`0h${Ud}/${Ud}\u2014`}):jsxs(Fragment,{children:[jsxs("b",{children:[Fo(c.assigned),"h"]}),jsxs("span",{children:["/",Ud,Fo(c.capacity),"h"]})]})}),jsx("div",{className:"cal-cap-track",children:l?jsx("div",{className:"cal-cap-fill",style:{width:Math.min(i*100,100)+"%"}}):null})]},n.serial)})})}function _0({dayLabel:e,perPerson:t,onClose:r,style:a}){let n=useRef(null);useEffect(()=>{let i=u=>{u.key==="Escape"&&r();},d=u=>{n.current&&!n.current.contains(u.target)&&r();};return document.addEventListener("keydown",i),document.addEventListener("mousedown",d),()=>{document.removeEventListener("keydown",i),document.removeEventListener("mousedown",d);}},[r]);let s=t.reduce((i,d)=>i+d.hours,0),o=t.reduce((i,d)=>i+d.capacity,0),c=o>0&&s>o,l=Math.round((s-o)*10)/10;return jsxs("div",{ref:n,className:"cal-pop",role:"dialog",style:{position:"absolute",width:"276px",zIndex:30,...a},children:[jsxs("div",{className:"cal-pop-head",children:[jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxs("div",{className:"tit",style:c?{color:"var(--red)"}:void 0,children:[Fo(s),"h asignadas / ",Fo(o),"h"]}),c?jsx("div",{className:"rng",children:jsxs("b",{children:["+",Fo(l),"h sobre capacidad"]})}):jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsx("div",{children:t.map(i=>{let d=i.capacity>0&&i.hours>i.capacity,u=i.capacity>0?i.capacity:1;return jsxs("div",{className:d?"cal-person-row over":"cal-person-row",children:[jsx("span",{className:"pava",style:{background:i.color},children:i.initials}),jsx("span",{className:"nm",title:i.name,children:i.name}),jsx("div",{className:"cal-person-track",children:jsx("div",{className:"cal-person-fill",style:{width:Math.min(i.hours/u*100,100)+"%"}})}),jsxs("span",{className:"hrs",children:[Fo(i.hours),"h / ",Fo(i.capacity),"h"]})]},i.name)})})]})}var Wd=28,oC=182;function q0({grid:e,weeks:t,tasks:r,items:a,money:n,projColor:s,todaySerial:o,locale:c,capRows:l,teamSize:i,onTaskOpen:d,onMore:u,onCapDay:p}){let m=c==="es";return jsxs("div",{className:"cal-grid-zone",style:{position:"relative"},children:[jsx("div",{className:"cal-weeks",style:{flex:"none"},children:t.map((f,x)=>jsxs("div",{style:{display:"contents"},children:[jsx(sC,{grid:e,ws:f.ws,we:f.we,tasks:r,items:a,money:n,projColor:s,todaySerial:o,onTaskOpen:d,onMore:u}),l&&l[x]?jsx(j0,{days:l[x].days,capByDay:l[x].capByDay,onSelectDay:p}):null]},f.ws))}),jsxs("div",{className:"cal-cap-label",children:[jsxs("span",{children:[m?"Capacidad del equipo":"Team capacity",i!=null?` \xB7 ${i} ${m?i===1?"persona":"personas":i===1?"person":"people"}`:""]}),jsx("span",{children:m?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function sC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:c,onTaskOpen:l,onMore:i}){let d=useMemo(()=>Tl(a,n,t,r),[a,n,t,r]),u=useMemo(()=>new Set(n.filter(f=>f.type==="deadline").map(f=>f.serial)),[n]),p=[];for(let f=t;f<=r;f++)p.push(f);let m={height:`${oC}px`,flex:"none"};return jsxs("div",{className:"cal-week",style:m,children:[jsx("div",{className:"cal-week-bg",children:p.map(f=>{let x=e.serialToDate(f),y=f>=e.monthStartSerial&&f<=e.monthEndSerial,b="cal-day";return ai(e,f)&&(b+=" wknd"),y||(b+=" out"),f===c&&(b+=" today"),u.has(f)&&(b+=" deadline-day"),jsx("div",{className:b,children:jsx("span",{className:"cal-day-num",children:x.getDate()})},f)})}),jsxs("div",{className:"cal-items",children:[d.bars.map((f,x)=>jsx("div",{onClick:()=>l?.(f.t.uid),style:{cursor:l?"pointer":"default",display:"contents"},children:jsx(Sl,{bar:f,ws:t,money:s,projColor:o,slotH:Wd})},`b${x}`)),d.chips.map((f,x)=>jsx(El,{chip:f,ws:t,slotH:Wd},`c${x}`)),d.more.map((f,x)=>jsx(Ml,{more:f,ws:t,slotH:Wd,onClick:()=>i(f.day,f.items,a.filter(y=>y.startSerial<=f.day&&y.endSerial>=f.day))},`m${x}`))]})]})}var iC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function lC(e){return iC.test(e)||/^task-\d+/.test(e)}function cC(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function Y0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function dC(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function X0(e,t){let r=dC(e),a=[];for(let n of r){if(n.startDate&&n.endDate)continue;let s=n.effortMinutes??0,o=Math.round(s/60*10)/10,c=n.costAtCompletion,l=c!=null?Y0(c):Y0(o*t),i=n.assignees?.[0],d=i?.initials||(i?.name?cC(i.name):void 0),u=n.displayId||n.wbsCode||"",p=lC(u||n.id)?"":u||n.id;a.push({taskId:n.id,id:p,name:n.name,hrs:o,cost:l,who:d,projColor:n.color});}return a}function J0({items:e,onItemClick:t,onCollapse:r,money:a,projColor:n}){return jsxs("div",{className:"cal-side",children:[jsxs("div",{className:"cal-side-head",children:[jsx("span",{className:"t",children:"\u26A1 Backlog \xB7 Sin fecha"}),jsx("button",{type:"button",className:"cal-pcollapse",onClick:r,title:"Colapsar panel",children:"\u27E9"})]}),jsxs("div",{className:"cal-side-sec",children:[jsx("span",{children:"Arrastra al calendario"}),jsx("span",{children:e.length})]}),e.length===0?jsx("div",{style:{padding:"24px 16px",fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.08em",color:"var(--subtle)",textAlign:"center"},children:"Sin tareas en backlog"}):e.map(s=>{let o=a==="$"?s.cost:`${s.hrs}h`;return jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(s.taskId),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t(s.taskId));},children:[jsxs("div",{className:"row1",children:[s.id?jsx("span",{className:"tk",children:s.id}):null,jsx("span",{className:"pdot",style:{background:s.projColor||n}})]}),jsx("div",{className:"nom",children:s.name}),jsxs("div",{className:"meta",children:[jsxs("span",{children:[jsxs("b",{children:[s.hrs,"h"]})," est"]}),jsx("span",{children:o}),s.who?jsx("span",{className:"cal-ava",children:s.who}):null]})]},s.taskId)})]})}function Q0({onExpand:e}){return jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e());},title:"Expandir backlog",children:[jsx("span",{className:"pc",children:"\u27E8"}),jsx("span",{className:"dot"}),jsx("span",{className:"vtxt",children:"Backlog \xB7 Estado"})]})}function xs(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function Z0({taskName:e,taskId:t,sim:r,busy:a,locale:n,onConfirm:s,onCancel:o,style:c}){let l=useRef(null),i=n==="es";useEffect(()=>{let f=x=>{x.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let d=r.wasCritical,u=r.projectEndDeltaDays,p=u>0?`+${u} ${i?u===1?"d\xEDa":"d\xEDas":u===1?"day":"days"} \xB7 ${xs(r.oldProjectEnd,n)} \u2192 ${xs(r.newProjectEnd,n)}`:`+0 ${i?"d\xEDas":"days"}${r.slackDays>0?` \xB7 ${i?"holgura":"slack"} ${r.slackDays}d`:""}`,m=u>0?i?`Confirmar +${u} ${u===1?"d\xEDa":"d\xEDas"}`:`Confirm +${u} ${u===1?"day":"days"}`:i?"Confirmar movimiento":"Confirm move";return jsxs("div",{ref:l,className:"cal-pop",style:{width:"324px",zIndex:60,...c},role:"dialog",children:[jsxs("div",{className:"cal-pop-head",children:[jsx("div",{className:"sup",children:i?"Confirmar movimiento":"Confirm move"}),jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxs("div",{className:"rng",children:[xs(r.oldStart,n)," \u2013 ",xs(r.oldEnd,n)," \u2192 ",jsxs("b",{children:[xs(r.newStart,n)," \u2013 ",xs(r.newEnd,n)]})]})]}),d?jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",i?"Esta tarea est\xE1 en ruta cr\xEDtica":"This task is on the critical path"]}):null,jsxs("div",{className:"cal-impact",children:[jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Tareas sucesoras movidas":"Successor tasks moved"}),jsx("span",{className:"v",children:r.movedSuccessors.length===0?i?"Ninguna":"None":`${r.movedSuccessors.length}${r.movedSuccessors.length<=2?" \xB7 "+r.movedSuccessors.map(f=>f.name).join(", "):""}`})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Fin de proyecto":"Project end"}),jsx("span",{className:u>0?"v bad":"v good",children:p})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Ruta cr\xEDtica":"Critical path"}),jsx("span",{className:"v",children:r.stillCritical?i?"Sigue en CPM":"Stays critical":r.wasCritical?i?"Sale de CPM":"Leaves critical":i?`No entra \xB7 holgura ${r.slackDays}d`:`Not critical \xB7 slack ${r.slackDays}d`})]})]}),jsxs("div",{className:"cal-pop-actions",children:[jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:a,children:i?"Cancelar":"Cancel"}),jsx("button",{type:"button",className:d||u>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:a,children:a?i?"Guardando\u2026":"Saving\u2026":m})]})]})}var gC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function ef({grid:e,tasks:t,items:r,money:a,projColor:n,todaySerial:s,locale:o,onTaskOpen:c}){let l=o==="es",i=useMemo(()=>{let u=new Map,p=m=>(u.has(m)||u.set(m,{serial:m,date:e.serialToDate(m),tasks:[],items:[]}),u.get(m));for(let m of t)m.startSerial>=1&&m.startSerial<=42&&p(m.startSerial).tasks.push(m);for(let m of r)m.serial>=1&&m.serial<=42&&p(m.serial).items.push(m);return [...u.values()].filter(m=>m.tasks.length||m.items.length).sort((m,f)=>m.serial-f.serial)},[t,r,e]);if(i.length===0)return jsxs("div",{className:"cal-empty",style:{position:"static",padding:"60px 24px"},children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:l?"Nada programado este mes":"Nothing scheduled this month"}),jsx("p",{children:l?"Cambia de mes con las flechas o crea tareas en el Gantt.":"Change month with the arrows or create tasks in the Gantt."})]});let d=u=>u.toLocaleDateString(l?"es-CO":"en-US",{weekday:"long",day:"numeric",month:"short"});return jsx("div",{className:"cal-agenda",style:{overflowY:"auto",flex:1,minHeight:0,padding:"8px 0",maxHeight:"calc(100vh - 150px)"},children:i.map(u=>jsxs("div",{className:"cal-agenda-day",children:[jsxs("div",{className:"cal-agenda-date",style:{fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.1em",textTransform:"uppercase",color:u.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[d(u.date),u.serial===s?` \xB7 ${l?"HOY":"TODAY"}`:""]}),u.tasks.map(p=>jsxs("button",{type:"button",onClick:()=>c?.(p.uid),className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",textAlign:"left",padding:"8px 20px",background:"transparent",border:"none",cursor:"pointer",color:"var(--txt)",fontSize:"12.5px"},children:[jsx("span",{style:{width:8,height:8,borderRadius:2,background:n,flex:"none"}}),p.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:8,letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:3,padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,p.id?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:p.id}):null,jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.name}),jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:a==="$"?p.cost:`${p.hrs}h`})]},p.uid)),u.items.map((p,m)=>jsxs("div",{className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 20px",fontSize:"12.5px",color:"var(--txt2)"},children:[jsx("span",{style:{width:8,textAlign:"center",flex:"none"},children:gC[p.type]??"\xB7"}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.label})]},`it${m}`))]},u.serial))})}function fC(e){let t=[],r=a=>a.forEach(n=>{t.push(n),n.subtasks?.length&&r(n.subtasks);});return r(e),t}function Pl(e){let t=e.dependencies;return Array.isArray(t)?t.map(r=>typeof r=="string"?r:r?.id).filter(r=>!!r):[]}function zd(e){let t=e.startDate?new Date(e.startDate):null,r=e.endDate?new Date(e.endDate):null;return !t||!r?1:Math.max(1,Math.round((r.getTime()-t.getTime())/864e5))}function tf(e,t){let r=new Map(e.map(i=>[i.id,i])),a=new Map;for(let i of e)for(let d of Pl(i))a.has(d)||a.set(d,[]),a.get(d).push(i.id);let n=new Map,s=new Map,o=new Set,c=i=>{if(s.has(i))return s.get(i);if(o.has(i))return s.get(i)??0;o.add(i);let d=r.get(i);if(!d)return o.delete(i),0;let u=Pl(d).filter(f=>r.has(f)),p=t.has(i)?t.get(i):d.startDate?new Date(d.startDate).getTime():0;for(let f of u){let x=c(f);x>p&&(p=x);}let m=zd(d)*864e5;return n.set(i,p),s.set(i,p+m),o.delete(i),s.get(i)};for(let i of e)c(i.id);let l=0;return s.forEach(i=>{i>l&&(l=i);}),{finish:s,start:n,projectEnd:l}}function rf(e,t,r){let a=new Map(e.map(l=>[l.id,l])),n=new Map;for(let l of e)for(let i of Pl(l))n.has(i)||n.set(i,[]),n.get(i).push(l.id);let s=new Map,o=[...e].sort((l,i)=>(t.get(i.id)??0)-(t.get(l.id)??0));for(let l of o){let i=n.get(l.id)??[];if(i.length===0)s.set(l.id,r);else {let d=1/0;for(let u of i){let p=s.get(u),m=a.get(u);p!=null&&m&&(d=Math.min(d,p-zd(m)*864e5));}s.set(l.id,d===1/0?r:d);}}let c=new Set;for(let l of e){let i=(s.get(l.id)??0)-(t.get(l.id)??0);Math.abs(i)<864e5/2&&Pl(l).length+(n.get(l.id)?.length??0)>0&&c.add(l.id);}return c}function Fl(e,t,r,a){let n=fC(e),s=n.find(b=>b.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),c=new Date(s.endDate),l=tf(n,new Map),i=rf(n,l.finish,l.projectEnd),d=n.map(b=>b.id===t?{...b,startDate:r,endDate:a}:b),u=tf(d,new Map([[t,r.getTime()]])),p=rf(d,u.finish,u.projectEnd),m=new Map(d.map(b=>[b.id,b])),f=[];for(let b of n){if(b.id===t)continue;let h=l.start.get(b.id),v=u.start.get(b.id);if(h!=null&&v!=null&&Math.abs(v-h)>=864e5/2){let w=zd(m.get(b.id))*864e5;f.push({id:b.id,name:b.name,newStart:new Date(v),newEnd:new Date(v+w)});}}let x=Math.round((u.projectEnd-l.projectEnd)/864e5),y=i.has(t)?0:Math.max(0,Math.round((l.projectEnd-(l.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:c,newStart:r,newEnd:a,movedSuccessors:f,projectEndDeltaDays:x,oldProjectEnd:new Date(l.projectEnd),newProjectEnd:new Date(u.projectEnd),wasCritical:i.has(t),stillCritical:p.has(t),slackDays:y}}function af(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var yC=132,Ll=26,xC="#5B7FD4";function nf({tasks:e,projectName:t,projectId:r,projectColor:a,locale:n,themeMode:s,hourlyRate:o,money:c,onMoneyChange:l,onTaskOpen:i,canReschedule:d,onReschedule:u,members:p=[],holidayDates:m=[],timesheetSettings:f,onVisibleRangeChange:x}){let[y,b]=useState("mes"),[h,v]=useState(()=>{let U=new Date;return {y:U.getFullYear(),m:U.getMonth()}}),[w,T]=useState(false),[E,F]=useState([]),[k,D]=useState("all"),[P,N]=useState(null),[K,H]=useState(null),[te,I]=useState(false),[_,j]=useState(null),[W,B]=useState(false),ve=useMemo(()=>F0(h.y,h.m),[h.y,h.m]),We=a||xC,Le=useMemo(()=>{let U=new Set;for(let X of m){let Se=new Date(`${X}T12:00:00`),de=ve.dateToSerial(Se);de>=1&&de<=42&&U.add(de);}return U},[m,ve]);useEffect(()=>{x?.({start:af(ve.serialToDate(1)),end:af(ve.serialToDate(42))});},[h.y,h.m]);let be=p.length,ge=useMemo(()=>{let U=f?.hoursPerDay;if(!U)return 8;let X=[U.monday,U.tuesday,U.wednesday,U.thursday,U.friday].map(Se=>Se||0).filter(Se=>Se>0);return X.length?Math.round(X.reduce((Se,de)=>Se+de,0)/X.length*10)/10:8},[f]),ye=useMemo(()=>Nl({tasks:e,grid:ve,projectColor:()=>We,hourlyRate:o,projectId:r}),[e,ve,We,o,r]),ze=useMemo(()=>{let U=new Map;for(let X of ye.calTasks)X.phaseId&&X.phaseName&&U.set(X.phaseId,X.phaseName);return [...U.entries()].map(([X,Se])=>({id:X,name:Se})).sort((X,Se)=>X.name.localeCompare(Se.name))},[ye.calTasks]),ke=!E.includes("tareas"),Ie=!E.includes("cpm"),De=useMemo(()=>{let U=ke?ye.calTasks:[];return k!=="all"&&(U=U.filter(X=>X.phaseId===k)),Ie||(U=U.map(X=>X.critical?{...X,critical:false}:X)),U},[ye.calTasks,ke,Ie,k]),qe=useMemo(()=>{let U=new Set;return E.includes("hitos")&&(U.add("hito"),U.add("desembolso")),E.includes("ext")&&U.add("ext"),E.includes("aus")&&U.add("aus"),ye.dayItems.filter(X=>!U.has(X.type))},[ye.dayItems,E]),fe=!E.includes("festivos"),tt=new Date,Be=ve.dateToSerial(new Date(tt.getFullYear(),tt.getMonth(),tt.getDate())),$e=U=>F(X=>X.includes(U)?X.filter(Se=>Se!==U):[...X,U]),gt=()=>v(U=>{let X=new Date(U.y,U.m-1,1);return {y:X.getFullYear(),m:X.getMonth()}}),Ft=()=>v(U=>{let X=new Date(U.y,U.m+1,1);return {y:X.getFullYear(),m:X.getMonth()}}),He=()=>{let U=new Date;v({y:U.getFullYear(),m:U.getMonth()});},Ae=(U,X,Se)=>{if(!d||X===0)return;let de=ye.calTasks.find(kt=>kt.uid===U);if(!de)return;let et=X*864e5,rt=new Date(de.realStart.getTime()+et),Qe=new Date(de.realEnd.getTime()+et),At=Fl(e,U,rt,Qe);At&&j({uid:U,taskId:de.id,taskName:de.name,sim:At,anchor:Se});},ot=async()=>{if(!_||!u)return;B(true);let U=[{id:_.uid,startDate:_.sim.newStart,endDate:_.sim.newEnd},..._.sim.movedSuccessors.map(Se=>({id:Se.id,startDate:Se.newStart,endDate:Se.newEnd}))],X=await u(U);B(false),X&&j(null);},Lt=I0(h.y,h.m,n),Fe=[{id:"",name:t,color:We}],Xe=useMemo(()=>X0(e,o),[e,o]),L=useMemo(()=>{if(y==="lookahead"){let U=ve.weeks.find(Se=>Be>=Se.ws&&Be<=Se.we)??ve.weeks[0],X=ve.weeks.indexOf(U);return ve.weeks.slice(X,X+2)}return y==="semana"?[ve.weeks.find(X=>Be>=X.ws&&Be<=X.we)??ve.weeks[0]]:[]},[y,ve.weeks,Be]),ae=useMemo(()=>{let U={};return L.forEach((X,Se)=>{let de=[];for(let rt=X.ws;rt<=X.we;rt++)de.push({serial:rt,date:ve.serialToDate(rt),isWeekend:ai(ve,rt),isHoliday:Le.has(rt)});let et=V0(p,de,ge);U[Se]={days:de,capByDay:et};}),U},[L,ve,Le,p,ge]),R=y==="semana"||y==="lookahead",q=y==="agenda";return jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[jsx(B0,{view:y,onViewChange:b,money:c==="$"?"$":"hrs",onMoneyChange:U=>l(U==="$"?"$":"Hrs"),projectLabel:t,locale:n}),jsx($0,{monthLabel:Lt,onPrev:gt,onNext:Ft,onToday:He,layersOpen:w,onToggleLayers:()=>T(U=>!U),layersOff:E,phases:ze,phaseFilter:k,onPhaseChange:D,locale:n,children:w?jsx(O0,{off:E,onToggle:$e}):null}),jsxs("div",{className:"cal-body",children:[jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:q?"hidden":void 0},children:[q?jsx(ef,{grid:ve,tasks:De,items:qe,money:c,projColor:We,todaySerial:Be,locale:n,onTaskOpen:i}):R?jsxs(Fragment,{children:[jsx(Dl,{locale:n}),jsx(q0,{grid:ve,weeks:L,tasks:De,items:qe,money:c,projColor:We,todaySerial:Be,locale:n,capRows:ae,teamSize:be,onTaskOpen:i,onMore:(U,X,Se)=>N({day:U,items:X,tasks:Se}),onCapDay:(U,X,Se)=>{for(let de of Object.keys(ae)){let et=ae[+de].capByDay.get(U);if(et){H({dayLabel:X,perPerson:et.perPerson,anchor:Se.getBoundingClientRect()});break}}}})]}):ye.isEmpty?jsxs(Fragment,{children:[jsx(Dl,{locale:n}),jsx("div",{className:"cal-weeks",children:ve.weeks.map(U=>jsx(of,{grid:ve,ws:U.ws,we:U.we,todaySerial:Be,showFestivos:fe,holidaySerials:Le,locale:n,deadlineDays:new Set},U.ws))}),jsx(W0,{monthLabel:Lt,locale:n})]}):jsxs(Fragment,{children:[jsx(Dl,{locale:n}),jsx("div",{className:"cal-weeks",children:ve.weeks.map(U=>jsx(vC,{grid:ve,ws:U.ws,we:U.we,tasks:De,items:qe,money:c,projColor:We,todaySerial:Be,showFestivos:fe,holidaySerials:Le,locale:n,onTaskOpen:i,onMore:(X,Se,de)=>N({day:X,items:Se,tasks:de}),canReschedule:d,onDragReschedule:Ae,pendingGhost:_?{uid:_.uid,days:Math.round((_.sim.newStart.getTime()-_.sim.oldStart.getTime())/864e5)}:null},U.ws))})]}),P?jsx(U0,{dayLabel:`${ve.serialToDate(P.day).getDate()}`,items:P.items,tasks:P.tasks.map(U=>({swatch:We,taskId:U.id,label:U.name,critical:U.critical,value:c==="$"?U.cost:`${U.hrs}h`})),onClose:()=>N(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40}}):null,K?jsx(_0,{dayLabel:K.dayLabel,perPerson:K.perPerson,onClose:()=>H(null),style:{position:"fixed",top:`${K.anchor.top-8}px`,left:`${K.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,_?jsx(Z0,{taskName:_.taskName,taskId:_.sim.taskId,sim:_.sim,busy:W,locale:n,onConfirm:ot,onCancel:()=>j(null),style:{position:"fixed",top:`${_.anchor.top+12}px`,left:`${Math.min(_.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),te?jsx(J0,{items:Xe,money:c,projColor:We,onItemClick:U=>i?.(U),onCollapse:()=>I(false)}):jsx(Q0,{onExpand:()=>I(true)})]}),jsx(R0,{projects:Fe})]})}function of({grid:e,ws:t,we:r,todaySerial:a,showFestivos:n,holidaySerials:s,deadlineDays:o}){let c=[];for(let l=t;l<=r;l++)c.push(l);return jsx("div",{className:"cal-week-bg",children:c.map(l=>{let i=e.serialToDate(l),d=l>=e.monthStartSerial&&l<=e.monthEndSerial,u=n&&s.has(l),p="cal-day";return ai(e,l)&&(p+=" wknd"),u&&(p+=" festivo"),d||(p+=" out"),l===a&&(p+=" today"),o.has(l)&&(p+=" deadline-day"),jsxs("div",{className:p,children:[jsx("span",{className:"cal-day-num",children:i.getDate()}),u?jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},l)})})}function vC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:c,showFestivos:l,holidaySerials:i,locale:d,onTaskOpen:u,onMore:p,canReschedule:m,onDragReschedule:f,pendingGhost:x}){let y=useMemo(()=>Tl(a,n,t,r),[a,n,t,r]),b=useMemo(()=>new Set(n.filter(F=>F.type==="deadline").map(F=>F.serial)),[n]),h=Math.max(yC,y.laneCount*Ll+36),v=useRef(null),[w,T]=useState(null),E=(F,k)=>{if(!m||!f){u?.(k);return}F.preventDefault();let D=v.current;if(!D)return;let P=D.getBoundingClientRect().width/7,N=F.clientX,K=0,H=I=>{let _=Math.round((I.clientX-N)/P);K=_,T({id:k,days:_});},te=I=>{if(window.removeEventListener("pointermove",H),window.removeEventListener("pointerup",te),T(null),K===0){u?.(k);return}let _=new DOMRect(I.clientX,I.clientY,0,0);f(k,K,_);};window.addEventListener("pointermove",H),window.addEventListener("pointerup",te);};return jsxs("div",{ref:v,className:"cal-week",style:{minHeight:`${h}px`},children:[jsx(of,{grid:e,ws:t,we:r,todaySerial:c,showFestivos:l,holidaySerials:i,locale:d,deadlineDays:b}),jsxs("div",{className:"cal-items",children:[y.bars.map((F,k)=>{let D=w?.id===F.t.uid?w.days:null,P=x?.uid===F.t.uid?x.days:null,N=D??P??0,K=D==null&&P!=null,H=N!==0?{...F,s:F.s+N,e:F.e+N}:F;return jsx("div",{onPointerDown:te=>E(te,F.t.uid),style:{cursor:m?"grab":u?"pointer":"default",display:"contents",opacity:K?.6:1},children:jsx(Sl,{bar:H,ws:t,money:s,projColor:o,slotH:Ll})},`b${k}`)}),y.chips.map((F,k)=>jsx(El,{chip:F,ws:t,slotH:Ll},`c${k}`)),y.more.map((F,k)=>jsx(Ml,{more:F,ws:t,slotH:Ll,onClick:()=>p(F.day,F.items,a.filter(D=>D.startSerial<=F.day&&D.endSerial>=F.day))},`m${k}`))]})]})}function kC({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:c}){let[l,i]=useState(false),d=useMemo(()=>t.filter(m=>e.cardIds.includes(m.id)),[t,e.cardIds]),u=useMemo(()=>{let m=d.length,f=new Set(d.flatMap(b=>b.assignedUserIds||[])).size,x=d.map(b=>b.priority).filter(Boolean),y=new Set(d.flatMap(b=>b.labels||[])).size;return {totalCards:m,uniqueAssignees:f,priorities:x,labels:y}},[d]),p=()=>{n?.(e.id);};return jsxs("div",{className:g("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick: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:g("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:u.totalCards}),jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),l&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:m=>{m.stopPropagation(),o?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[u.uniqueAssignees," assignees"]})]}),u.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[u.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:d.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:d.map(m=>jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsx("div",{onClick:()=>a?.(m),children:r(m)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(m),children:[jsx("h4",{children:m.title}),m.description&&jsxs("p",{children:[m.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,m.id);},"aria-label":"Remove from stack",children:jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},m.id))})})]})}var lf={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function oi(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 si(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 cf(e){return {created:"#10b981",status_changed:"#00E5CC",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#00E5CC",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#00E5CC",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function df({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:s,config:o,className:c}){let l=useMemo(()=>({...lf,...o}),[o]),[i,d]=useState(new Set),u=useRef(null),p=useMemo(()=>{if(!l.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(v=>{let w=v.timestamp.toISOString().split("T")[0],T=h.get(w);T?T.push(v):h.set(w,[v]);}),Array.from(h.entries()).sort((v,w)=>w[0].localeCompare(v[0])).map(([v,w])=>({date:new Date(v),events:w.sort((T,E)=>E.timestamp.getTime()-T.timestamp.getTime())}))},[e,l.groupByDay]),{uniqueUsers:m,uniqueTypes:f}=useMemo(()=>{let h=new Set,v=new Set;return e.forEach(w=>{h.add(w.userId),v.add(w.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(v)}},[e]),x=h=>{d(v=>{let w=new Set(v);return w.has(h)?w.delete(h):w.add(h),w});},y=h=>{let w=new Date().getTime()-h.getTime(),T=Math.floor(w/6e4),E=Math.floor(w/36e5),F=Math.floor(w/864e5);return T<1?"just now":T<60?`${T}m ago`:E<24?`${E}h ago`:F<7?`${F}d ago`:h.toLocaleDateString()},b=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&&u.current){let h=u.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:g("history-timeline-empty",c),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:g("history-timeline",l.compact&&"compact",c),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let v=h.target.value;r({...t,types:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),f.map(h=>jsxs("option",{value:h,children:[si(h)," ",h.replace("_"," ")]},h))]}),m.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let v=h.target.value;r({...t,users:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),m.map(h=>jsx("option",{value:h,children:h},h))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>r({...t,searchTerm:h.target.value})})]}),b>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:a,children:["Clear filters (",b,")"]})]}),jsx("div",{className:"history-timeline-container",ref:u,children:p.map(h=>jsxs("div",{className:"history-timeline-group",children:[l.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((v,w)=>{let T=i.has(v.id),E=s===v.id,F=cf(v.type);return jsxs("div",{"data-event-id":v.id,className:g("history-timeline-event",T&&"expanded",E&&"selected"),onClick:()=>n?.(v),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:F},children:l.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:si(v.type)})}),w<h.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:F}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[l.showAvatars&&v.userAvatar&&jsx("img",{src:v.userAvatar,alt:v.userName||v.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:v.userName||v.userId}),jsx("span",{className:"history-timeline-event-action",children:oi(v)})]})]}),jsx("div",{className:"history-timeline-event-time",children:l.useRelativeTime?y(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),x(v.id);},children:[T?"\u25BC":"\u25B6"," Show changes"]}),T&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(v.changes).map(([k,D])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(D.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(D.to)})]})]},k)),v.metadata&&Object.keys(v.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(v.metadata).map(([k,D])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(D)})]},k))]})]})]})]},v.id)})})]},h.date?.toISOString()||"all"))})]})}function pf({replayState:e,events:t,onStartReplay:r,onStopReplay:a,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:c,onSpeedChange:l,className:i}){let d=[.5,1,1.5,2,3],u=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:g("history-replay-empty",i),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:g("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:u&&si(u.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:u&&oi(u)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:u&&u.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:m=>c(parseInt(m.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((m,f)=>jsx("div",{className:g("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>c(f),title:oi(m)},m.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:n,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:o,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:d.map(m=>jsxs("button",{className:g("history-replay-speed-btn",e.speed===m&&"active"),onClick:()=>l(m),children:[m,"x"]},m))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:a,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:u&&u.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(m=>jsx("span",{className:"history-replay-card-preview-label-tag",children:m},m))})]})]})]})]}):jsxs("div",{className:g("history-replay-start",i),children:[jsxs("button",{className:"history-replay-start-button",onClick:r,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function Vd(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#00E5CC",child_of:"#00C4AE",similar_to:"#10b981"}[e]||"#6b7280"}function jd(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 mf(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 gf(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function EC(e,t,r,a,n,s=100){let o=e.map(l=>({...l,x:l.x??r/2+Math.random()*100-50,y:l.y??a/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(o.map(l=>[l.id,l]));for(let l=0;l<s;l++){let i=1-l/s;o.forEach(d=>{let u=r/2,p=a/2;d.vx+=(u-d.x)*n.centerForce*i,d.vy+=(p-d.y)*n.centerForce*i,o.forEach(m=>{if(d.id===m.id)return;let f=d.x-m.x,x=d.y-m.y,y=Math.sqrt(f*f+x*x)||1,b=n.chargeStrength*i/(y*y);d.vx+=f/y*b,d.vy+=x/y*b;});}),t.forEach(d=>{let u=c.get(typeof d.source=="string"?d.source:d.source.id),p=c.get(typeof d.target=="string"?d.target:d.target.id);if(!u||!p)return;let m=p.x-u.x,f=p.y-u.y,x=Math.sqrt(m*m+f*f)||1,y=(x-n.linkDistance)/x*n.forceStrength*i;u.vx+=m*y,u.vy+=f*y,p.vx-=m*y,p.vy-=f*y;}),o.forEach(d=>{d.fx!==null&&d.fx!==void 0?(d.x=d.fx,d.vx=0):d.x+=d.vx,d.fy!==null&&d.fy!==void 0?(d.y=d.fy,d.vy=0):d.y+=d.vy,d.x=Math.max(n.nodeSize,Math.min(r-n.nodeSize,d.x)),d.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,d.y)),d.vx*=.9,d.vy*=.9;});}return o}function ff({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:s,stats:o,onInteraction:c,className:l}){let i=useRef(null),[d,u]=useState([]),[p,m]=useState(null),[f,x]=useState(null),[y,b]=useState(null),[h,v]=useState(1),[w,T]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let H=EC(e,t,r.width,r.height,r,150);u(H);},[e,t,r]);let E=useCallback((H,te)=>{r.enableDragging&&(te.stopPropagation(),m(H));},[r.enableDragging]),F=useCallback(H=>{if(!p||!i.current)return;let I=i.current.getBoundingClientRect(),_=(H.clientX-I.left-w.x)/h,j=(H.clientY-I.top-w.y)/h;u(W=>W.map(B=>B.id===p?{...B,x:_,y:j,fx:_,fy:j}:B));},[p,h,w]),k=useCallback(()=>{m(null);},[]),D=useCallback((H,te)=>{te.stopPropagation(),c?.({type:"node-click",node:H,position:{x:te.clientX,y:te.clientY}});},[c]),P=useCallback((H,te)=>{te.stopPropagation(),c?.({type:"edge-click",edge:H,position:{x:te.clientX,y:te.clientY}});},[c]),N=useCallback(H=>{let te=d.find(I=>I.id===H);return te?{x:te.x,y:te.y}:{x:0,y:0}},[d]),K=useCallback(H=>{if(H.onCriticalPath)return "#ef4444";switch(r.colorScheme){case "status":return H.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let te=H.card.priority;return te==="URGENT"?"#ef4444":te==="HIGH"?"#f59e0b":te==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return H.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[r.colorScheme]);return e.length===0?jsxs("div",{className:g("relationships-graph-empty",l),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:g("relationships-graph",l),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:o.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:o.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),r.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(H=>Math.min(H+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(H=>Math.max(H-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{v(1),T({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(H=>H.type))).map(H=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Vd(H)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[mf(H)," ",jd(H)]})]},H))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:F,onMouseUp:k,onMouseLeave:k,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${h})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(H=>{let te=N(typeof H.source=="string"?H.source:H.source.id),I=N(typeof H.target=="string"?H.target:H.target.id),_=gf(H.type),j=y===H.id,W=H.onCriticalPath;return jsxs("g",{className:g("relationships-graph-edge",j&&"hovered",W&&"critical"),onMouseEnter:()=>b(H.id),onMouseLeave:()=>b(null),onClick:B=>P(H,B),children:[jsx("line",{x1:te.x,y1:te.y,x2:I.x,y2:I.y,stroke:Vd(H.type),strokeWidth:W?r.edgeWidth*2:r.edgeWidth,strokeOpacity:j?1:.6,markerEnd:_?"url(#arrowhead)":void 0}),r.showEdgeLabels&&j&&jsx("text",{x:(te.x+I.x)/2,y:(te.y+I.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:jd(H.type)})]},H.id)})}),jsx("g",{className:"relationships-graph-nodes",children:d.map(H=>{let te=f===H.id,I=H.onCriticalPath;return jsxs("g",{className:g("relationships-graph-node",te&&"hovered",I&&"critical"),transform:`translate(${H.x}, ${H.y})`,onMouseDown:_=>E(H.id,_),onMouseEnter:()=>x(H.id),onMouseLeave:()=>x(null),onClick:_=>D(H,_),children:[jsx("circle",{r:I?r.nodeSize*1.2:r.nodeSize,fill:K(H),stroke:I?"#fbbf24":"#ffffff",strokeWidth:I?3:2,opacity:te?1:.9}),r.showLabels&&jsx("text",{y:r.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:H.card.title.length>20?H.card.title.substring(0,20)+"...":H.card.title})]},H.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 yf({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[s,o]=useState(""),[c,l]=useState(false),[i,d]=useState(null),[u,p]=useState(null),m=useRef(null),f=c||n;useEffect(()=>{e&&m.current&&m.current.focus();},[e]),useEffect(()=>{let h=v=>{v.key==="Escape"&&!f&&x();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,f]);let x=()=>{f||(o(""),d(null),p(null),t());},y=async()=>{if(!(!s.trim()||f)){l(true),d(null),p(null);try{let h=await a(s.trim());p(h);}catch(h){d(h instanceof Error?h.message:"Failed to generate plan");}finally{l(false);}}},b=()=>{u&&(r(u),x());};return e?jsxs(lr,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:x,disabled:f,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:u?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),u.explanation&&jsx("div",{className:"p-4 rounded-lg bg-[#00E5CC]/10 border border-[#00E5CC]/30",children:jsx("p",{className:"text-sm text-white/90",children:u.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",u.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:u.columns.map((h,v)=>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},v))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",u.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[u.cards.slice(0,10).map((h,v)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:h.priority})]})},v)),u.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",u.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:m,value:s,onChange:h=>o(h.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled:f}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),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,v)=>jsx("button",{onClick:()=>o(h),disabled:f,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},v))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:f&&jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:x,disabled:f,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),u?jsx("button",{onClick:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:y,disabled:!s.trim()||f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:f?"Generating...":"Generate Plan"})]})]})]})})]}):null}var _d={"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 PC={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},FC={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 LC(e,t,r){let a=_d[e];if(!a)throw new Error(`Unknown model: ${e}`);let n=t/1e3*a.costPer1kInput,s=r/1e3*a.costPer1kOutput;return n+s}function ii(e){return `$${e.toFixed(4)}`}var Kd=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=LC(t.model,t.inputTokens,t.outputTokens),a={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:r};return this.operations.push(a),this.listeners.forEach(n=>n(a)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),a}getStats(t){let r=this.operations;t&&(r=r.filter(u=>u.timestamp>=t.start&&u.timestamp<=t.end));let a=r.length,n=r.reduce((u,p)=>u+p.cost,0),s=r.reduce((u,p)=>u+p.inputTokens,0),o=r.reduce((u,p)=>u+p.outputTokens,0),c=r.filter(u=>u.success),l=r.reduce((u,p)=>u+p.duration,0),i={},d={};return r.forEach(u=>{i[u.feature]=(i[u.feature]||0)+1,d[u.feature]=(d[u.feature]||0)+u.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:i,costsByFeature:d,averageDuration:a>0?l/a:0,successRate:a>0?c.length/a:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,r="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][r],s=new Date,o=new Date;r==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let c=this.operations.filter(d=>d.timestamp>=o).length,l=Math.max(0,n-c),i=c/n*100;return {used:c,limit:n,remaining:l,percentUsed:i,isExceeded:c>=n}}subscribe(t){return this.listeners.push(t),()=>{let r=this.listeners.indexOf(t);r>-1&&this.listeners.splice(r,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Ao=new Kd;function wf({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=useState(Ao.getStats()),[s,o]=useState(Ao.checkLimit(r));if(useEffect(()=>{if(!e)return;let l=setInterval(()=>{n(Ao.getStats()),o(Ao.checkLimit(r));},1e3);return ()=>clearInterval(l)},[e,r]),useEffect(()=>{let l=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e,t]),!e)return null;let c=Ao.getRecentOperations(5);return jsxs(lr,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:l=>l.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",r.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ii(a.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-[#00E5CC] mt-1",children:a.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(a.totalInputTokens+a.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[a.totalInputTokens.toLocaleString()," in /"," ",a.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(a.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",a.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(a.operationsByFeature).map(([l,i])=>{let d=a.costsByFeature[l]||0,u=a.totalOperations>0?i/a.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:l.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ii(d)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${u}%`}})})]},l)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:c.map(l=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:l.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(l.timestamp).toLocaleTimeString()," \u2022"," ",l.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[l.inputTokens+l.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ii(l.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${l.success?"bg-green-400":"bg-red-400"}`})]})]},l.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function Tf({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:s}){let[o,c]=useState(""),[l,i]=useState(""),[d,u]=useState(""),[p,m]=useState(false),[f,x]=useState(null),[y,b]=useState(null),[h,v]=useState(null),w=useRef(null),T=p||n;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let P=N=>{N.key==="Escape"&&!T&&E();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,T]);let E=()=>{T||(c(""),i(""),u(""),x(null),b(null),v(null),t());},F=async()=>{if(!(!o.trim()||T)){m(true),x(null),b(null),v(null);try{let P=await a({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:l||void 0,endDate:d||void 0});b(P.tasks.tasks),v({from_cache:P.from_cache,tokens_used:P.tokens_used,mock_mode:P.mock_mode,similarity:P.similarity,tokens_saved:P.tokens_saved});}catch(P){x(P instanceof Error?P.message:"Failed to generate tasks");}finally{m(false);}}},k=()=>{y&&(r(y),E());};if(!e)return null;let D=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxs(lr,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:E}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:P=>P.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:E,disabled:T,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:y?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-[#00E5CC]/20 text-[#00E5CC] border border-[#00E5CC]/30",children:["From Cache (",D,"% similar)"]}):jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[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:[y.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:y.map((P,N)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxs("span",{className:"text-xs text-white/50",children:["#",N+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:P.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),P.start," \u2192 ",P.end]}),jsxs("span",{children:[P.duration," days"]}),P.dependencies.length>0&&jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",P.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${P.priority==="high"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:P.priority})]})},P.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:w,value:o,onChange:P=>c(P.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled:T}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:l,onChange:P=>i(P.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled:T})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:d,onChange:P=>u(P.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled:T})]})]}),f&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:f}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((P,N)=>jsx("button",{onClick:()=>c(P),disabled:T,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:P},N))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:T&&jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:E,disabled:T,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"}),y?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:F,disabled:!o.trim()||T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:T?"Generating...":"Generate Tasks"})]})]})]})})]})}function Rl({initialBoard:e,onPersist:t}){let[r,a]=useState(e),n=useCallback(y=>{t&&yi(()=>Promise.resolve(t(y)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,h,v)=>{console.warn(`Retry attempt ${h} after ${v}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=useCallback(async(y,b,h)=>{a(v=>{let w=v.cards.find(P=>P.id===y);if(!w)return v;let T=w.columnId,E={...w,columnId:b,position:h},F=v.cards.map(P=>P.id===y?E:P),k=v.columns.map(P=>{if(P.id===T)return {...P,cardIds:P.cardIds.filter(N=>N!==y)};if(P.id===b){let N=F.filter(K=>K.columnId===b).sort((K,H)=>K.position-H.position);return {...P,cardIds:N.map(K=>K.id)}}return P}),D={...v,cards:F,columns:k};return n(D),D});},[n]),o=useCallback(async(y,b)=>{a(h=>{let v=h.cards.map(T=>T.id===y?{...T,...b}:T),w={...h,cards:v};return n(w),w});},[n]),c=useCallback(async y=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(h=>{let v={...y,id:b},w=h.columns.map(E=>E.id===y.columnId?{...E,cardIds:[...E.cardIds,b]}:E),T={...h,cards:[...h.cards,v],columns:w};return n(T),T});},[n]),l=useCallback(async y=>{a(b=>{let h=b.cards.find(E=>E.id===y);if(!h)return b;let v=b.cards.filter(E=>E.id!==y),w=b.columns.map(E=>E.id===h.columnId?{...E,cardIds:E.cardIds.filter(F=>F!==y)}:E),T={...b,cards:v,columns:w};return n(T),T});},[n]),i=useCallback(async y=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(h=>{let v={...y,id:b,cardIds:[]},w={...h,columns:[...h.columns,v]};return n(w),w});},[n]),d=useCallback(async(y,b)=>{a(h=>{let v=h.columns.map(T=>T.id===y?{...T,...b}:T),w={...h,columns:v};return n(w),w});},[n]),u=useCallback(async y=>{a(b=>{let h=b.cards.filter(T=>T.columnId!==y),v=b.columns.filter(T=>T.id!==y),w={...b,cards:h,columns:v};return n(w),w});},[n]),p=useCallback(y=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(y),b},[c]),m=useCallback(y=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(y),b},[i]),f=useCallback(()=>{a(y=>{let b={...y,cards:[],columns:[]};return n(b),b});},[n]);return {board:r,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:c,onCardDelete:l,onColumnCreate:i,onColumnUpdate:d,onColumnDelete:u},setBoard:a,helpers:{addCard:p,addColumn:m,deleteCard:l,deleteColumn:u,clearBoard:f}}}function Df({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:s}=Rl({initialBoard:e,onPersist:r}),o=useMemo(()=>({addCard:(l,i,d={})=>{s.addCard({title:i,columnId:l,position:a.cards.filter(u=>u.columnId===l).length,...d});},addColumn:(l,i)=>{let d=a.columns.length>0?Math.max(...a.columns.map(u=>u.position)):0;s.addColumn({title:l,position:i??d+1e3});},reset:s.clearBoard}),[a.cards,a.columns,s]);return {props:useMemo(()=>({board:a,callbacks:n,availableUsers:t}),[a,n,t]),board:a,callbacks:n,utils:o}}var li={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Ef={by:"none",order:"asc"};function Mf({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=useState({...li,...e}),[s,o]=useState({...Ef,...t}),c=useCallback(x=>{n(y=>({...y,...x}));},[]),l=useCallback(x=>{o(y=>({...y,...x}));},[]),i=useCallback(()=>{n(li),o(Ef);},[]),d=useCallback(()=>{r&&n({...li,assignees:[r]});},[r]),u=useCallback(()=>{n({...li,dateFilter:"overdue"});},[]),p=useCallback(()=>{n({...li,priorities:["HIGH","URGENT"]});},[]),m=useMemo(()=>a.dateFilter!=="all"||a.priorities.length>0||a.assignees.length>0||a.labels.length>0||a.columns.length>0||a.search!==""||s.by!=="none",[a,s]),f=useCallback(x=>{let y=[...x];if(a.search){let b=a.search.toLowerCase();y=y.filter(h=>h.title.toLowerCase().includes(b)||h.description?.toLowerCase().includes(b));}if(a.dateFilter!=="all"){let b=new Date,h=b.getFullYear(),v=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),T=`${h}-${v}-${w}`;y=y.filter(E=>{if(!E.endDate&&!E.dueDate)return false;let F=E.endDate||E.dueDate;if(!F)return false;let k;if(typeof F=="string")k=F.split("T")[0]||F;else {let D=F.getUTCFullYear(),P=String(F.getUTCMonth()+1).padStart(2,"0"),N=String(F.getUTCDate()).padStart(2,"0");k=`${D}-${P}-${N}`;}switch(a.dateFilter){case "overdue":return k<T;case "today":return k===T;case "this-week":let D=new Date(T+"T00:00:00"),P=new Date(k+"T00:00:00"),N=new Date(D);return N.setDate(N.getDate()+7),P>=D&&P<=N;case "custom":if(a.dateRange){let K=typeof F=="string"?new Date(F):F;return K>=a.dateRange.start&&K<=a.dateRange.end}return true;default:return true}});}return a.priorities.length>0&&(y=y.filter(b=>b.priority&&a.priorities.includes(b.priority))),a.assignees.length>0&&(y=y.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(v=>a.assignees.includes(v)))),a.labels.length>0&&(y=y.filter(b=>b.labels&&b.labels.some(h=>a.labels.includes(h)))),a.columns.length>0&&(y=y.filter(b=>a.columns.includes(b.columnId))),s.by!=="none"&&y.sort((b,h)=>{let v=0;switch(s.by){case "created":let w=b.createdAt?new Date(b.createdAt).getTime():0,T=h.createdAt?new Date(h.createdAt).getTime():0;v=w-T;break;case "priority":let E={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},F=E[b.priority||"LOW"],k=E[h.priority||"LOW"];v=F-k;break;case "dueDate":let D=b.endDate||b.dueDate,P=h.endDate||h.dueDate;if(!D)return 1;if(!P)return -1;let N=typeof D=="string"?new Date(D).getTime():D.getTime(),K=typeof P=="string"?new Date(P).getTime():P.getTime();v=N-K;break;case "title":v=b.title.localeCompare(h.title);break;case "estimate":let H=b.estimatedTime||0,te=h.estimatedTime||0;v=H-te;break;default:v=0;}return s.order==="asc"?v:-v}),y},[a,s]);return {filters:a,sort:s,setFilters:c,setSort:l,resetFilters:i,filterMyTasks:d,filterOverdue:u,filterHighPriority:p,applyFilters:f,hasActiveFilters:m}}var Ff,Lf;if(typeof window<"u")try{let e=fi("ai");Ff=e.generateObject,Lf=e.generateText;}catch{}function Af(e={}){let[t,r]=useState(false),[a,n]=useState(null),s=!!(Ff&&Lf&&e.apiKey),o=useCallback(async u=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');r(true),n(null);try{return console.log("Generating plan for:",u),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${u}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let m=p instanceof Error?p:new Error("Failed to generate plan");throw n(m),m}finally{r(false);}},[s]),c=useCallback(async u=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Suggesting assignee for:",u.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let m=p instanceof Error?p:new Error("Failed to suggest assignee");throw n(m),m}finally{r(false);}},[s]),l=useCallback(async u=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(p){let m=p instanceof Error?p:new Error("Failed to predict risks");throw n(m),m}finally{r(false);}},[s]),i=useCallback(async u=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Generating subtasks for:",u.title),[{title:`Subtask 1 for: ${u.title}`,position:u.position+.1,columnId:u.columnId},{title:`Subtask 2 for: ${u.title}`,position:u.position+.2,columnId:u.columnId}]}catch(p){let m=p instanceof Error?p:new Error("Failed to generate subtasks");throw n(m),m}finally{r(false);}},[s]),d=useCallback(async u=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Estimating effort for:",u.title),{hours:8,confidence:.75}}catch(p){let m=p instanceof Error?p:new Error("Failed to estimate effort");throw n(m),m}finally{r(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:c,onPredictRisks:l,onGenerateSubtasks:i,onEstimateEffort:d,isAvailable:s,isLoading:t,error:a}}function Yd(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(n=>{t(n);}),[]);let r=useCallback(a=>{selectionStore.setState(a);},[]);return [e,r]}function If(e){let{cards:t}=e,[r,a]=Yd(),n=useCallback(u=>r.selectedCardIds.includes(u),[r.selectedCardIds]),s=useCallback((u,p)=>{if(!p){a({selectedCardIds:[u],lastSelectedCardId:u});return}let m=p.ctrlKey||p.metaKey,f=p.shiftKey;if(m)r.selectedCardIds.includes(u)?a({selectedCardIds:r.selectedCardIds.filter(x=>x!==u),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,u],lastSelectedCardId:u});else if(f&&r.lastSelectedCardId){let x=t.find(b=>b.id===u),y=t.find(b=>b.id===r.lastSelectedCardId);if(x&&y&&x.columnId===y.columnId){let b=t.filter(k=>k.columnId===x.columnId).sort((k,D)=>k.position-D.position),h=b.findIndex(k=>k.id===r.lastSelectedCardId),v=b.findIndex(k=>k.id===u),[w,T]=h<v?[h,v]:[v,h],E=b.slice(w,T+1).map(k=>k.id),F=Array.from(new Set([...r.selectedCardIds,...E]));a({selectedCardIds:F,lastSelectedCardId:u});}else a({selectedCardIds:[u],lastSelectedCardId:u});}else a({selectedCardIds:[u],lastSelectedCardId:u});},[t,r,a]),o=useCallback(u=>{a({selectedCardIds:r.selectedCardIds.filter(p=>p!==u),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),c=useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),l=useCallback(()=>{a({selectedCardIds:t.map(u=>u.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=useCallback(u=>{r.selectedCardIds.includes(u)?o(u):a({selectedCardIds:[...r.selectedCardIds,u],lastSelectedCardId:u});},[r,o,a]),d=useCallback(()=>t.filter(u=>r.selectedCardIds.includes(u.id)),[t,r.selectedCardIds]);return {selectedCardIds:r.selectedCardIds,lastSelectedCardId:r.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:c,selectAll:l,toggleCard:i,getSelectedCards:d}}var Rf={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Bf(e){let{cards:t,config:r,aiService:a}=e,n=useMemo(()=>({...Rf,...r}),[r]),[s,o]=useState([]),c=useCallback((x,y,b,h,v)=>{if(y.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:y,columnId:b,strategy:h,color:v,isExpanded:true,position:s.filter(T=>T.columnId===b).length,createdAt:new Date};o(T=>[...T,w]);},[n.minCardsPerStack,s]),l=useCallback(x=>{o(y=>y.filter(b=>b.id!==x));},[]),i=useCallback(x=>{o(y=>y.map(b=>b.id===x?{...b,isExpanded:!b.isExpanded}:b));},[]),d=useCallback((x,y)=>{o(b=>b.map(h=>h.id===x&&!h.cardIds.includes(y)?{...h,cardIds:[...h.cardIds,y]}:h));},[]),u=useCallback((x,y)=>{o(b=>b.map(h=>{if(h.id===x){let v=h.cardIds.filter(w=>w!==y);return v.length<n.minCardsPerStack?null:{...h,cardIds:v}}return h}).filter(h=>h!==null));},[n.minCardsPerStack]),p=useCallback(x=>s.filter(y=>y.columnId===x).sort((y,b)=>y.position-b.position),[s]),m=useCallback(async x=>{let y=t.filter(T=>T.columnId===x);if(y.length<n.minCardsPerStack*2)return [];let b=[],h=new Map;y.forEach(T=>{T.labels&&T.labels.length>0&&T.labels.forEach(E=>{h.has(E)||h.set(E,[]),h.get(E).push(T);});}),h.forEach((T,E)=>{T.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${E}`,cardIds:T.map(F=>F.id),columnId:x,strategy:"labels",color:"#00E5CC"},reason:`${T.length} cards with label "${E}"`,confidence:.85});});let v=new Map;y.forEach(T=>{T.assignedUserIds&&T.assignedUserIds.length>0&&T.assignedUserIds.forEach(E=>{v.has(E)||v.set(E,[]),v.get(E).push(T);});}),v.forEach((T,E)=>{T.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${E.slice(-4)}`,cardIds:T.map(F=>F.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${T.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(y.forEach(T=>{T.priority&&(w.has(T.priority)||w.set(T.priority,[]),w.get(T.priority).push(T));}),w.forEach((T,E)=>{if(T.length>=n.minCardsPerStack){let F={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[E.toLowerCase()]||"\u26AA";b.push({stack:{title:`${F} ${E} Priority`,cardIds:T.map(k=>k.id),columnId:x,strategy:"priority",color:E==="high"||E==="urgent"?"#ef4444":"#10b981"},reason:`${T.length} cards with ${E} priority`,confidence:.75});}}),a&&n.enableAutoStacking)for(let T of y){let F=(await a.findSimilar(T,y)).filter(k=>k.similarity>=n.autoStackConfidenceThreshold);if(F.length>=n.minCardsPerStack-1){let k=[T.id,...F.map(P=>P.card.id)],D=F.reduce((P,N)=>P+N.similarity,0)/F.length;b.push({stack:{title:`\u2728 Similar to "${T.title.substring(0,30)}${T.title.length>30?"...":""}"`,cardIds:k,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${F.length+1} similar tasks`,confidence:D});}}return b.filter(T=>T.confidence>=n.autoStackConfidenceThreshold).sort((T,E)=>E.confidence-T.confidence).slice(0,5)},[t,n,a]),f=useCallback(x=>{c(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[c]);return useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(y=>y.columnId)).forEach(async y=>{let b=await m(y),h=b[0];b.length>0&&h&&h.confidence>=.9&&f(h);});},[]),{stacks:s,createStack:c,deleteStack:l,toggleStack:i,addToStack:d,removeFromStack:u,getStacksForColumn:p,getSuggestions:m,applySuggestion:f,config:n}}var $f=createContext(null);function Of({children:e,initialData:t,onStateChange:r}){let a=useRef();if(!a.current){let s=new Map,o=new Map;t?.columns?.forEach(l=>{let{Column:i}=fi("@libxai/core");s.set(l.id,new i(l));}),t?.cards?.forEach(l=>{let{Card:i}=fi("@libxai/core");o.set(l.id,new i(l));});let c=null;if(t?.board){let{Board:l}=fi("@libxai/core");c=new l(t.board);}a.current=new BoardStore({board:c,columns:s,cards:o});}let n=a.current;return useEffect(()=>{if(r)return n.subscribeAll(s=>{r(n.getState());})},[n,r]),jsx($f.Provider,{value:{store:n},children:e})}function Bl(){let e=useContext($f);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function di(){let e=Bl(),[t,r]=useState(e.getBoard()),[a,n]=useState(e.getAllColumns()),[s,o]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{r(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let c=useCallback(h=>{e.updateBoard(h);},[e]),l=useCallback(h=>{e.addColumn(h);},[e]),i=useCallback((h,v)=>{e.updateColumn(h,v);},[e]),d=useCallback(h=>{e.deleteColumn(h);},[e]),u=useCallback(h=>e.getColumn(h),[e]),p=useCallback(h=>{e.addCard(h);},[e]),m=useCallback((h,v)=>{e.updateCard(h,v);},[e]),f=useCallback(h=>{e.deleteCard(h);},[e]),x=useCallback((h,v,w)=>{e.moveCard(h,v,w);},[e]),y=useCallback(h=>e.getCard(h),[e]),b=useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:a,cards:s,updateBoard:c,addColumn:l,updateColumn:i,deleteColumn:d,getColumn:u,addCard:p,updateCard:m,deleteCard:f,moveCard:x,getCard:y,getCardsByColumn:b}}function Uf(e){let{cards:t}=di();return useMemo(()=>e?t.filter(r=>{if(e.searchQuery){let a=e.searchQuery.toLowerCase(),n=r.title.toLowerCase().includes(a),s=r.description?.toLowerCase().includes(a);if(!n&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!r.priority||!e.priorities.includes(r.priority))||e.statuses&&e.statuses.length>0&&(!r.status||!e.statuses.includes(r.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>r.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>r.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(r.columnId)||e.isOverdue!==void 0&&e.isOverdue!==r.isOverdue())}):t,[t,e])}function Wf(e="position",t="asc"){let{cards:r}=di();return useMemo(()=>[...r].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},l=n.priority?c[n.priority]:0,i=s.priority?c[s.priority]:0;o=l-i;break}case "createdAt":o=n.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":o=n.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":o=n.position-s.position;break}return t==="asc"?o:-o}),[r,e,t])}var $l=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Pu.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let r of t.dependencies)if(!this.plugins.has(r))throw new Error(`Plugin ${t.id} depends on ${r} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(r=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,r,{plugin:t.id});});}unregister(t){let r=this.plugins.get(t);if(!r){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}r.onDestroy&&Promise.resolve(r.onDestroy()).catch(a=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,a);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${r.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,r){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);r?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,r){return this.config.get(t)?.[r]}setConfig(t,r,a){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[r]=a,this.pluginLogger.debug(`Plugin config set: ${t}.${r}`,{value:a});}async executeHook(t,r,a){let n=a;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let c=await Promise.resolve(o.apply(s,r));c!==void 0&&(n=c,r[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,r){let a=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&a.push(Promise.resolve(s.apply(n,r)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(a);}},YC=new $l;function Gf({items:e,height:t,estimateSize:r,renderItem:a,className:n="",overscan:s=5,horizontal:o=false,gap:c=0,getItemKey:l}){let i=useRef(null),d=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:s,horizontal:o,gap:c}),u=d.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},m=o?{width:`${d.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${d.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:p,className:n,children:jsx("div",{style:m,children:u.map(f=>{let x=e[f.index];if(!x)return null;let y=l?l(x,f.index):f.index,b={position:"absolute",top:o?0:f.start,left:o?f.start:0,width:o?f.size:"100%",height:o?"100%":f.size};return jsx("div",{style:b,"data-index":f.index,children:a(x,f.index)},y)})})})}function Vf(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 _f({items:e,height:t,width:r="100%",estimateColumnWidth:a,renderColumn:n,className:s="",overscan:o=3,gap:c=16,getItemKey:l,horizontal:i=true}){let d=useRef(null),u=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>d.current,estimateSize:()=>a,overscan:o,gap:c}),p=u.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},f={width:`${u.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:d,style:m,className:s,children:jsx("div",{style:f,children:p.map(x=>{let y=e[x.index];if(!y)return null;let b=l?l(y,x.index):x.index,h={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsx("div",{style:h,"data-index":x.index,children:n(y,x.index)},b)})})})}function Kf(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 qf(e,t=10){return e>t}var Zd={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},eu={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},tu={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},ru={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},au={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},nu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},ou={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},su={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)"},iu={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)"},lu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},cu={column:{width:320,minWidth:280,maxWidth:400,gap:16,padding:12,headerHeight:48},card:{minHeight:80,maxHeight:400,padding:12,gap:8},board:{padding:16,gap:16}},du={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}},Ol={spacing:Zd,borderRadius:eu,fontSize:tu,fontWeight:ru,lineHeight:au,zIndex:nu,duration:ou,easing:su,shadows:iu,opacity:lu,kanban:cu,gantt:du};function Yf(e,t,r){return e[t]??r}function uu(e,t="",r={}){for(let[a,n]of Object.entries(e)){let s=t?`${t}-${a}`:a;typeof n=="object"&&n!==null&&!Array.isArray(n)?uu(n,s,r):(typeof n=="string"||typeof n=="number")&&(r[s]=n);}return r}function QC(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function pu(e="asakaa"){let t=uu(Ol),r=[];for(let[a,n]of Object.entries(t)){let s=`--${e}-${a}`,o=QC(n);r.push(` ${s}: ${o};`);}return `:root {
414
+ ${r.join(`
415
415
  `)}
416
- }`}function si(e,t="asakaa"){let a=[],r=lu(e);for(let[n,s]of Object.entries(r)){let o=`--${t}-color-${n}`;a.push(` ${o}: ${s};`);}return `:root {
417
- ${a.join(`
416
+ }`}function ui(e,t="asakaa"){let r=[],a=uu(e);for(let[n,s]of Object.entries(a)){let o=`--${t}-color-${n}`;r.push(` ${o}: ${s};`);}return `:root {
417
+ ${r.join(`
418
418
  `)}
419
- }`}var Ml={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#00E5CC"},priority:{low:"#6b7280",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#2a2a2a"}},cu={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#00C4AE"},priority:{low:"#9ca3af",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#f9fafb"}},uu={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#00E5CC"},priority:{low:"#71717a",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#71717a",weekend:"#27272a"}};function pu(e=Ml,t="asakaa"){let a=du(t),r=si(e,t);return `${a}
419
+ }`}var Hl={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#00E5CC"},priority:{low:"#6b7280",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#2a2a2a"}},mu={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#00C4AE"},priority:{low:"#9ca3af",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#f9fafb"}},gu={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#00E5CC"},priority:{low:"#71717a",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#71717a",weekend:"#27272a"}};function fu(e=Hl,t="asakaa"){let r=pu(t),a=ui(e,t);return `${r}
420
420
 
421
- ${r}`}function Ef(){return `/**
421
+ ${a}`}function Xf(){return `/**
422
422
  * ASAKAA Design Tokens
423
423
  * Auto-generated from design-tokens.ts
424
424
  * Do not edit this file directly
425
425
  */
426
426
 
427
- ${pu(Ml)}
427
+ ${fu(Hl)}
428
428
 
429
429
  /* Light theme */
430
430
  [data-theme="light"] {
431
- ${si(cu,"asakaa").split(`
431
+ ${ui(mu,"asakaa").split(`
432
432
  `).slice(1,-1).join(`
433
433
  `)}
434
434
  }
435
435
 
436
436
  /* Neutral theme */
437
437
  [data-theme="neutral"] {
438
- ${si(uu,"asakaa").split(`
438
+ ${ui(gu,"asakaa").split(`
439
439
  `).slice(1,-1).join(`
440
440
  `)}
441
441
  }
442
- `}var u5=({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 Mf({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:n,themes:s}=_n();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([o,l])=>{let d=o,i=d===r;return jsxs("button",{onClick:()=>n(d),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${l.displayName} theme`,"aria-pressed":i,title:l.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(u5,{theme:d})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:l.displayName})]},d)})})}
443
- export{Q0 as AIUsageDashboard,Vw as AI_FEATURES,Vc as AI_MODELS,ud as AddCardButton,sd as AddColumnButton,xo as AttachmentUploader,bf as BoardProvider,Ri as BulkOperationsToolbar,Cd as BurnDownChart,N0 as CUSTOM_FIELD_TYPES,R0 as CalendarBoard,So as Card,hd as CardDetailModal,vd as CardDetailModalV2,V0 as CardHistoryReplay,U0 as CardHistoryTimeline,_0 as CardRelationshipsGraph,Iw as CardStack,Pd as CardTemplateSelector,Hl as CircuitBreaker,Hn as Column,Wi as ColumnManager,gd as CommandPalette,Id as ConfigMenu,Jn as ContextMenu,Ls as DEFAULT_SHORTCUTS,C0 as DEFAULT_TABLE_COLUMNS,Md as DEFAULT_TEMPLATES,xs as DateRangePicker,ws as DependenciesSelector,zs as DependencyLine,Td as DistributionCharts,Kl as EditableColumnTitle,Wn as ErrorBoundary,xm as ExportDropdown,Ad as ExportImportModal,Ld as FilterBar,Zm as GANTT_AI_SYSTEM_PROMPT,el as GanttAIAssistant,Ym as GanttBoard,qn as GanttI18nContext,Xi as GanttMilestone,Ui as GanttToolbar,tf as GenerateGanttTasksDialog,Y0 as GeneratePlanModal,Sd as GroupBySelector,Zl as HealthBar,jo as KanbanBoard,od as KanbanToolbar,Ps as KanbanViewAdapter,Ed as KeyboardShortcutsHelp,k0 as ListView,va as MenuIcons,Sl as PluginManager,un as PrioritySelector,ed as ProfitabilityReport,bn as QuickTaskCreate,Ww as RATE_LIMITS,T0 as STANDARD_FIELDS,Nd as SwimlaneBoardView,Yl as TagBadge,cp as TagList,Wo as TagPicker,ji as TaskBar,Mo as TaskDetailModal,Qm as TaskFormModal,Gi as TaskGrid,$d as ThemeModal,im as ThemeProvider,Mf as ThemeSwitcher,bo as TimeInputPopover,Xl as TimePill,Jl as TimePopover,Ji as Timeline,mn as UserAssignmentSelector,kd as VelocityChart,Tf as VirtualGrid,wf as VirtualList,Sn as aiUsageTracker,Jc as borderRadius,pi as calculatePosition,$c as calendarDarkTheme,Lc as calendarEnTranslations,Ic as calendarEsTranslations,Hc as calendarLightTheme,zc as calendarNeutralTheme,kl as calendarThemes,yl as calendarTranslations,rl as cardToGanttTask,sg as cardsToGanttTasks,c as cn,zp as createKanbanView,Jf as createRetryWrapper,Bd as darkTheme,Ml as darkTokenTheme,$i as defaultTheme,El as designTokens,au as duration,ru as easing,Ef as exportTokensToCSS,Bo as findTaskByName,Qc as fontSize,Zc as fontWeight,ai as formatCost,zi as ganttEnTranslations,dm as ganttEsTranslations,ng as ganttTaskToCardUpdate,xt as ganttThemes,iu as ganttTokens,Hd as ganttTranslations,Ie as ganttUtils,du as generateCSSVariables,pu as generateCompleteCSS,Kf as generateInitialPositions,eg as generateTasksContext,si as generateThemeVariables,O0 as getCalendarTheme,Xs as getCalendarTranslations,D0 as getListViewTheme,lc as getListViewTranslations,S0 as getMonthNames,Sf as getToken,cm as getTranslations,E0 as getWeekdayNames,su as kanbanTokens,Rd as lightTheme,cu as lightTokenTheme,eu as lineHeight,Pc as listViewDarkTheme,sc as listViewEnTranslations,ic as listViewEsTranslations,Fc as listViewLightTheme,Ac as listViewNeutralTheme,hl as listViewThemes,ol as listViewTranslations,xl as mergeCalendarTranslations,nl as mergeListViewTranslations,zd as mergeTranslations,Od as neutralTheme,uu as neutralTokenTheme,nu as opacity,rg as parseLocalCommand,rc as parseNaturalDate,oc as parseNaturalDuration,nc as parseProgress,ag as parseStatus,i5 as pluginManager,Xf as retrySyncOperation,mi as retryWithBackoff,ou as shadows,Df as shouldVirtualizeGrid,Xc as spacing,xn as themes,uf as useAI,rf as useBoard,ni as useBoardCore,Dl as useBoardStore,gf as useCardStacking,ad as useDragState,yf as useFilteredCards,sf as useFilters,Yr as useGanttI18n,Nl as useKanbanState,om as useKeyboardShortcuts,pf as useMultiSelect,_c as useSelectionState,xf as useSortedCards,_n as useTheme,Nf as useVirtualGrid,kf as useVirtualList,og as validateAIResponse,pd as withErrorBoundary,fi as wouldCreateCircularDependency,tu as zIndex};//# sourceMappingURL=index.js.map
442
+ `}var ZC=({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 Jf({showLabels:e=true,compact:t=false,className:r=""}){let{theme:a,setTheme:n,themes:s}=Qo();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${r}`,children:Object.entries(s).map(([o,c])=>{let l=o,i=l===a;return jsxs("button",{onClick:()=>n(l),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${c.displayName} theme`,"aria-pressed":i,title:c.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(ZC,{theme:l})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:c.displayName})]},l)})})}
443
+ export{wf as AIUsageDashboard,FC as AI_FEATURES,_d as AI_MODELS,wc as AddCardButton,bc as AddColumnButton,Yo as AttachmentUploader,Of as BoardProvider,zi as BulkOperationsToolbar,Mc as BurnDownChart,S0 as CUSTOM_FIELD_TYPES,nf as CalendarBoard,Ln as Card,pf as CardHistoryReplay,df as CardHistoryTimeline,ff as CardRelationshipsGraph,kC as CardStack,Bc as CardTemplateSelector,Yl as CircuitBreaker,Vo as Column,qi as ColumnManager,Tc as CommandPalette,Uc as ConfigMenu,as as ContextMenu,Us as DEFAULT_SHORTCUTS,N0 as DEFAULT_TABLE_COLUMNS,Rc as DEFAULT_TEMPLATES,Ds as DateRangePicker,Es as DependenciesSelector,Ks as DependencyLine,Pc as DistributionCharts,ac as EditableColumnTitle,qo as ErrorBoundary,wm as ExportDropdown,Oc as ExportImportModal,Hc as FilterBar,tg as GANTT_AI_SYSTEM_PROMPT,sl as GanttAIAssistant,Jm as GanttBoard,es as GanttI18nContext,rl as GanttMilestone,Ki as GanttToolbar,Tf as GenerateGanttTasksDialog,yf as GeneratePlanModal,Ac as GroupBySelector,cc as HealthBar,Jn as KanbanBoard,gc as KanbanToolbar,Os as KanbanViewAdapter,Ic as KeyboardShortcutsHelp,T0 as ListView,nr as MenuIcons,$l as PluginManager,ho as PrioritySelector,dc as ProfitabilityReport,Bs as QuickTaskCreate,PC as RATE_LIMITS,D0 as STANDARD_FIELDS,Fc as SwimlaneBoardView,oc as TagBadge,mp as TagList,jo as TagPicker,Ji as TaskBar,ko as TaskDetailModal,eg as TaskFormModal,Xi as TaskGrid,Vc as ThemeModal,cm as ThemeProvider,Jf as ThemeSwitcher,vn as TimeInputPopover,sc as TimePill,ic as TimePopover,al as Timeline,xo as UserAssignmentSelector,Ec as VelocityChart,_f as VirtualGrid,Gf as VirtualList,Ao as aiUsageTracker,eu as borderRadius,Nl as buildCalendar,hi as calculatePosition,cl as cardToGanttTask,lg as cardsToGanttTasks,g as cn,Gp as createKanbanView,xb as createRetryWrapper,Wc as darkTheme,Hl as darkTokenTheme,Vi as defaultTheme,Ol as designTokens,ou as duration,su as easing,Xf as exportTokensToCSS,Hn as findTaskByName,tu as fontSize,ru as fontWeight,ii as formatCost,_i as ganttEnTranslations,um as ganttEsTranslations,ig as ganttTaskToCardUpdate,lt as ganttThemes,du as ganttTokens,jc as ganttTranslations,Ne as ganttUtils,pu as generateCSSVariables,fu as generateCompleteCSS,fb as generateInitialPositions,rg as generateTasksContext,ui as generateThemeVariables,E0 as getListViewTheme,gd as getListViewTranslations,Yf as getToken,pm as getTranslations,cu as kanbanTokens,zc as lightTheme,mu as lightTokenTheme,au as lineHeight,Bd as listViewDarkTheme,pd as listViewEnTranslations,md as listViewEsTranslations,$d as listViewLightTheme,Od as listViewNeutralTheme,Cl as listViewThemes,dl as listViewTranslations,ul as mergeListViewTranslations,_c as mergeTranslations,Gc as neutralTheme,gu as neutralTokenTheme,lu as opacity,og as parseLocalCommand,cd as parseNaturalDate,dd as parseNaturalDuration,ud as parseProgress,ng as parseStatus,YC as pluginManager,yb as retrySyncOperation,yi as retryWithBackoff,iu as shadows,qf as shouldVirtualizeGrid,Fl as simulateReschedule,Zd as spacing,To as themes,Af as useAI,Df as useBoard,di as useBoardCore,Bl as useBoardStore,Bf as useCardStacking,pc as useDragState,Uf as useFilteredCards,Mf as useFilters,_a as useGanttI18n,Rl as useKanbanState,sm as useKeyboardShortcuts,If as useMultiSelect,Yd as useSelectionState,Wf as useSortedCards,Qo as useTheme,Kf as useVirtualGrid,Vf as useVirtualList,sg as validateAIResponse,kc as withErrorBoundary,wi as wouldCreateCircularDependency,nu as zIndex};//# sourceMappingURL=index.js.map
444
444
  //# sourceMappingURL=index.js.map